From 84ba6c134cd7f75e8f3be86b444c9e7f57660c18 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 11 Apr 2011 20:11:26 -0700 Subject: Applied customizableTranslationMenu.patch by Grandma Bates for #533: Right Click menus are transparent on the login screen and #534: Right click menus aren't translatable --- linden/indra/llui/llmenugl.h | 114 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) (limited to 'linden/indra/llui/llmenugl.h') diff --git a/linden/indra/llui/llmenugl.h b/linden/indra/llui/llmenugl.h index 63f9d55..9a9d1b0 100644 --- a/linden/indra/llui/llmenugl.h +++ b/linden/indra/llui/llmenugl.h @@ -70,6 +70,57 @@ typedef BOOL (*check_callback)(void*); // contents. Put the contents of the label in the provided parameter. typedef void (*label_callback)(std::string&,void*); + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLCallbackInformation +// +// The LLCallbackInformation class is used to keep track of callback +// information for menus that might be requested at a future time. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLCallbackInformation +{ + +public : + + // Constants used for keeping track of what type of callback is required. + static const U8 LL_MENU_ITEM_CALL_GL_NONE = 0; + static const U8 LL_MENU_ITEM_CALL_GL_ON_CLICK = 1; + static const U8 LL_MENU_ITEM_CALL_GL_ON_ENABLE = 2; + static const U8 LL_MENU_ITEM_CALL_GL_TRANSLATE = 3; + + + LLCallbackInformation(U8 theType=LLCallbackInformation::LL_MENU_ITEM_CALL_GL_NONE, + const std::string& theName = LLStringUtil::null, + const std::string& userData = LLStringUtil::null); + ~LLCallbackInformation() {}; + + void setTypeOfCallback(U8 theType) {typeOfCallback = theType; } + void setCallbackName(const std::string& name) {callbackName = name; } + void setCallbackUserData(const std::string& userdata) {callbackUserData = userdata; } + + U8 getTypeOfCallback() {return(typeOfCallback); } + const std::string& getCallbackName() {return(callbackName); } + const std::string& getCallbackUserData() {return(callbackUserData); } + + BOOL isTypeMatch(U8 type) { return(type == typeOfCallback);} + BOOL isNameMatch(const std::string& name) { return(name == callbackName);} + +protected: + +private: + + U8 typeOfCallback; + std::string callbackName; + std::string callbackUserData; + +}; + + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLMenuItemGL // @@ -79,6 +130,7 @@ typedef void (*label_callback)(std::string&,void*); class LLMenuItemGL : public LLView { public: + // static functions to control the global color scheme. static void setEnabledColor( const LLColor4& color ) { sEnabledColor = color; } static const LLColor4& getEnabledColor() { return sEnabledColor; } @@ -90,7 +142,7 @@ public: static const LLColor4& getHighlightFGColor() { return sHighlightForeground; } LLMenuItemGL( const std::string& name, const std::string& label, KEY key = KEY_NONE, MASK = MASK_NONE ); - virtual ~LLMenuItemGL() {}; + virtual ~LLMenuItemGL(); virtual void setValue(const LLSD& value) { setLabel(value.asString()); } @@ -174,6 +226,14 @@ public: void setDrawTextDisabled(BOOL disabled) { mDrawTextDisabled = disabled; } BOOL getDrawTextDisabled() const { return mDrawTextDisabled; } + // functionality for adding callbacks after the menu is constucted + void addCallbackType(U8 theType,const std::string& name,const std::string& userdata); + + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn) = 0; + protected: void setHover(BOOL hover) { mGotHover = hover; } @@ -194,6 +254,11 @@ protected: LLUIString mDrawBranchLabel; BOOL mHighlight; + + // variables used for tracking callback types that will be + // requested after the widget is in place. + std::vector mFutureCallbackRequests; + private: static LLColor4 sEnabledColor; static LLColor4 sDisabledColor; @@ -214,6 +279,7 @@ private: BOOL mDrawTextDisabled; KEY mJumpKey; + }; @@ -262,6 +328,7 @@ public: KEY key = KEY_NONE, MASK mask = MASK_NONE, BOOL enabled = TRUE, on_disabled_callback on_disabled_c = NULL); + virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual std::string getType() const { return "call"; } @@ -288,6 +355,13 @@ public: //virtual void draw(); + // Functionality for tracking callback types for setting after widget is in place. + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn); + + private: menu_callback mCallback; @@ -382,6 +456,12 @@ public: // LLView Functionality //virtual void draw( void ); + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn) { return FALSE; } ; + + private: BOOL* mToggle; }; @@ -434,8 +514,10 @@ public: // background colors static void setDefaultBackgroundColor( const LLColor4& color ) { sDefaultBackgroundColor = color; } - void setBackgroundColor( const LLColor4& color ) { mBackgroundColor = color; } + void setBackgroundColor( const LLColor4& color ); + void setBorderColor( const LLColor4& color ); const LLColor4& getBackgroundColor() const { return mBackgroundColor; } + const LLColor4& getBorderColor() const { return mBorderColor; } void setBackgroundVisible( BOOL b ) { mBgVisible = b; } void setCanTearOff(BOOL tear_off, LLHandle parent_floater_handle = LLHandle()); @@ -525,6 +607,8 @@ public: static BOOL getKeyboardMode() { return sKeyboardMode; } static class LLMenuHolderGL* sMenuContainer; + + BOOL setCtrlResponse(U8 llMenuItemCallType,const std::string& name,void* user_data,void *callback_fcn); protected: void createSpilloverBranch(); @@ -547,6 +631,7 @@ private: static BOOL sKeyboardMode; LLColor4 mBackgroundColor; + LLColor4 mBorderColor; BOOL mBgVisible; LLMenuItemGL* mParentMenuItem; LLUIString mLabel; @@ -623,6 +708,12 @@ public: virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn); + + private: LLHandle mBranch; }; // end class LLMenuItemBranchGL @@ -668,6 +759,12 @@ public: void show(S32 x, S32 y, BOOL mouse_down); void hide(BOOL item_selected); + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn) { return FALSE; } ; + + private: LLMenuItemGL *pieItemFromXY(S32 x, S32 y); S32 pieItemIndexFromXY(S32 x, S32 y); @@ -729,6 +826,12 @@ public: void resetMenuTrigger() { mAltKeyTrigger = FALSE; } + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn) { return FALSE; } ; + + private: void checkMenuTrigger(); @@ -814,6 +917,12 @@ public: virtual void draw(void); virtual U32 getNominalHeight() const; + virtual BOOL setCtrlResponse(U8 llMenuItemCallType, + const std::string& name, + void* user_data, + void *callback_fcn) { return FALSE; } ; + + private: LLHandle mParentHandle; }; @@ -832,4 +941,5 @@ private: LLEditMenuHandlerMgr() {}; }; + #endif // LL_LLMENUGL_H -- cgit v1.1