diff options
Diffstat (limited to 'indra/newview/llcolorswatch.h')
-rw-r--r-- | indra/newview/llcolorswatch.h | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 0dd021f51f..a05926c2f5 100644 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -37,6 +37,7 @@ #include "v4color.h" #include "llfloater.h" #include "llviewerimage.h" +#include "lltextbox.h" // // Classes @@ -57,53 +58,65 @@ public: COLOR_CANCEL } EColorPickOp; - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); - LLColorSwatchCtrl(const std::string& name, const LLRect& rect, const std::string& label, const LLColor4& color, - void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata), - void* callback_userdata); + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> + { + Optional<LLColor4> color; + Optional<bool> can_apply_immediately; + Optional<LLUIImage*> alpha_background_image; + Optional<commit_callback_t> cancel_callback; + Optional<commit_callback_t> select_callback; + Optional<LLUIColor> border_color; + Optional<S32> label_width; + + Optional<LLTextBox::Params> caption_text; + Optional<LLViewBorder::Params> border; + Params(); + }; +protected: + LLColorSwatchCtrl(const Params& p); + friend class LLUICtrlFactory; +public: ~LLColorSwatchCtrl (); - virtual void setValue(const LLSD& value); + /*virtual*/ void setValue(const LLSD& value); - virtual LLSD getValue() const { return mColor.getValue(); } + /*virtual*/ LLSD getValue() const { return mColor.getValue(); } const LLColor4& get() { return mColor; } void set(const LLColor4& color, BOOL update_picker = FALSE, BOOL from_event = FALSE); void setOriginal(const LLColor4& color); void setValid(BOOL valid); void setLabel(const std::string& label); + void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; } - void setOnCancelCallback(LLUICtrlCallback cb) { mOnCancelCallback = cb; } - void setOnSelectCallback(LLUICtrlCallback cb) { mOnSelectCallback = cb; } + void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } + void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } void setFallbackImageName(const std::string& name) { mFallbackImageName = name; } void showPicker(BOOL take_focus); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x,S32 y,MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual void draw(); - virtual void setEnabled( BOOL enabled ); - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ void draw(); + /*virtual*/ void setEnabled( BOOL enabled ); static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE ); protected: BOOL mValid; LLColor4 mColor; - LLColor4 mBorderColor; + LLUIColor mBorderColor; LLTextBox* mCaption; LLHandle<LLFloater> mPickerHandle; LLViewBorder* mBorder; BOOL mCanApplyImmediately; - LLUICtrlCallback mOnCancelCallback; - LLUICtrlCallback mOnSelectCallback; + commit_callback_t mOnCancelCallback; + commit_callback_t mOnSelectCallback; + S32 mLabelWidth; LLPointer<LLUIImage> mAlphaGradientImage; std::string mFallbackImageName; |