diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llmenugl.h | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h index cd39006..e7b009a 100644 --- a/linden/indra/llui/llmenugl.h +++ b/linden/indra/llui/llmenugl.h | |||
@@ -91,14 +91,11 @@ public: | |||
91 | LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE ); | 91 | LLMenuItemGL( const LLString& name, const LLString& label, KEY key = KEY_NONE, MASK = MASK_NONE ); |
92 | 92 | ||
93 | virtual void setValue(const LLSD& value) { setLabel(value.asString()); } | 93 | virtual void setValue(const LLSD& value) { setLabel(value.asString()); } |
94 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM; } | ||
95 | virtual LLString getWidgetTag() const { return LL_MENU_ITEM_TAG; } | ||
96 | 94 | ||
97 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | 95 | virtual LLXMLNodePtr getXML(bool save_children = true) const; |
98 | 96 | ||
99 | virtual LLString getType() const { return "item"; } | 97 | virtual LLString getType() const { return "item"; } |
100 | 98 | ||
101 | virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); | ||
102 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); | 99 | virtual BOOL handleHover(S32 x, S32 y, MASK mask); |
103 | 100 | ||
104 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); | 101 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); |
@@ -165,7 +162,7 @@ public: | |||
165 | virtual void setEnabledSubMenus(BOOL enable){}; | 162 | virtual void setEnabledSubMenus(BOOL enable){}; |
166 | 163 | ||
167 | // LLView Functionality | 164 | // LLView Functionality |
168 | virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ); | 165 | virtual BOOL handleKeyHere( KEY key, MASK mask ); |
169 | virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); | 166 | virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); |
170 | virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); | 167 | virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); |
171 | virtual void draw( void ); | 168 | virtual void draw( void ); |
@@ -225,7 +222,7 @@ private: | |||
225 | // calls a user defined callback. | 222 | // calls a user defined callback. |
226 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 223 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
227 | 224 | ||
228 | class LLMenuItemCallGL : public LLMenuItemGL | 225 | class LLMenuItemCallGL : public LLMenuItemGL, public LLObservable |
229 | { | 226 | { |
230 | public: | 227 | public: |
231 | // normal constructor | 228 | // normal constructor |
@@ -267,8 +264,6 @@ public: | |||
267 | 264 | ||
268 | virtual LLString getType() const { return "call"; } | 265 | virtual LLString getType() const { return "call"; } |
269 | 266 | ||
270 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CALL; } | ||
271 | virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CALL_GL_TAG; } | ||
272 | 267 | ||
273 | void setEnabledControl(LLString enabled_control, LLView *context); | 268 | void setEnabledControl(LLString enabled_control, LLView *context); |
274 | void setVisibleControl(LLString enabled_control, LLView *context); | 269 | void setVisibleControl(LLString enabled_control, LLView *context); |
@@ -291,7 +286,6 @@ public: | |||
291 | 286 | ||
292 | //virtual void draw(); | 287 | //virtual void draw(); |
293 | 288 | ||
294 | virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
295 | 289 | ||
296 | private: | 290 | private: |
297 | menu_callback mCallback; | 291 | menu_callback mCallback; |
@@ -341,17 +335,13 @@ public: | |||
341 | 335 | ||
342 | void setCheckedControl(LLString checked_control, LLView *context); | 336 | void setCheckedControl(LLString checked_control, LLView *context); |
343 | 337 | ||
344 | virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); } | 338 | virtual void setValue(const LLSD& value); |
345 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CHECK; } | ||
346 | virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CHECK_GL_TAG; } | ||
347 | 339 | ||
348 | virtual LLString getType() const { return "check"; } | 340 | virtual LLString getType() const { return "check"; } |
349 | 341 | ||
350 | // called to rebuild the draw label | 342 | // called to rebuild the draw label |
351 | virtual void buildDrawLabel( void ); | 343 | virtual void buildDrawLabel( void ); |
352 | 344 | ||
353 | virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
354 | |||
355 | private: | 345 | private: |
356 | check_callback mCheckCallback; | 346 | check_callback mCheckCallback; |
357 | BOOL mChecked; | 347 | BOOL mChecked; |
@@ -408,6 +398,8 @@ class LLMenuGL | |||
408 | // TODO: The menu and menu item classes share a great deal of functionality and perhaps should be united. | 398 | // TODO: The menu and menu item classes share a great deal of functionality and perhaps should be united. |
409 | // I think it may make the most sense to make LLMenuGL be a subclass of LLMenuItemGL. -MG | 399 | // I think it may make the most sense to make LLMenuGL be a subclass of LLMenuItemGL. -MG |
410 | { | 400 | { |
401 | // let branching menu items use my protected traversal methods | ||
402 | friend class LLMenuItemBranchGL; | ||
411 | public: | 403 | public: |
412 | LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>()); | 404 | LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>()); |
413 | LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>() ); | 405 | LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>() ); |
@@ -417,13 +409,9 @@ public: | |||
417 | 409 | ||
418 | void parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory *factory); | 410 | void parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory *factory); |
419 | 411 | ||
420 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU; } | ||
421 | virtual LLString getWidgetTag() const { return LL_MENU_GL_TAG; } | ||
422 | 412 | ||
423 | // LLView Functionality | 413 | // LLView Functionality |
424 | virtual BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); | 414 | virtual BOOL handleUnicodeCharHere( llwchar uni_char ); |
425 | //virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent ); | ||
426 | virtual BOOL handleUnicodeCharHere( llwchar uni_char, BOOL called_from_parent ); | ||
427 | virtual BOOL handleHover( S32 x, S32 y, MASK mask ); | 415 | virtual BOOL handleHover( S32 x, S32 y, MASK mask ); |
428 | virtual void draw( void ); | 416 | virtual void draw( void ); |
429 | virtual void drawBackground(LLMenuItemGL* itemp, LLColor4& color); | 417 | virtual void drawBackground(LLMenuItemGL* itemp, LLColor4& color); |
@@ -579,9 +567,6 @@ public: | |||
579 | 567 | ||
580 | virtual LLString getType() const { return "menu"; } | 568 | virtual LLString getType() const { return "menu"; } |
581 | 569 | ||
582 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BRANCH; } | ||
583 | virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BRANCH_GL_TAG; } | ||
584 | |||
585 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); | 570 | virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); |
586 | 571 | ||
587 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); | 572 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); |
@@ -602,7 +587,7 @@ public: | |||
602 | // active. This is used for behavior transfer. | 587 | // active. This is used for behavior transfer. |
603 | virtual void setHighlight( BOOL highlight ); | 588 | virtual void setHighlight( BOOL highlight ); |
604 | 589 | ||
605 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | 590 | virtual BOOL handleKeyHere(KEY key, MASK mask); |
606 | 591 | ||
607 | virtual BOOL isActive() const { return isOpen() && mBranch->getHighlightedItem(); } | 592 | virtual BOOL isActive() const { return isOpen() && mBranch->getHighlightedItem(); } |
608 | 593 | ||
@@ -621,8 +606,7 @@ public: | |||
621 | 606 | ||
622 | virtual void openMenu(); | 607 | virtual void openMenu(); |
623 | 608 | ||
624 | protected: | 609 | virtual LLView* getChildView(const LLString& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; |
625 | virtual LLView* getChildByName(const LLString& name, BOOL recurse) const; | ||
626 | 610 | ||
627 | private: | 611 | private: |
628 | LLMenuGL* mBranch; | 612 | LLMenuGL* mBranch; |
@@ -643,16 +627,12 @@ public: | |||
643 | LLPieMenu(const LLString& name); | 627 | LLPieMenu(const LLString& name); |
644 | virtual ~LLPieMenu() {} | 628 | virtual ~LLPieMenu() {} |
645 | 629 | ||
646 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_PIE_MENU; } | ||
647 | virtual LLString getWidgetTag() const { return LL_PIE_MENU_TAG; } | ||
648 | |||
649 | void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory); | 630 | void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory); |
650 | 631 | ||
651 | // LLView Functionality | 632 | // LLView Functionality |
652 | // can't set visibility directly, must call show or hide | 633 | // can't set visibility directly, must call show or hide |
653 | virtual void setVisible(BOOL visible); | 634 | virtual void setVisible(BOOL visible); |
654 | 635 | ||
655 | //virtual BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); | ||
656 | virtual BOOL handleHover( S32 x, S32 y, MASK mask ); | 636 | virtual BOOL handleHover( S32 x, S32 y, MASK mask ); |
657 | virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); | 637 | virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); |
658 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); | 638 | virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); |
@@ -672,7 +652,6 @@ public: | |||
672 | void show(S32 x, S32 y, BOOL mouse_down); | 652 | void show(S32 x, S32 y, BOOL mouse_down); |
673 | void hide(BOOL item_selected); | 653 | void hide(BOOL item_selected); |
674 | 654 | ||
675 | |||
676 | private: | 655 | private: |
677 | LLMenuItemGL *pieItemFromXY(S32 x, S32 y); | 656 | LLMenuItemGL *pieItemFromXY(S32 x, S32 y); |
678 | S32 pieItemIndexFromXY(S32 x, S32 y); | 657 | S32 pieItemIndexFromXY(S32 x, S32 y); |
@@ -708,11 +687,8 @@ public: | |||
708 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | 687 | virtual LLXMLNodePtr getXML(bool save_children = true) const; |
709 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | 688 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); |
710 | 689 | ||
711 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_BAR; } | ||
712 | virtual LLString getWidgetTag() const { return LL_MENU_BAR_GL_TAG; } | ||
713 | |||
714 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); | 690 | virtual BOOL handleAcceleratorKey(KEY key, MASK mask); |
715 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | 691 | virtual BOOL handleKeyHere(KEY key, MASK mask); |
716 | virtual BOOL handleJumpKey(KEY key); | 692 | virtual BOOL handleJumpKey(KEY key); |
717 | 693 | ||
718 | // rearrange the child rects so they fit the shape of the menu | 694 | // rearrange the child rects so they fit the shape of the menu |
@@ -754,9 +730,6 @@ public: | |||
754 | LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); | 730 | LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); |
755 | virtual ~LLMenuHolderGL() {} | 731 | virtual ~LLMenuHolderGL() {} |
756 | 732 | ||
757 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_HOLDER; } | ||
758 | virtual LLString getWidgetTag() const { return LL_MENU_HOLDER_GL_TAG; } | ||
759 | |||
760 | virtual BOOL hideMenus(); | 733 | virtual BOOL hideMenus(); |
761 | void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | 734 | void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); |
762 | void setCanHide(BOOL can_hide) { mCanHide = can_hide; } | 735 | void setCanHide(BOOL can_hide) { mCanHide = can_hide; } |
@@ -794,7 +767,7 @@ public: | |||
794 | virtual void onFocusReceived(); | 767 | virtual void onFocusReceived(); |
795 | virtual void onFocusLost(); | 768 | virtual void onFocusLost(); |
796 | virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); | 769 | virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); |
797 | virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); | 770 | virtual BOOL handleKeyHere(KEY key, MASK mask); |
798 | virtual void translate(S32 x, S32 y); | 771 | virtual void translate(S32 x, S32 y); |
799 | 772 | ||
800 | private: | 773 | private: |
@@ -816,9 +789,6 @@ class LLMenuItemTearOffGL : public LLMenuItemGL | |||
816 | public: | 789 | public: |
817 | LLMenuItemTearOffGL( LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>()); | 790 | LLMenuItemTearOffGL( LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>()); |
818 | 791 | ||
819 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEAROFF_MENU; } | ||
820 | virtual LLString getWidgetTag() const { return LL_MENU_ITEM_TEAR_OFF_GL_TAG; } | ||
821 | |||
822 | virtual LLString getType() const { return "tearoff_menu"; } | 792 | virtual LLString getType() const { return "tearoff_menu"; } |
823 | 793 | ||
824 | virtual void doIt(void); | 794 | virtual void doIt(void); |