diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrl.h | 2 | ||||
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 27 | ||||
-rw-r--r-- | indra/llui/llaccordionctrltab.h | 4 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 39 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 7 |
5 files changed, 51 insertions, 28 deletions
diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 3ad5274085..b5fdf796cd 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -138,6 +138,8 @@ public: */ const LLAccordionCtrlTab* getExpandedTab() const; + const LLAccordionCtrlTab* getSelectedTab() const { return mSelectedTab; } + private: void initNoTabsWidget(const LLTextBox::Params& tb_params); void updateNoTabsHelpTextVisibility(); diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 54bb328a18..20e4b7867c 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -76,6 +76,8 @@ public: std::string getTitle(); void setTitle(const std::string& title, const std::string& hl); + void setTitleFontStyle(std::string style); + void setSelected(bool is_selected) { mIsSelected = is_selected; } virtual void onMouseEnter(S32 x, S32 y, MASK mask); @@ -102,6 +104,9 @@ private: LLPointer<LLUIImage> mImageHeaderPressed; LLPointer<LLUIImage> mImageHeaderFocused; + // style saved when applying it in setTitleFontStyle + LLStyle::Params mStyleParams; + LLUIColor mHeaderBGColor; bool mNeedsHighlight; @@ -170,12 +175,23 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& t { LLTextUtil::textboxSetHighlightedVal( mHeaderTextbox, - LLStyle::Params(), + mStyleParams, title, hl); } } +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleFontStyle(std::string style) +{ + if (mHeaderTextbox) + { + std::string text = mHeaderTextbox->getText(); + mStyleParams.font(mHeaderTextbox->getDefaultFont()); + mStyleParams.font.style(style); + mHeaderTextbox->setText(text, mStyleParams); + } +} + void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() { S32 width = getRect().getWidth(); @@ -495,6 +511,15 @@ void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& h } } +void LLAccordionCtrlTab::setTitleFontStyle(std::string style) +{ + LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME); + if (header) + { + header->setTitleFontStyle(style); + } +} + boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb) { LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME); diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 7bf7eeef8f..e17ecc5319 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -37,6 +37,7 @@ #include "llrect.h" #include "lluictrl.h" #include "lluicolor.h" +#include "llstyle.h" class LLUICtrlFactory; class LLUIImage; @@ -120,6 +121,9 @@ public: // Set text and highlight substring in LLAccordionCtrlTabHeader void setTitle(const std::string& title, const std::string& hl = LLStringUtil::null); + // Set text font style in LLAccordionCtrlTabHeader + void setTitleFontStyle(std::string style); + boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb); boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 3c6c7d3e82..2d0d5c12cb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -152,6 +152,7 @@ LLTextBase::Params::Params() bg_writeable_color("bg_writeable_color"), bg_focus_color("bg_focus_color"), allow_scroll("allow_scroll", true), + plain_text("plain_text",false), track_end("track_end", false), read_only("read_only", false), v_pad("v_pad", 0), @@ -200,6 +201,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mSelectionStart( 0 ), mSelectionEnd( 0 ), mIsSelecting( FALSE ), + mPlainText ( p.plain_text ), mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), mParseHTML(p.allow_html), @@ -1614,7 +1616,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para part = (S32)LLTextParser::MIDDLE; } std::string subtext=text.substr(0,start); - appendAndHighlightTextImpl(subtext, part, style_params); + appendAndHighlightText(subtext, part, style_params); } // output an optional icon before the Url @@ -1635,11 +1637,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para // output the styled Url (unless we've been asked to suppress hyperlinking) if (match.isLinkDisabled()) { - appendAndHighlightTextImpl(match.getLabel(), part, style_params); + appendAndHighlightText(match.getLabel(), part, style_params); } else { - appendAndHighlightTextImpl(match.getLabel(), part, link_params); + appendAndHighlightText(match.getLabel(), part, link_params); // set the tooltip for the Url label if (! match.getTooltip().empty()) @@ -1667,11 +1669,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END; if (end < (S32)text.length()) - appendAndHighlightTextImpl(text, part, style_params); + appendAndHighlightText(text, part, style_params); } else { - appendAndHighlightTextImpl(new_text, part, style_params); + appendAndHighlightText(new_text, part, style_params); } } @@ -1682,23 +1684,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c if(prepend_newline) appendLineBreakSegment(input_params); - std::string::size_type start = 0; - std::string::size_type pos = new_text.find("\n",start); - - while(pos!=-1) - { - if(pos!=start) - { - std::string str = std::string(new_text,start,pos-start); - appendTextImpl(str,input_params); - } - appendLineBreakSegment(input_params); - start = pos+1; - pos = new_text.find("\n",start); - } - - std::string str = std::string(new_text,start,new_text.length()-start); - appendTextImpl(str,input_params); + appendTextImpl(new_text,input_params); } void LLTextBase::needsReflow(S32 index) @@ -1718,6 +1704,10 @@ void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params) void LLTextBase::appendImageSegment(S32 highlight_part, const LLStyle::Params& style_params) { + if(getPlainText()) + { + return; + } segment_vec_t segments; LLStyleConstSP sp(new LLStyle(style_params)); segments.push_back(new LLImageTextSegment(sp, getLength(),*this)); @@ -1797,13 +1787,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig } } -void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params) +void LLTextBase::appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params) { if (new_text.empty()) return; - if(prepend_newline) - appendLineBreakSegment(style_params); - std::string::size_type start = 0; std::string::size_type pos = new_text.find("\n",start); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 89ce5cdc8e..92876e20d6 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -86,6 +86,7 @@ public: track_end, read_only, allow_scroll, + plain_text, wrap, use_ellipses, allow_html, @@ -177,6 +178,9 @@ public: void setReadOnly(bool read_only) { mReadOnly = read_only; } bool getReadOnly() { return mReadOnly; } + void setPlainText(bool value) { mPlainText = value;} + bool getPlainText() const { return mPlainText; } + // cursor manipulation bool setCursor(S32 row, S32 column); bool setCursorPos(S32 cursor_pos, bool keep_cursor_offset = false); @@ -274,7 +278,7 @@ protected: S32 insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted S32 removeStringNoUndo(S32 pos, S32 length); S32 overwriteCharNoUndo(S32 pos, llwchar wc); - void appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& stylep); + void appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep); // manage segments @@ -366,6 +370,7 @@ protected: bool mReadOnly; bool mBGVisible; // render background? bool mClipPartial; // false if we show lines that are partially inside bounding rect + bool mPlainText; // didn't use Image or Icon segments S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes // support widgets |