diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llcombobox.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/linden/indra/llui/llcombobox.cpp b/linden/indra/llui/llcombobox.cpp index be34325..a93dc9b 100644 --- a/linden/indra/llui/llcombobox.cpp +++ b/linden/indra/llui/llcombobox.cpp | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | // newview includes | 44 | // newview includes |
45 | #include "llbutton.h" | 45 | #include "llbutton.h" |
46 | #include "llfont.h" | ||
46 | #include "llkeyboard.h" | 47 | #include "llkeyboard.h" |
47 | #include "llscrolllistctrl.h" | 48 | #include "llscrolllistctrl.h" |
48 | #include "llwindow.h" | 49 | #include "llwindow.h" |
@@ -60,7 +61,7 @@ S32 MAX_COMBO_WIDTH = 500; | |||
60 | 61 | ||
61 | static LLRegisterWidget<LLComboBox> r1("combo_box"); | 62 | static LLRegisterWidget<LLComboBox> r1("combo_box"); |
62 | 63 | ||
63 | LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, | 64 | LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label, const LLFontGL* font, |
64 | void (*commit_callback)(LLUICtrl*,void*), | 65 | void (*commit_callback)(LLUICtrl*,void*), |
65 | void *callback_userdata | 66 | void *callback_userdata |
66 | ) | 67 | ) |
@@ -76,6 +77,15 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: | |||
76 | mTextEntryCallback( NULL ), | 77 | mTextEntryCallback( NULL ), |
77 | mLabel(label) | 78 | mLabel(label) |
78 | { | 79 | { |
80 | if (font) | ||
81 | { | ||
82 | mGLFont = font; | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | mGLFont = LLFontGL::getFontSansSerifSmall(); | ||
87 | } | ||
88 | |||
79 | // Always use text box | 89 | // Always use text box |
80 | // Text label button | 90 | // Text label button |
81 | mButton = new LLButton(mLabel, | 91 | mButton = new LLButton(mLabel, |
@@ -89,14 +99,14 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: | |||
89 | mButton->setScaleImage(TRUE); | 99 | mButton->setScaleImage(TRUE); |
90 | 100 | ||
91 | mButton->setMouseDownCallback(onButtonDown); | 101 | mButton->setMouseDownCallback(onButtonDown); |
92 | mButton->setFont(LLFontGL::getFontSansSerifSmall()); | 102 | mButton->setFont(mGLFont); |
93 | mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); | 103 | mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); |
94 | mButton->setHAlign( LLFontGL::LEFT ); | 104 | mButton->setHAlign( LLFontGL::LEFT ); |
95 | mButton->setRightHPad(2); | 105 | mButton->setRightHPad(2); |
96 | addChild(mButton); | 106 | addChild(mButton); |
97 | 107 | ||
98 | // disallow multiple selection | 108 | // disallow multiple selection |
99 | mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), | 109 | mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(), mGLFont, |
100 | &LLComboBox::onItemSelected, this, FALSE); | 110 | &LLComboBox::onItemSelected, this, FALSE); |
101 | mList->setVisible(FALSE); | 111 | mList->setVisible(FALSE); |
102 | mList->setBgWriteableColor( LLColor4(1,1,1,1) ); | 112 | mList->setBgWriteableColor( LLColor4(1,1,1,1) ); |
@@ -167,11 +177,14 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * | |||
167 | S32 max_chars = 20; | 177 | S32 max_chars = 20; |
168 | node->getAttributeS32("max_chars", max_chars); | 178 | node->getAttributeS32("max_chars", max_chars); |
169 | 179 | ||
180 | LLFontGL* font = LLView::selectFont(node); | ||
181 | |||
170 | LLUICtrlCallback callback = NULL; | 182 | LLUICtrlCallback callback = NULL; |
171 | 183 | ||
172 | LLComboBox* combo_box = new LLComboBox(name, | 184 | LLComboBox* combo_box = new LLComboBox(name, |
173 | rect, | 185 | rect, |
174 | label, | 186 | label, |
187 | font, | ||
175 | callback, | 188 | callback, |
176 | NULL); | 189 | NULL); |
177 | combo_box->setAllowTextEntry(allow_text_entry, max_chars); | 190 | combo_box->setAllowTextEntry(allow_text_entry, max_chars); |
@@ -540,7 +553,7 @@ void LLComboBox::updateLayout() | |||
540 | mTextEntry = new LLLineEditor(std::string("combo_text_entry"), | 553 | mTextEntry = new LLLineEditor(std::string("combo_text_entry"), |
541 | text_entry_rect, | 554 | text_entry_rect, |
542 | LLStringUtil::null, | 555 | LLStringUtil::null, |
543 | LLFontGL::getFontSansSerifSmall(), | 556 | mGLFont, |
544 | mMaxChars, | 557 | mMaxChars, |
545 | onTextCommit, | 558 | onTextCommit, |
546 | onTextEntry, | 559 | onTextEntry, |
@@ -1153,7 +1166,7 @@ LLFlyoutButton::LLFlyoutButton( | |||
1153 | const std::string& label, | 1166 | const std::string& label, |
1154 | void (*commit_callback)(LLUICtrl*, void*) , | 1167 | void (*commit_callback)(LLUICtrl*, void*) , |
1155 | void *callback_userdata) | 1168 | void *callback_userdata) |
1156 | : LLComboBox(name, rect, LLStringUtil::null, commit_callback, callback_userdata), | 1169 | : LLComboBox(name, rect, LLStringUtil::null, NULL, commit_callback, callback_userdata), |
1157 | mToggleState(FALSE), | 1170 | mToggleState(FALSE), |
1158 | mActionButton(NULL) | 1171 | mActionButton(NULL) |
1159 | { | 1172 | { |
@@ -1214,6 +1227,8 @@ LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const | |||
1214 | } | 1227 | } |
1215 | } | 1228 | } |
1216 | 1229 | ||
1230 | node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); | ||
1231 | |||
1217 | return node; | 1232 | return node; |
1218 | } | 1233 | } |
1219 | 1234 | ||