aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llmenugl.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llmenugl.h
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llui/llmenugl.h')
-rw-r--r--linden/indra/llui/llmenugl.h268
1 files changed, 132 insertions, 136 deletions
diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h
index 9274101..4e5ac69 100644
--- a/linden/indra/llui/llmenugl.h
+++ b/linden/indra/llui/llmenugl.h
@@ -44,8 +44,6 @@
44#include "lluistring.h" 44#include "lluistring.h"
45#include "llview.h" 45#include "llview.h"
46 46
47class LLMenuItemGL;
48class LLMenuHolderGL;
49 47
50extern S32 MENU_BAR_HEIGHT; 48extern S32 MENU_BAR_HEIGHT;
51extern S32 MENU_BAR_WIDTH; 49extern S32 MENU_BAR_WIDTH;
@@ -77,13 +75,19 @@ typedef void (*label_callback)(LLString&,void*);
77// The LLMenuItemGL represents a single menu item in a menu. 75// The LLMenuItemGL represents a single menu item in a menu.
78//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79 77
80class LLFontGL;
81class LLMenuGL;
82
83
84class LLMenuItemGL : public LLView 78class LLMenuItemGL : public LLView
85{ 79{
86public: 80public:
81 // static functions to control the global color scheme.
82 static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; }
83 static const LLColor4& getEnabledColor() { return sEnabledColor; }
84 static void setDisabledColor( const LLColor4& color ) { sDisabledColor = color; }
85 static const LLColor4& getDisabledColor() { return sDisabledColor; }
86 static void setHighlightBGColor( const LLColor4& color ) { sHighlightBackground = color; }
87 static const LLColor4& getHighlightBGColor() { return sHighlightBackground; }
88 static void setHighlightFGColor( const LLColor4& color ) { sHighlightForeground = color; }
89 static const LLColor4& getHighlightFGColor() { return sHighlightForeground; }
90
87 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 );
88 92
89 virtual void setValue(const LLSD& value) { setLabel(value.asString()); } 93 virtual void setValue(const LLSD& value) { setLabel(value.asString()); }
@@ -99,44 +103,38 @@ public:
99 103
100 virtual BOOL handleAcceleratorKey(KEY key, MASK mask); 104 virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
101 105
102 BOOL getHighlight() const { return mHighlight; }
103
104 void setJumpKey(KEY key); 106 void setJumpKey(KEY key);
105 KEY getJumpKey(); 107 KEY getJumpKey() const { return mJumpKey; }
106 108
107 // set the font used by this item. 109 // set the font used by this item.
108 void setFont(LLFontGL* font); 110 void setFont(const LLFontGL* font) { mFont = font; }
111 const LLFontGL* getFont() const { return mFont; }
109 void setFontStyle(U8 style) { mStyle = style; } 112 void setFontStyle(U8 style) { mStyle = style; }
113 U8 getFontStyle() const { return mStyle; }
110 114
111 // returns the height in pixels for the current font. 115 // returns the height in pixels for the current font.
112 virtual U32 getNominalHeight( void ); 116 virtual U32 getNominalHeight( void ) const;
113
114 // functions to control the color scheme
115 static void setEnabledColor( const LLColor4& color );
116 static void setDisabledColor( const LLColor4& color );
117 static void setHighlightBGColor( const LLColor4& color );
118 static void setHighlightFGColor( const LLColor4& color );
119 117
120 // Marks item as not needing space for check marks or accelerator keys 118 // Marks item as not needing space for check marks or accelerator keys
121 virtual void setBriefItem(BOOL brief); 119 virtual void setBriefItem(BOOL brief) { mBriefItem = brief; }
120 virtual BOOL isBriefItem() const { return mBriefItem; }
122 121
123 virtual BOOL addToAcceleratorList(std::list<LLKeyBinding*> *listp); 122 virtual BOOL addToAcceleratorList(std::list<LLKeyBinding*> *listp);
124 void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; } 123 void setAllowKeyRepeat(BOOL allow) { mAllowKeyRepeat = allow; }
125 124 BOOL getAllowKeyRepeat() const { return mAllowKeyRepeat; }
126 // return the name label
127 LLString getLabel( void ) const { return mLabel.getString(); }
128 125
129 // change the label 126 // change the label
130 void setLabel( const LLStringExplicit& label ); 127 void setLabel( const LLStringExplicit& label ) { mLabel = label; }
128 LLString getLabel( void ) const { return mLabel.getString(); }
131 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text ); 129 virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
132 130
133 // Get the parent menu for this item 131 // Get the parent menu for this item
134 virtual LLMenuGL* getMenu(); 132 virtual class LLMenuGL* getMenu();
135 133
136 // returns the normal width of this control in pixels - this is 134 // returns the normal width of this control in pixels - this is
137 // used for calculating the widest item, as well as for horizontal 135 // used for calculating the widest item, as well as for horizontal
138 // arrangement. 136 // arrangement.
139 virtual U32 getNominalWidth( void ); 137 virtual U32 getNominalWidth( void ) const;
140 138
141 // buildDrawLabel() - constructs the string used during the draw() 139 // buildDrawLabel() - constructs the string used during the draw()
142 // function. This reduces the overall string manipulation, but can 140 // function. This reduces the overall string manipulation, but can
@@ -155,14 +153,14 @@ public:
155 // doIt() - do the primary funcationality of the menu item. 153 // doIt() - do the primary funcationality of the menu item.
156 virtual void doIt( void ); 154 virtual void doIt( void );
157 155
158 // set the hover status (called by it's menu)
159 virtual void setHighlight( BOOL highlight ); 156 virtual void setHighlight( BOOL highlight );
157 virtual BOOL getHighlight() const { return mHighlight; }
160 158
161 // determine if this represents an active sub-menu 159 // determine if this represents an active sub-menu
162 virtual BOOL isActive( void ) const; 160 virtual BOOL isActive( void ) const { return FALSE; }
163 161
164 // determine if this represents an open sub-menu 162 // determine if this represents an open sub-menu
165 virtual BOOL isOpen( void ) const; 163 virtual BOOL isOpen( void ) const { return FALSE; }
166 164
167 virtual void setEnabledSubMenus(BOOL enable){}; 165 virtual void setEnabledSubMenus(BOOL enable){};
168 166
@@ -172,24 +170,20 @@ public:
172 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); 170 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
173 virtual void draw( void ); 171 virtual void draw( void );
174 172
175 BOOL getHover() { return mGotHover; } 173 BOOL getHover() const { return mGotHover; }
176 174
175 void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; }
177 BOOL getDrawTextDisabled() const { return mDrawTextDisabled; } 176 BOOL getDrawTextDisabled() const { return mDrawTextDisabled; }
178 177
179protected: 178protected:
179 void setHover(BOOL hover) { mGotHover = hover; }
180
180 // This function appends the character string representation of 181 // This function appends the character string representation of
181 // the current accelerator key and mask to the provided string. 182 // the current accelerator key and mask to the provided string.
182 void appendAcceleratorString( LLString& st ); 183 void appendAcceleratorString( LLString& st ) const;
183
184public:
185 static LLColor4 sEnabledColor;
186 static LLColor4 sDisabledColor;
187 static LLColor4 sHighlightBackground;
188 static LLColor4 sHighlightForeground;
189
190protected:
191 static BOOL sDropShadowText;
192 184
185 KEY mAcceleratorKey;
186 MASK mAcceleratorMask;
193 // mLabel contains the actual label specified by the user. 187 // mLabel contains the actual label specified by the user.
194 LLUIString mLabel; 188 LLUIString mLabel;
195 189
@@ -200,12 +194,15 @@ protected:
200 LLUIString mDrawAccelLabel; 194 LLUIString mDrawAccelLabel;
201 LLUIString mDrawBranchLabel; 195 LLUIString mDrawBranchLabel;
202 196
197 BOOL mHighlight;
198private:
199 static LLColor4 sEnabledColor;
200 static LLColor4 sDisabledColor;
201 static LLColor4 sHighlightBackground;
202 static LLColor4 sHighlightForeground;
203
203 // Keyboard and mouse variables 204 // Keyboard and mouse variables
204 KEY mJumpKey;
205 KEY mAcceleratorKey;
206 MASK mAcceleratorMask;
207 BOOL mAllowKeyRepeat; 205 BOOL mAllowKeyRepeat;
208 BOOL mHighlight;
209 BOOL mGotHover; 206 BOOL mGotHover;
210 207
211 // If true, suppress normal space for check marks on the left and accelerator 208 // If true, suppress normal space for check marks on the left and accelerator
@@ -213,10 +210,11 @@ protected:
213 BOOL mBriefItem; 210 BOOL mBriefItem;
214 211
215 // Font for this item 212 // Font for this item
216 LLFontGL* mFont; 213 const LLFontGL* mFont;
217
218 U8 mStyle; 214 U8 mStyle;
219 BOOL mDrawTextDisabled; 215 BOOL mDrawTextDisabled;
216
217 KEY mJumpKey;
220}; 218};
221 219
222 220
@@ -229,14 +227,6 @@ protected:
229 227
230class LLMenuItemCallGL : public LLMenuItemGL 228class LLMenuItemCallGL : public LLMenuItemGL
231{ 229{
232protected:
233 menu_callback mCallback;
234 // mEnabledCallback should return TRUE if the item should be enabled
235 enabled_callback mEnabledCallback;
236 label_callback mLabelCallback;
237 void* mUserData;
238 on_disabled_callback mOnDisabledCallback;
239
240public: 230public:
241 // normal constructor 231 // normal constructor
242 LLMenuItemCallGL( const LLString& name, 232 LLMenuItemCallGL( const LLString& name,
@@ -277,8 +267,8 @@ public:
277 267
278 virtual LLString getType() const { return "call"; } 268 virtual LLString getType() const { return "call"; }
279 269
280 virtual EWidgetType getWidgetType() const; 270 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CALL; }
281 virtual LLString getWidgetTag() const; 271 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CALL_GL_TAG; }
282 272
283 void setEnabledControl(LLString enabled_control, LLView *context); 273 void setEnabledControl(LLString enabled_control, LLView *context);
284 void setVisibleControl(LLString enabled_control, LLView *context); 274 void setVisibleControl(LLString enabled_control, LLView *context);
@@ -302,6 +292,14 @@ public:
302 //virtual void draw(); 292 //virtual void draw();
303 293
304 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); 294 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
295
296private:
297 menu_callback mCallback;
298 // mEnabledCallback should return TRUE if the item should be enabled
299 enabled_callback mEnabledCallback;
300 label_callback mLabelCallback;
301 void* mUserData;
302 on_disabled_callback mOnDisabledCallback;
305}; 303};
306 304
307//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 305//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -310,17 +308,13 @@ public:
310// The LLMenuItemCheckGL is an extension of the LLMenuItemCallGL 308// The LLMenuItemCheckGL is an extension of the LLMenuItemCallGL
311// class, by allowing another method to be specified which determines 309// class, by allowing another method to be specified which determines
312// if the menu item should consider itself checked as true or not. Be 310// if the menu item should consider itself checked as true or not. Be
313// careful that the check callback provided - it needs to be VERY 311// careful that the provided callback is fast - it needs to be VERY
314// FUCKING EFFICIENT, because it may need to be checked a lot. 312// FUCKING EFFICIENT, because it may need to be checked a lot.
315//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 313//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 314
317class LLMenuItemCheckGL 315class LLMenuItemCheckGL
318: public LLMenuItemCallGL 316: public LLMenuItemCallGL
319{ 317{
320protected:
321 check_callback mCheckCallback;
322 BOOL mChecked;
323
324public: 318public:
325 LLMenuItemCheckGL( const LLString& name, 319 LLMenuItemCheckGL( const LLString& name,
326 const LLString& label, 320 const LLString& label,
@@ -348,8 +342,8 @@ public:
348 void setCheckedControl(LLString checked_control, LLView *context); 342 void setCheckedControl(LLString checked_control, LLView *context);
349 343
350 virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); } 344 virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); }
351 virtual EWidgetType getWidgetType() const; 345 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CHECK; }
352 virtual LLString getWidgetTag() const; 346 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CHECK_GL_TAG; }
353 347
354 virtual LLString getType() const { return "check"; } 348 virtual LLString getType() const { return "check"; }
355 349
@@ -358,8 +352,9 @@ public:
358 352
359 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); 353 virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
360 354
361 // LLView Functionality 355private:
362 //virtual void draw( void ); 356 check_callback mCheckCallback;
357 BOOL mChecked;
363}; 358};
364 359
365 360
@@ -372,9 +367,6 @@ public:
372 367
373class LLMenuItemToggleGL : public LLMenuItemGL 368class LLMenuItemToggleGL : public LLMenuItemGL
374{ 369{
375protected:
376 BOOL* mToggle;
377
378public: 370public:
379 LLMenuItemToggleGL( const LLString& name, const LLString& label, 371 LLMenuItemToggleGL( const LLString& name, const LLString& label,
380 BOOL* toggle, 372 BOOL* toggle,
@@ -394,6 +386,9 @@ public:
394 386
395 // LLView Functionality 387 // LLView Functionality
396 //virtual void draw( void ); 388 //virtual void draw( void );
389
390private:
391 BOOL* mToggle;
397}; 392};
398 393
399 394
@@ -408,16 +403,14 @@ public:
408// it in the appendMenu() method. 403// it in the appendMenu() method.
409//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410 405
411class LLMenuArrowGL;
412class LLMenuItemBranchGL;
413class LLMenuItemTearOffGL;
414
415class LLMenuGL 406class LLMenuGL
416: public LLUICtrl 407: public LLUICtrl
408// 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
417{ 410{
418public: 411public:
419 LLMenuGL( const LLString& name, const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle ); 412 LLMenuGL( const LLString& name, const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>());
420 LLMenuGL( const LLString& label, LLViewHandle parent_floater = LLViewHandle::sDeadHandle ); 413 LLMenuGL( const LLString& label, LLHandle<LLFloater> parent_floater = LLHandle<LLFloater>() );
421 virtual ~LLMenuGL( void ); 414 virtual ~LLMenuGL( void );
422 virtual LLXMLNodePtr getXML(bool save_children = true) const; 415 virtual LLXMLNodePtr getXML(bool save_children = true) const;
423 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 416 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
@@ -446,11 +439,12 @@ public:
446 const LLString& getLabel( void ) const { return mLabel.getString(); } 439 const LLString& getLabel( void ) const { return mLabel.getString(); }
447 void setLabel(const LLStringExplicit& label) { mLabel = label; } 440 void setLabel(const LLStringExplicit& label) { mLabel = label; }
448 441
449 static void setDefaultBackgroundColor( const LLColor4& color ); 442 // background colors
450 void setBackgroundColor( const LLColor4& color ); 443 static void setDefaultBackgroundColor( const LLColor4& color ) { sDefaultBackgroundColor = color; }
451 LLColor4 getBackgroundColor(); 444 void setBackgroundColor( const LLColor4& color ) { mBackgroundColor = color; }
445 const LLColor4& getBackgroundColor() const { return mBackgroundColor; }
452 void setBackgroundVisible( BOOL b ) { mBgVisible = b; } 446 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
453 void setCanTearOff(BOOL tear_off, LLViewHandle parent_floater_handle = LLViewHandle::sDeadHandle); 447 void setCanTearOff(BOOL tear_off, LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
454 448
455 // Add the menu item to this menu. 449 // Add the menu item to this menu.
456 virtual BOOL append( LLMenuItemGL* item ); 450 virtual BOOL append( LLMenuItemGL* item );
@@ -524,7 +518,7 @@ public:
524 518
525 BOOL getCanTearOff() { return mTearOffItem != NULL; } 519 BOOL getCanTearOff() { return mTearOffItem != NULL; }
526 520
527 KEY getJumpKey() { return mJumpKey; } 521 KEY getJumpKey() const { return mJumpKey; }
528 void setJumpKey(KEY key) { mJumpKey = key; } 522 void setJumpKey(KEY key) { mJumpKey = key; }
529 523
530 static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } 524 static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; }
@@ -532,40 +526,42 @@ public:
532 526
533 static void onFocusLost(LLView* old_focus); 527 static void onFocusLost(LLView* old_focus);
534 528
535 static LLMenuHolderGL* sMenuContainer; 529 static class LLMenuHolderGL* sMenuContainer;
536 530
537protected: 531protected:
538 void createSpilloverBranch(); 532 void createSpilloverBranch();
539 void cleanupSpilloverBranch(); 533 void cleanupSpilloverBranch();
540 534
541protected: 535 // TODO: create accessor methods for these?
536 typedef std::list< LLMenuItemGL* > item_list_t;
537 item_list_t mItems;
538 typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
539 navigation_key_map_t mJumpKeys;
540 S32 mLastMouseX;
541 S32 mLastMouseY;
542 S32 mMouseVelX;
543 S32 mMouseVelY;
544 BOOL mHorizontalLayout;
545 BOOL mKeepFixedSize;
546
547private:
542 static LLColor4 sDefaultBackgroundColor; 548 static LLColor4 sDefaultBackgroundColor;
543 static BOOL sKeyboardMode; 549 static BOOL sKeyboardMode;
544 550
545 LLColor4 mBackgroundColor; 551 LLColor4 mBackgroundColor;
546 BOOL mBgVisible; 552 BOOL mBgVisible;
547 typedef std::list< LLMenuItemGL* > item_list_t;
548 item_list_t mItems;
549 typedef std::map<KEY, LLMenuItemGL*> navigation_key_map_t;
550 navigation_key_map_t mJumpKeys;
551 LLMenuItemGL* mParentMenuItem; 553 LLMenuItemGL* mParentMenuItem;
552 LLUIString mLabel; 554 LLUIString mLabel;
553 BOOL mDropShadowed; // Whether to drop shadow 555 BOOL mDropShadowed; // Whether to drop shadow
554 BOOL mHorizontalLayout;
555 BOOL mKeepFixedSize;
556 BOOL mHasSelection; 556 BOOL mHasSelection;
557 LLFrameTimer mFadeTimer; 557 LLFrameTimer mFadeTimer;
558 S32 mLastMouseX;
559 S32 mLastMouseY;
560 S32 mMouseVelX;
561 S32 mMouseVelY;
562 BOOL mTornOff; 558 BOOL mTornOff;
563 LLMenuItemTearOffGL* mTearOffItem; 559 class LLMenuItemTearOffGL* mTearOffItem;
564 LLMenuItemBranchGL* mSpilloverBranch; 560 class LLMenuItemBranchGL* mSpilloverBranch;
565 LLMenuGL* mSpilloverMenu; 561 LLMenuGL* mSpilloverMenu;
566 LLViewHandle mParentFloaterHandle; 562 LLHandle<LLFloater> mParentFloaterHandle;
567 KEY mJumpKey; 563 KEY mJumpKey;
568}; 564}; // end class LLMenuGL
569 565
570 566
571 567
@@ -578,20 +574,15 @@ protected:
578 574
579class LLMenuItemBranchGL : public LLMenuItemGL 575class LLMenuItemBranchGL : public LLMenuItemGL
580{ 576{
581protected:
582 LLMenuGL* mBranch;
583
584public: 577public:
585 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch, 578 LLMenuItemBranchGL( const LLString& name, const LLString& label, LLMenuGL* branch,
586 KEY key = KEY_NONE, MASK mask = MASK_NONE ); 579 KEY key = KEY_NONE, MASK mask = MASK_NONE );
587 virtual LLXMLNodePtr getXML(bool save_children = true) const; 580 virtual LLXMLNodePtr getXML(bool save_children = true) const;
588 581
589 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const; 582 virtual LLString getType() const { return "menu"; }
590
591 virtual LLString getType() const { return "menu"; }
592 583
593 virtual EWidgetType getWidgetType() const; 584 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_BRANCH; }
594 virtual LLString getWidgetTag() const; 585 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_BRANCH_GL_TAG; }
595 586
596 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 587 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
597 588
@@ -615,9 +606,9 @@ public:
615 606
616 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); 607 virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
617 608
618 virtual BOOL isActive() const; 609 virtual BOOL isActive() const { return isOpen() && mBranch->getHighlightedItem(); }
619 610
620 virtual BOOL isOpen() const; 611 virtual BOOL isOpen() const { return mBranch->isOpen(); }
621 612
622 LLMenuGL *getBranch() const { return mBranch; } 613 LLMenuGL *getBranch() const { return mBranch; }
623 614
@@ -628,11 +619,16 @@ public:
628 619
629 virtual void draw(); 620 virtual void draw();
630 621
631 virtual void setEnabledSubMenus(BOOL enabled); 622 virtual void setEnabledSubMenus(BOOL enabled) { mBranch->setEnabledSubMenus(enabled); }
632 623
633 virtual void openMenu(); 624 virtual void openMenu();
634};
635 625
626protected:
627 virtual LLView* getChildByName(const LLString& name, BOOL recurse) const;
628
629private:
630 LLMenuGL* mBranch;
631}; // end class LLMenuItemBranchGL
636 632
637 633
638 634
@@ -647,10 +643,10 @@ class LLPieMenu
647public: 643public:
648 LLPieMenu(const LLString& name, const LLString& label); 644 LLPieMenu(const LLString& name, const LLString& label);
649 LLPieMenu(const LLString& name); 645 LLPieMenu(const LLString& name);
650 virtual ~LLPieMenu(); 646 virtual ~LLPieMenu() {}
651 647
652 virtual EWidgetType getWidgetType() const; 648 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_PIE_MENU; }
653 virtual LLString getWidgetTag() const; 649 virtual LLString getWidgetTag() const { return LL_PIE_MENU_TAG; }
654 650
655 void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory); 651 void initXML(LLXMLNodePtr node, LLView *context, LLUICtrlFactory *factory);
656 652
@@ -682,11 +678,10 @@ public:
682 void show(S32 x, S32 y, BOOL mouse_down); 678 void show(S32 x, S32 y, BOOL mouse_down);
683 void hide(BOOL item_selected); 679 void hide(BOOL item_selected);
684 680
685protected: 681private:
686 LLMenuItemGL *pieItemFromXY(S32 x, S32 y); 682 LLMenuItemGL *pieItemFromXY(S32 x, S32 y);
687 S32 pieItemIndexFromXY(S32 x, S32 y); 683 S32 pieItemIndexFromXY(S32 x, S32 y);
688 684
689private:
690 // These cause menu items to be spuriously selected by right-clicks 685 // These cause menu items to be spuriously selected by right-clicks
691 // near the window edge at low frame rates. I don't think they are 686 // near the window edge at low frame rates. I don't think they are
692 // needed unless you shift the menu position in the draw() function. JC 687 // needed unless you shift the menu position in the draw() function. JC
@@ -703,6 +698,7 @@ private:
703 BOOL mRightMouseDown; 698 BOOL mRightMouseDown;
704}; 699};
705 700
701
706//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
707// Class LLMenuBarGL 703// Class LLMenuBarGL
708// 704//
@@ -711,10 +707,6 @@ private:
711 707
712class LLMenuBarGL : public LLMenuGL 708class LLMenuBarGL : public LLMenuGL
713{ 709{
714protected:
715 std::list <LLKeyBinding*> mAccelerators;
716 BOOL mAltKeyTrigger;
717
718public: 710public:
719 LLMenuBarGL( const LLString& name ); 711 LLMenuBarGL( const LLString& name );
720 virtual ~LLMenuBarGL(); 712 virtual ~LLMenuBarGL();
@@ -748,9 +740,11 @@ public:
748 740
749 void resetMenuTrigger() { mAltKeyTrigger = FALSE; } 741 void resetMenuTrigger() { mAltKeyTrigger = FALSE; }
750 742
751protected: 743private:
752 void checkMenuTrigger(); 744 void checkMenuTrigger();
753 745
746 std::list <LLKeyBinding*> mAccelerators;
747 BOOL mAltKeyTrigger;
754}; 748};
755 749
756//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 750//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -763,10 +757,10 @@ class LLMenuHolderGL : public LLPanel
763public: 757public:
764 LLMenuHolderGL(); 758 LLMenuHolderGL();
765 LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE); 759 LLMenuHolderGL(const LLString& name, const LLRect& rect, BOOL mouse_opaque, U32 follows = FOLLOWS_NONE);
766 virtual ~LLMenuHolderGL(); 760 virtual ~LLMenuHolderGL() {}
767 761
768 virtual EWidgetType getWidgetType() const; 762 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_HOLDER; }
769 virtual LLString getWidgetTag() const; 763 virtual LLString getWidgetTag() const { return LL_MENU_HOLDER_GL_TAG; }
770 764
771 virtual BOOL hideMenus(); 765 virtual BOOL hideMenus();
772 void reshape(S32 width, S32 height, BOOL called_from_parent); 766 void reshape(S32 width, S32 height, BOOL called_from_parent);
@@ -777,13 +771,13 @@ public:
777 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); 771 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
778 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); 772 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
779 773
780 virtual const LLRect getMenuRect() const; 774 virtual const LLRect getMenuRect() const { return getLocalRect(); }
781 virtual BOOL hasVisibleMenu() const; 775 virtual BOOL hasVisibleMenu() const;
782 776
783 static void setActivatedItem(LLMenuItemGL* item); 777 static void setActivatedItem(LLMenuItemGL* item);
784 778
785protected: 779private:
786 static LLViewHandle sItemLastSelectedHandle; 780 static LLHandle<LLView> sItemLastSelectedHandle;
787 static LLFrameTimer sItemActivationTimer; 781 static LLFrameTimer sItemActivationTimer;
788 782
789 BOOL mCanHide; 783 BOOL mCanHide;
@@ -793,12 +787,13 @@ protected:
793// Class LLTearOffMenu 787// Class LLTearOffMenu
794// 788//
795// Floater that hosts a menu 789// Floater that hosts a menu
790// https://wiki.lindenlab.com/mediawiki/index.php?title=LLTearOffMenu&oldid=81344
796//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
797class LLTearOffMenu : public LLFloater 792class LLTearOffMenu : public LLFloater
798{ 793{
799public: 794public:
800 static LLTearOffMenu* create(LLMenuGL* menup); 795 static LLTearOffMenu* create(LLMenuGL* menup);
801 virtual ~LLTearOffMenu(); 796 virtual ~LLTearOffMenu() {}
802 virtual void onClose(bool app_quitting); 797 virtual void onClose(bool app_quitting);
803 virtual void draw(void); 798 virtual void draw(void);
804 virtual void onFocusReceived(); 799 virtual void onFocusReceived();
@@ -807,10 +802,9 @@ public:
807 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); 802 virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
808 virtual void translate(S32 x, S32 y); 803 virtual void translate(S32 x, S32 y);
809 804
810protected: 805private:
811 LLTearOffMenu(LLMenuGL* menup); 806 LLTearOffMenu(LLMenuGL* menup);
812 807
813protected:
814 LLView* mOldParent; 808 LLView* mOldParent;
815 LLMenuGL* mMenu; 809 LLMenuGL* mMenu;
816 F32 mTargetHeight; 810 F32 mTargetHeight;
@@ -825,19 +819,19 @@ protected:
825class LLMenuItemTearOffGL : public LLMenuItemGL 819class LLMenuItemTearOffGL : public LLMenuItemGL
826{ 820{
827public: 821public:
828 LLMenuItemTearOffGL( LLViewHandle parent_floater_handle = (LLViewHandle)LLViewHandle::sDeadHandle ); 822 LLMenuItemTearOffGL( LLHandle<LLFloater> parent_floater_handle = LLHandle<LLFloater>());
829 823
830 virtual EWidgetType getWidgetType() const; 824 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEAROFF_MENU; }
831 virtual LLString getWidgetTag() const; 825 virtual LLString getWidgetTag() const { return LL_MENU_ITEM_TEAR_OFF_GL_TAG; }
832 826
833 virtual LLString getType() const { return "tearoff_menu"; } 827 virtual LLString getType() const { return "tearoff_menu"; }
834 828
835 virtual void doIt(void); 829 virtual void doIt(void);
836 virtual void draw(void); 830 virtual void draw(void);
837 virtual U32 getNominalHeight(); 831 virtual U32 getNominalHeight() const;
838 832
839protected: 833private:
840 LLViewHandle mParentHandle; 834 LLHandle<LLFloater> mParentHandle;
841}; 835};
842 836
843 837
@@ -845,11 +839,13 @@ protected:
845class LLEditMenuHandlerMgr 839class LLEditMenuHandlerMgr
846{ 840{
847public: 841public:
848 LLEditMenuHandlerMgr& getInstance(); 842 LLEditMenuHandlerMgr& getInstance() {
849 virtual ~LLEditMenuHandlerMgr(); 843 static LLEditMenuHandlerMgr instance;
850protected: 844 return instance;
851 LLEditMenuHandlerMgr(); 845 }
852 846 virtual ~LLEditMenuHandlerMgr() {}
847private:
848 LLEditMenuHandlerMgr() {};
853}; 849};
854 850
855#endif // LL_LLMENUGL_H 851#endif // LL_LLMENUGL_H