aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llcheckboxctrl.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llui/llcheckboxctrl.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llui/llcheckboxctrl.h')
-rw-r--r--linden/indra/llui/llcheckboxctrl.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/linden/indra/llui/llcheckboxctrl.h b/linden/indra/llui/llcheckboxctrl.h
new file mode 100644
index 0000000..77dc39d
--- /dev/null
+++ b/linden/indra/llui/llcheckboxctrl.h
@@ -0,0 +1,131 @@
1/**
2 * @file llcheckboxctrl.h
3 * @brief LLCheckBoxCtrl base class
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLCHECKBOXCTRL_H
29#define LL_LLCHECKBOXCTRL_H
30
31
32#include "stdtypes.h"
33#include "lluictrl.h"
34#include "llbutton.h"
35#include "v4color.h"
36#include "llrect.h"
37
38//
39// Constants
40//
41const S32 LLCHECKBOXCTRL_BTN_SIZE = 13;
42const S32 LLCHECKBOXCTRL_VPAD = 2;
43const S32 LLCHECKBOXCTRL_HPAD = 2;
44const S32 LLCHECKBOXCTRL_SPACING = 5;
45const S32 LLCHECKBOXCTRL_HEIGHT = 16;
46
47// Deprecated, don't use.
48#define CHECKBOXCTRL_HEIGHT LLCHECKBOXCTRL_HEIGHT
49
50const BOOL RADIO_STYLE = TRUE;
51const BOOL CHECK_STYLE = FALSE;
52
53//
54// Classes
55//
56class LLFontGL;
57class LLTextBox;
58class LLViewBorder;
59
60class LLCheckBoxCtrl
61: public LLUICtrl
62{
63public:
64 LLCheckBoxCtrl(const LLString& name, const LLRect& rect, const LLString& label,
65 const LLFontGL* font = NULL,
66 void (*commit_callback)(LLUICtrl*, void*) = NULL,
67 void* callback_userdata = NULL,
68 BOOL initial_value = FALSE,
69 BOOL use_radio_style = FALSE, // if true, draw radio button style icons
70 const LLString& control_which = LLString::null);
71 virtual ~LLCheckBoxCtrl();
72
73 // LLView interface
74 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_CHECKBOX; }
75 virtual LLString getWidgetTag() const { return LL_CHECK_BOX_CTRL_TAG; }
76 virtual LLXMLNodePtr getXML(bool save_children = true) const;
77 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
78
79 virtual void setEnabled( BOOL b );
80
81 virtual void draw();
82 virtual void reshape(S32 width, S32 height, BOOL called_from_parent);
83
84 // LLUICtrl interface
85 virtual void setValue(const LLSD& value );
86 virtual LLSD getValue() const;
87 BOOL get() { return (BOOL)getValue().asBoolean(); }
88 void set(BOOL value) { setValue(value); }
89
90 virtual void setTentative(BOOL b) { mButton->setTentative(b); }
91 virtual BOOL getTentative() const { return mButton->getTentative(); }
92
93 virtual BOOL setLabelArg( const LLString& key, const LLString& text );
94
95 virtual void clear();
96 virtual void onCommit();
97
98 // LLCheckBoxCtrl interface
99 virtual BOOL toggle() { return mButton->toggleState(); } // returns new state
100
101 void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
102 void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
103
104 void setLabel( const LLString& label );
105 LLString getLabel() const;
106
107 virtual void setControlName(const LLString& control_name, LLView* context);
108 virtual LLString getControlName() const;
109
110 static void onButtonPress(void *userdata);
111
112protected:
113 // note: value is stored in toggle state of button
114 LLButton* mButton;
115 LLTextBox* mLabel;
116 const LLFontGL* mFont;
117 LLColor4 mTextEnabledColor;
118 LLColor4 mTextDisabledColor;
119 BOOL mRadioStyle;
120 BOOL mInitialValue;
121 BOOL mKeyboardFocusOnClick;
122 LLViewBorder* mBorder;
123};
124
125
126// HACK: fix old capitalization problem
127//typedef LLCheckBoxCtrl LLCheckboxCtrl;
128#define LLCheckboxCtrl LLCheckBoxCtrl
129
130
131#endif // LL_LLCHECKBOXCTRL_H