GUITable::GUITable(gui::IGUIEnvironment *env, gui::IGUIElement* parent, s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc ): gui::IGUIElement(gui::EGUIET_ELEMENT, env, parent, id, rectangle), m_tsrc(tsrc), m_is_textlist(false), m_has_tree_column(false), m_selected(-1), m_sel_column(0), m_sel_doubleclick(false), m_keynav_time(0), m_keynav_buffer(L""), m_border(true), m_color(255, 255, 255, 255), m_background(255, 0, 0, 0), m_highlight(255, 70, 100, 50), m_highlight_text(255, 255, 255, 255), m_rowheight(1), m_font(NULL), m_scrollbar(NULL) { assert(tsrc != NULL); gui::IGUISkin* skin = Environment->getSkin(); m_font = skin->getFont(); if (m_font) { m_font->grab(); m_rowheight = m_font->getDimension(L"A").Height + 4; m_rowheight = MYMAX(m_rowheight, 1); } const s32 s = skin->getSize(gui::EGDS_SCROLLBAR_SIZE); m_scrollbar = Environment->addScrollBar(false, core::rect<s32>(RelativeRect.getWidth() - s, 0, RelativeRect.getWidth(), RelativeRect.getHeight()), this, -1); m_scrollbar->setSubElement(true); m_scrollbar->setTabStop(false); m_scrollbar->setAlignment(gui::EGUIA_LOWERRIGHT, gui::EGUIA_LOWERRIGHT, gui::EGUIA_UPPERLEFT, gui::EGUIA_LOWERRIGHT); m_scrollbar->setVisible(false); m_scrollbar->setPos(0); setTabStop(true); setTabOrder(-1); updateAbsolutePosition(); core::rect<s32> relative_rect = m_scrollbar->getRelativePosition(); s32 width = (relative_rect.getWidth()/(2.0/3.0)) * porting::getDisplayDensity() * g_settings->getFloat("gui_scaling"); m_scrollbar->setRelativePosition(core::rect<s32>( relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y, relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y )); }
ScrollBar::ScrollBar( Widget* parent, const Rect& rectangle, bool horizontal, int id, bool noclip) : Widget( parent, id, rectangle ), _dragging(false), _isSliderHovered( false ), _lastSliderHovered( true ), _horizontal( horizontal ), _draggedBySlider(false), _trayClick(false), _overrideBgColorEnabled( false ), _visibleFilledArea( true ), _overrideBgColor( 0 ), _value(0), _sliderPos(0), _lastSliderPos( 0 ), _drawLenght(0), _minValue(0), _maxVallue(100), _smallStep(10), _largeStep(50), _desiredPos(0), _lastTimeChange(0), _d( new Impl ) { _d->upButton = 0; _d->downButton = 0; _d->sliderPictureUp = Picture::load( ResourceGroup::panelBackground, 59 ); _d->sliderPictureDown = Picture::load( ResourceGroup::panelBackground, 51 ); #ifdef _DEBUG setDebugName("ScrollBar"); #endif refreshControls_(); setNotClipped(noclip); // this element can be tabbed to setTabStop(true); setTabOrder(-1); setPos(0); }
LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width, const LLFontGL* font, BOOL mouse_opaque) : LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(font ? font : LLFontGL::sSansSerifSmall), mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")), mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), mHoverActive( FALSE ), mHasHover( FALSE ), mBackgroundVisible(FALSE), mBorderVisible(FALSE), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), mBorderDropShadowVisible(FALSE), mUseEllipses( FALSE ), mHPad(0), mVPad(0), mHAlign(LLFontGL::LEFT), mVAlign( LLFontGL::TOP ), mClickedCallback(NULL), mCallbackUserData(NULL) { setWrappedText(text, max_width); reshapeToFitText(); setTabStop(FALSE); }
LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) : LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(LLFontGL::getFontSansSerifSmall()) { initDefaults(); setText( name_and_label ); setTabStop(FALSE); }
void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent) { BOOL has_tab_stop = hasTabStop(); node->getAttributeBOOL("tab_stop", has_tab_stop); setTabStop(has_tab_stop); LLView::initFromXML(node, parent); }
LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text, const LLFontGL* font, BOOL mouse_opaque) : LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) { initDefaults(); setText( text ); setTabStop(FALSE); }
LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width, const LLFontGL* font, BOOL mouse_opaque) : LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(font ? font : LLFontGL::getFontSansSerifSmall()) { initDefaults(); setWrappedText(text, max_width); reshapeToFitText(); setTabStop(FALSE); }
//! constructor CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : IGUIWindow(environment, parent, id, rectangle), Dragging(false), IsDraggable(true), DrawBackground(true), DrawTitlebar(true), IsActive(false) { #ifdef _DEBUG setDebugName("CGUIWindow"); #endif IGUISkin* skin = 0; if (environment) skin = environment->getSkin(); CurrentIconColor = video::SColor(255,255,255,255); s32 buttonw = 15; if (skin) { buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); } s32 posx = RelativeRect.getWidth() - buttonw - 4; CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" ); CloseButton->setSubElement(true); CloseButton->setTabStop(false); CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); posx -= buttonw + 2; RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" ); RestoreButton->setVisible(false); RestoreButton->setSubElement(true); RestoreButton->setTabStop(false); RestoreButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); posx -= buttonw + 2; MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" ); MinButton->setVisible(false); MinButton->setSubElement(true); MinButton->setTabStop(false); MinButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); MinButton->grab(); RestoreButton->grab(); CloseButton->grab(); // this element is a tab group setTabGroup(true); setTabStop(true); setTabOrder(-1); refreshSprites(); updateClientRect(); }
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id) : LLUICtrl(name, rect, FALSE, // mouse opaque NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mColor( LLColor4::white ) { setImage( image_id ); setTabStop(FALSE); }
LLRadioCtrl::LLRadioCtrl(const std::string& name, const LLRect& rect, const std::string& label, const std::string& value, const LLFontGL* font, commit_callback_t commit_callback) : LLCheckBoxCtrl(name, rect, label, font, commit_callback, FALSE, RADIO_STYLE), mPayload(value) { setTabStop(FALSE); // use name as default "Value" for backwards compatibility if (value.empty()) { mPayload = name; } }
//! constructor CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : IGUICheckBox(environment, parent, id, rectangle), checkTime(0), Pressed(false), Checked(checked) { #ifdef _DEBUG setDebugName("CGUICheckBox"); #endif // this element can be tabbed into setTabStop(true); setTabOrder(-1); }
//! constructor CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : IGUIComboBox(environment, parent, id, rectangle), ListButton(0), SelectedText(0), ListBox(0), LastFocus(0), Selected(-1), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), MaxSelectionRows(5), HasFocus(false), ActiveFont(0) { #ifdef _DEBUG setDebugName("CGUIComboBox"); #endif IGUISkin* skin = Environment->getSkin(); s32 width = 15; if (skin) width = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); core::rect<s32> r; r.UpperLeftCorner.X = rectangle.getWidth() - width - 2; r.LowerRightCorner.X = rectangle.getWidth() - 2; r.UpperLeftCorner.Y = 2; r.LowerRightCorner.Y = rectangle.getHeight() - 2; ListButton = Environment->addButton(r, this, -1, L""); if (skin && skin->getSpriteBank()) { ListButton->setSpriteBank(skin->getSpriteBank()); ListButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL)); ListButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL)); } ListButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); ListButton->setSubElement(true); ListButton->setTabStop(false); r.UpperLeftCorner.X = 2; r.UpperLeftCorner.Y = 2; r.LowerRightCorner.X = RelativeRect.getWidth() - (ListButton->getAbsolutePosition().getWidth() + 2); r.LowerRightCorner.Y = RelativeRect.getHeight() - 2; SelectedText = Environment->addStaticText(L"", r, false, false, this, -1, false); SelectedText->setSubElement(true); SelectedText->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); SelectedText->setTextAlignment(EGUIA_UPPERLEFT, EGUIA_CENTER); if (skin) SelectedText->setOverrideColor(skin->getColor(EGDC_BUTTON_TEXT)); SelectedText->enableOverrideColor(true); // this element can be tabbed to setTabStop(true); setTabOrder(-1); }
LLIconCtrl::LLIconCtrl(const LLString& name, const LLRect &rect, const LLString &image_name) : LLUICtrl(name, rect, FALSE, // mouse opaque NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mColor( LLColor4::white ), mImageName(image_name) { LLUUID image_id; image_id.set(LLUI::sAssetsGroup->getString( image_name )); setImage( image_id ); setTabStop(FALSE); }
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name, const S32& min_width, const S32& min_height) : LLUICtrl(name, rect, FALSE, // mouse opaque NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mColor( LLColor4::white ), mPriority(0), mMinWidth(min_width), mMinHeight(min_height) { setValue( image_name ); setTabStop(FALSE); }
void LLPanel::init() { // mRectControl mBgColorAlpha = LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ); mBgColorOpaque = LLUI::sColorsGroup->getColor( "FocusBackgroundColor" ); mDefaultBtnHighlight = LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ); mBgVisible = FALSE; mBgOpaque = FALSE; mBorder = NULL; mDefaultBtn = NULL; setIsChrome(FALSE); //is this a decorator to a live window or a form? setTabStop(FALSE); mVisibleSignal = NULL; }
LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) : LLUICtrl(p), mColor(p.color()), mImagep(p.image), // mUseDrawContextAlpha(p.use_draw_context_alpha), mPriority(0), mMinWidth(p.min_width), mMinHeight(p.min_height) { if (mImagep.notNull()) { LLUICtrl::setValue(mImagep->getName()); } setTabStop(false); }
//! constructor CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle, bool is_rtl) : IGUIEditBox(environment, parent, id, rectangle), MouseMarking(false), Border(border), OverrideColorEnabled(false), MarkBegin(0), MarkEnd(0), OverrideColor(video::SColor(101,255,255,255)), OverrideFont(0), LastBreakFont(0), Operator(0), BlinkStartTime(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0), WordWrap(false), MultiLine(false), AutoScroll(true), PasswordBox(false), PasswordChar(L'*'), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), CurrentTextRect(0,0,1,1), FrameRect(rectangle) { //m_rtl = is_rtl; m_rtl = false; // FIXME quick hack to enable mark movement with keyboard and mouse for rtl language, // don't know why it's disabled in the first place, because STK fail // to input unicode characters before? #ifdef _DEBUG setDebugName("CGUIEditBox"); #endif Text = text; if (Environment) Operator = Environment->getOSOperator(); if (Operator) Operator->grab(); // this element can be tabbed to setTabStop(true); setTabOrder(-1); IGUISkin *skin = 0; if (Environment) skin = Environment->getSkin(); if (Border && skin) { FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1; FrameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1; FrameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1; FrameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1; } breakText(); calculateScrollPos(); }
//! constructor CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle, bool noclip) : IGUIButton(environment, parent, id, rectangle), SpriteBank(0), OverrideFont(0), ClickTime(0), HoverTime(0), FocusTime(0), IsPushButton(false), Pressed(false), UseAlphaChannel(false), DrawBorder(true), ScaleImage(false) { #ifdef _DEBUG setDebugName("CGUIButton"); #endif setNotClipped(noclip); // This element can be tabbed. setTabStop(true); setTabOrder(-1); }
//! constructor CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle, bool noclip) : IGUIButton(environment, parent, id, rectangle), Pressed(false), IsPushButton(false), UseAlphaChannel(false), Border(true), ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0) { #ifdef _DEBUG setDebugName("CGUIButton"); #endif setNotClipped(noclip); // Initialize the sprites. for (u32 i=0; i<EGBS_COUNT; ++i) ButtonSprites[i].Index = -1; // This element can be tabbed. setTabStop(true); setTabOrder(-1); }
void LLScrollableContainerView::init() { LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); mBorder = new LLViewBorder( std::string("scroll border"), border_rect, LLViewBorder::BEVEL_IN ); addChild( mBorder ); mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 ); mInnerRect.stretch( -mBorder->getBorderWidth() ); LLRect vertical_scroll_rect = mInnerRect; vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - SCROLLBAR_SIZE; mScrollbar[VERTICAL] = new LLScrollbar( std::string("scrollable vertical"), vertical_scroll_rect, LLScrollbar::VERTICAL, mInnerRect.getHeight(), 0, mInnerRect.getHeight(), NULL, this, VERTICAL_MULTIPLE); addChild( mScrollbar[VERTICAL] ); mScrollbar[VERTICAL]->setVisible( FALSE ); mScrollbar[VERTICAL]->setFollowsRight(); mScrollbar[VERTICAL]->setFollowsTop(); mScrollbar[VERTICAL]->setFollowsBottom(); LLRect horizontal_scroll_rect = mInnerRect; horizontal_scroll_rect.mTop = horizontal_scroll_rect.mBottom + SCROLLBAR_SIZE; mScrollbar[HORIZONTAL] = new LLScrollbar( std::string("scrollable horizontal"), horizontal_scroll_rect, LLScrollbar::HORIZONTAL, mInnerRect.getWidth(), 0, mInnerRect.getWidth(), NULL, this, HORIZONTAL_MULTIPLE); addChild( mScrollbar[HORIZONTAL] ); mScrollbar[HORIZONTAL]->setVisible( FALSE ); mScrollbar[HORIZONTAL]->setFollowsLeft(); mScrollbar[HORIZONTAL]->setFollowsRight(); setTabStop(FALSE); }
//! constructor CGUIImageViewer::CGUIImageViewer( IGUIEnvironment* env, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle) : IGUIElement( EGUIET_ELEMENT, env, parent, id, rectangle) { #ifdef _DEBUG setDebugName("CGUIImageViewer"); #endif // this element can be tabbed to setTabStop(false); setTabOrder(-1); IGUISkin *skin = 0; if (Environment) skin = Environment->getSkin(); Environment->setFocus(this); }
LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) : LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP), mFontGL(LLFontGL::sSansSerifSmall), mTextColor(LLUI::sColorsGroup->getColor("LabelTextColor")), mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), mBackgroundVisible(FALSE), mBorderVisible(FALSE), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), mBorderDropShadowVisible(FALSE), mHPad(0), mVPad(0), mHAlign(LLFontGL::LEFT), mVAlign( LLFontGL::TOP ), mClickedCallback(NULL), mCallbackUserData(NULL) { setText( name_and_label ); setTabStop(FALSE); }
//! constructor CGUIScrollBar::CGUIScrollBar(bool horizontal, IGUIEnvironment* environment, IGUIElement* parent, SINT32 id, rect<SINT32> rectangle, bool noclip) : IGUIScrollBar(environment, parent, id, rectangle), UpButton(0), DownButton(0), Dragging(false), Horizontal(horizontal), DraggedBySlider(false), TrayClick(false), Pos(0), DrawPos(0), DrawHeight(0), Min(0), Max(100), SmallStep(10), LargeStep(50), DesiredPos(0), LastChange(0) { #ifdef _DEBUG setDebugName("CGUIScrollBar"); #endif refreshControls(); setNotClipped(noclip); // this element can be tabbed to setTabStop(true); setTabOrder(-1); setPos(0); }
QEditor::QEditor( QWidget* parent, const char* name ) : Q3TextEdit( parent, name ) { getDocument()->setUseFormatCollection( FALSE ); parenMatcher = new ParenMatcher(); m_currentLine = -1; getDocument()->addSelection( ParenMatcher::Match ); getDocument()->addSelection( ParenMatcher::Mismatch ); getDocument()->setSelectionColor( ParenMatcher::Match, QColor( 204, 232, 195 ) ); getDocument()->setSelectionColor( ParenMatcher::Mismatch, Qt::magenta ); //document()->setInvertSelectionText( ParenMatcher::Match, FALSE ); //document()->setInvertSelectionText( ParenMatcher::Mismatch, FALSE ); getDocument()->addSelection( sel0 ); getDocument()->setSelectionColor( sel0, QColor( 204, 232, 195 ) ); getDocument()->addSelection( sel1 ); getDocument()->setSelectionColor( sel1, QColor( 204, 207, 255 ) ); setLanguage("c++"); setTabStop(2); setWordWrap(Q3TextEdit::NoWrap); setTextFormat(Qt::PlainText); //connect( this, SIGNAL(cursorPositionChanged(QTextCursor*) ), // this, SLOT(doMatch(QTextCursor*)) ); // connect( this, SIGNAL(cursorPositionChanged(int, int) ), // this, SLOT(slotCursorPositionChanged(int, int)) ); }
//! constructor CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : IGUIComboBox(environment, parent, id, rectangle), ListButton(0), ListBox(0), Selected(-1), HasFocus(false), LastFocus(0) { #ifdef _DEBUG setDebugName("CGUICheckBox"); #endif IGUISkin* skin = Environment->getSkin(); s32 width = 15; if (skin) width = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); core::rect<s32> r; r.UpperLeftCorner.X = rectangle.getWidth() - width - 2; r.LowerRightCorner.X = rectangle.getWidth() - 2; r.UpperLeftCorner.Y = 2; r.LowerRightCorner.Y = rectangle.getHeight() - 2; ListButton = Environment->addButton(r, this, -1, L""); if (skin && skin->getSpriteBank()) { ListButton->setSpriteBank(skin->getSpriteBank()); ListButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL)); ListButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL)); } ListButton->setSubElement(true); ListButton->setTabStop(false); // this element can be tabbed to setTabStop(true); setTabOrder(-1); }
LLUICtrlLocate() : LLUICtrl(std::string("locate"), LLRect(0,0,0,0), FALSE, NULL, NULL) { setTabStop(FALSE); }
void LLUICtrl::initFromParams(const Params& p) { LLView::initFromParams(p); setIsChrome(p.chrome); setControlName(p.control_name); if(p.enabled_controls.isProvided()) { if (p.enabled_controls.enabled.isChosen()) { LLControlVariable* control = findControl(p.enabled_controls.enabled); if (control) setEnabledControlVariable(control); } else if(p.enabled_controls.disabled.isChosen()) { LLControlVariable* control = findControl(p.enabled_controls.disabled); if (control) setDisabledControlVariable(control); } } if(p.controls_visibility.isProvided()) { if (p.controls_visibility.visible.isChosen()) { LLControlVariable* control = findControl(p.controls_visibility.visible); if (control) setMakeVisibleControlVariable(control); } else if (p.controls_visibility.invisible.isChosen()) { LLControlVariable* control = findControl(p.controls_visibility.invisible); if (control) setMakeInvisibleControlVariable(control); } } setTabStop(p.tab_stop); if (p.initial_value.isProvided() && !p.control_name.isProvided()) { setValue(p.initial_value); } if (p.commit_callback.isProvided()) { setCommitCallback(initCommitCallback(p.commit_callback)); } if (p.validate_callback.isProvided()) { setValidateCallback(initEnableCallback(p.validate_callback)); } if (p.init_callback.isProvided()) { if (p.init_callback.function.isProvided()) { p.init_callback.function()(this, p.init_callback.parameter); } else { commit_callback_t* initfunc = (CommitCallbackRegistry::getValue(p.init_callback.function_name)); if (initfunc) { (*initfunc)(this, p.init_callback.parameter); } } } if(p.mouseenter_callback.isProvided()) { setMouseEnterCallback(initCommitCallback(p.mouseenter_callback)); } if(p.mouseleave_callback.isProvided()) { setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback)); } }
LLScrollbar::LLScrollbar( const std::string& name, LLRect rect, LLScrollbar::ORIENTATION orientation, S32 doc_size, S32 doc_pos, S32 page_size, void (*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), void* callback_user_data, S32 step_size) : LLUICtrl( name, rect, TRUE, NULL, NULL ), mChangeCallback( change_callback ), mCallbackUserData( callback_user_data ), mOrientation( orientation ), mDocSize( doc_size ), mDocPos( doc_pos ), mPageSize( page_size ), mStepSize( step_size ), mDocChanged(FALSE), mDragStartX( 0 ), mDragStartY( 0 ), mHoverGlowStrength(0.15f), mCurGlowStrength(0.f), mTrackColor( LLUI::sColorsGroup->getColor("ScrollbarTrackColor") ), mThumbColor ( LLUI::sColorsGroup->getColor("ScrollbarThumbColor") ), mHighlightColor ( LLUI::sColorsGroup->getColor("DefaultHighlightLight") ), mShadowColor ( LLUI::sColorsGroup->getColor("DefaultShadowLight") ), mOnScrollEndCallback( NULL ), mOnScrollEndData( NULL ) { //llassert( 0 <= mDocSize ); //llassert( 0 <= mDocPos && mDocPos <= mDocSize ); setTabStop(FALSE); updateThumbRect(); // Page up and page down buttons LLRect line_up_rect; std::string line_up_img; std::string line_up_selected_img; std::string line_down_img; std::string line_down_selected_img; LLRect line_down_rect; if( LLScrollbar::VERTICAL == mOrientation ) { line_up_rect.setLeftTopAndSize( 0, getRect().getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE ); line_up_img="UIImgBtnScrollUpOutUUID"; line_up_selected_img="UIImgBtnScrollUpInUUID"; line_down_rect.setOriginAndSize( 0, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE ); line_down_img="UIImgBtnScrollDownOutUUID"; line_down_selected_img="UIImgBtnScrollDownInUUID"; } else { // Horizontal line_up_rect.setOriginAndSize( 0, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE ); line_up_img="UIImgBtnScrollLeftOutUUID"; line_up_selected_img="UIImgBtnScrollLeftInUUID"; line_down_rect.setOriginAndSize( getRect().getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE ); line_down_img="UIImgBtnScrollRightOutUUID"; line_down_selected_img="UIImgBtnScrollRightInUUID"; } LLButton* line_up_btn = new LLButton(std::string("Line Up"), line_up_rect, line_up_img, line_up_selected_img, LLStringUtil::null, &LLScrollbar::onLineUpBtnPressed, this, LLFontGL::getFontSansSerif() ); if( LLScrollbar::VERTICAL == mOrientation ) { line_up_btn->setFollowsRight(); line_up_btn->setFollowsTop(); } else { // horizontal line_up_btn->setFollowsLeft(); line_up_btn->setFollowsBottom(); } line_up_btn->setHeldDownCallback( &LLScrollbar::onLineUpBtnPressed ); line_up_btn->setTabStop(FALSE); line_up_btn->setScaleImage(TRUE); addChild(line_up_btn); LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect, line_down_img, line_down_selected_img, LLStringUtil::null, &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() ); line_down_btn->setFollowsRight(); line_down_btn->setFollowsBottom(); line_down_btn->setHeldDownCallback( &LLScrollbar::onLineDownBtnPressed ); line_down_btn->setTabStop(FALSE); line_down_btn->setScaleImage(TRUE); addChild(line_down_btn); }
//--------------------------------------------------------------------------- // Singu Note: We could clean a lot of this up by creating derived classes for Notifications and NotificationTips. LLNotifyBox::LLNotifyBox(LLNotificationPtr notification) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(gNotifyBoxView->getChildCount() == 0), // Only animate first window mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(false), mUserInputBox(NULL) { std::string edit_text_name; std::string edit_text_contents; // setup paramaters const std::string& message(notification->getMessage()); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); bool is_textbox = form->getElement("message").isDefined(); bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup"); LLRect rect = mIsTip ? getNotifyTipRect(message) : getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution); if ((form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE || form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)) rect.mBottom -= BTN_HEIGHT; setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; auto icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), mIsTip ? "notify_tip_icon.tga" : mIsCaution ? "notify_caution_icon.tga" : "notify_box_icon.tga"); icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; auto caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. auto text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, LLStringUtil::null, sFont, FALSE, true); text->setWordWrap(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent auto text_color = gColors.getColor(mIsCaution && mIsTip ? "NotifyCautionWarnColor" : "NotifyTextColor"); text->setReadOnlyFgColor(text_color); //sets caution text color for tip notifications if (!mIsCaution) // We could do some extra color math here to determine if bg's too close to link color, but let's just cross with the link color instead text->setLinkColor(new LLColor4(lerp(text_color, gSavedSettings.getColor4("HTMLLinkColor"), 0.4f))); text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) text->appendText(message,false,false,nullptr,!layout_script_dialog); // Now we can set the text, since colors have been set. addChild(text); } if (mIsTip) { chat_notification(mNotification); } else { mNextBtn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLNotifyBox::moveToBack, this, true), sFont); mNextBtn->setScaleImage(TRUE); mNextBtn->setToolTip(LLTrans::getString("next")); addChild(mNextBtn); for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); std::string element_type = form_element["type"].asString(); if (element_type == "button") { addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean(), layout_script_dialog); } else if (element_type == "input") { edit_text_contents = form_element["value"].asString(); edit_text_name = form_element["name"].asString(); } } if (is_textbox) { S32 button_rows = layout_script_dialog ? 2 : 1; LLRect input_rect; input_rect.setOriginAndSize(x, BOTTOM_PAD + button_rows * (BTN_HEIGHT + VPAD), 3 * 80 + 4 * HPAD, button_rows * (BTN_HEIGHT + VPAD) + BTN_HEIGHT); mUserInputBox = new LLTextEditor(edit_text_name, input_rect, 254, edit_text_contents, sFont, FALSE); mUserInputBox->setBorderVisible(TRUE); mUserInputBox->setTakesNonScrollClicks(TRUE); mUserInputBox->setHideScrollbarForShortDocs(TRUE); mUserInputBox->setWordWrap(TRUE); mUserInputBox->setTabsToNextField(FALSE); mUserInputBox->setCommitOnFocusLost(FALSE); mUserInputBox->setAcceptCallingCardNames(FALSE); mUserInputBox->setHandleEditKeysDirectly(TRUE); addChild(mUserInputBox, -1); } else { setIsChrome(TRUE); } if (mNumButtons == 0) { addButton("OK", "OK", false, true, layout_script_dialog); mAddedDefaultBtn = true; } std::string check_title; if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE) { check_title = LLNotificationTemplates::instance().getGlobalString("skipnexttime"); } else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) { check_title = LLNotificationTemplates::instance().getGlobalString("alwayschoose"); } if (!check_title.empty()) { const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF); S32 line_height = llfloor(font->getLineHeight() + 0.99f); // Extend dialog for "check next time" S32 max_msg_width = getRect().getWidth() - HPAD * 9; S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16; max_msg_width = llmax(max_msg_width, check_width); S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; LLRect check_rect; check_rect.setOriginAndSize(msg_x, BOTTOM_PAD + BTN_HEIGHT + VPAD*2 + (BTN_HEIGHT + VPAD) * (mNumButtons / 3), max_msg_width, line_height); LLCheckboxCtrl* check = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, // Lambda abuse. [this](LLUICtrl* ctrl, const LLSD& param) { this->mNotification->setIgnored(ctrl->getValue()); }); check->setEnabledColor(LLUI::sColorsGroup->getColor(mIsCaution ? "AlertCautionTextColor" : "AlertTextColor")); if (mIsCaution) { check->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor")); } addChild(check); } if (++sNotifyBoxCount <= 0) LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL; // If this is the only notify box, don't show the next button else if (sNotifyBoxCount == 1 && mNextBtn) mNextBtn->setVisible(false); } }
//! constructor CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : IGUIWindow(environment, parent, id, rectangle), Dragging(false) { #ifdef _DEBUG setDebugName("CGUIWindow"); #endif IGUISkin* skin = 0; if (environment) skin = environment->getSkin(); IGUISpriteBank* sprites = 0; video::SColor color(255,255,255,255); s32 buttonw = 15; if (skin) { buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); sprites = skin->getSpriteBank(); color = skin->getColor(EGDC_WINDOW_SYMBOL); } s32 posx = RelativeRect.getWidth() - buttonw - 4; CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" ); CloseButton->setSubElement(true); CloseButton->setTabStop(false); CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); if (sprites) { CloseButton->setSpriteBank(sprites); CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color); CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color); } posx -= buttonw + 2; RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" ); RestoreButton->setVisible(false); RestoreButton->setSubElement(true); RestoreButton->setTabStop(false); RestoreButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); if (sprites) { RestoreButton->setSpriteBank(sprites); RestoreButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESTORE), color); RestoreButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESTORE), color); } posx -= buttonw + 2; MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" ); MinButton->setVisible(false); MinButton->setSubElement(true); MinButton->setTabStop(false); MinButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); if (sprites) { MinButton->setSpriteBank(sprites); MinButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_MINIMIZE), color); MinButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_MINIMIZE), color); } MinButton->grab(); RestoreButton->grab(); CloseButton->grab(); // this element is a tab group setTabGroup(true); setTabStop(true); setTabOrder(-1); }