aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexturectrl.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lltexturectrl.h')
-rw-r--r--linden/indra/newview/lltexturectrl.h177
1 files changed, 177 insertions, 0 deletions
diff --git a/linden/indra/newview/lltexturectrl.h b/linden/indra/newview/lltexturectrl.h
new file mode 100644
index 0000000..8569cbc
--- /dev/null
+++ b/linden/indra/newview/lltexturectrl.h
@@ -0,0 +1,177 @@
1/**
2 * @file lltexturectrl.h
3 * @author Richard Nelson, James Cook
4 * @brief LLTextureCtrl class header file including related functions
5 *
6 * Copyright (c) 2002-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#ifndef LL_LLTEXTURECTRL_H
30#define LL_LLTEXTURECTRL_H
31
32#include "llcoord.h"
33#include "llfloater.h"
34#include "llstring.h"
35#include "lluictrl.h"
36#include "llpermissionsflags.h"
37
38class LLButton;
39class LLFloaterTexturePicker;
40class LLInventoryItem;
41class LLTextBox;
42class LLViewBorder;
43
44// used for setting drag & drop callbacks.
45typedef BOOL (*drag_n_drop_callback)(LLUICtrl*, LLInventoryItem*, void*);
46
47//////////////////////////////////////////////////////////////////////////////////////////
48// LLTextureCtrl
49
50
51class LLTextureCtrl
52: public LLUICtrl
53{
54public:
55 typedef enum e_texture_pick_op
56 {
57 TEXTURE_CHANGE,
58 TEXTURE_SELECT,
59 TEXTURE_CANCEL
60 } ETexturePickOp;
61
62public:
63 LLTextureCtrl(
64 const std::string& name, const LLRect& rect,
65 const std::string& label,
66 const LLUUID& image_id,
67 const LLUUID& default_image_id,
68 const std::string& default_image_name );
69 virtual ~LLTextureCtrl();
70
71 // LLView interface
72 virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXTURE_PICKER; }
73 virtual LLString getWidgetTag() const { return LL_TEXTURE_CTRL_TAG; }
74 virtual LLXMLNodePtr getXML(bool save_children = true) const;
75 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
76
77 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
78 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
79 BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
80 EAcceptance *accept,
81 LLString& tooltip_msg);
82 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
83 virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
84
85 virtual void draw();
86 virtual void setVisible( BOOL visible );
87 virtual void setEnabled( BOOL enabled );
88
89 void setValid(BOOL valid);
90
91 // LLUICtrl interface
92 virtual void clear();
93
94 // Takes a UUID, wraps get/setImageAssetID
95 virtual void setValue( LLSD value );
96 virtual LLSD getValue() const;
97
98 // LLTextureCtrl interface
99 void showPicker(BOOL take_focus);
100 void setLabel(const LLString& label);
101 const LLString& getLabel() const { return mLabel; }
102
103 void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; }
104 bool getAllowNoTexture() const { return mAllowNoTexture; }
105
106 const LLUUID& getImageItemID() { return mImageItemID; }
107
108 void setImageAssetID(const LLUUID &image_asset_id);
109 const LLUUID& getImageAssetID() const { return mImageAssetID; }
110
111 void setDefaultImageAssetID( const LLUUID& id ) { mDefaultImageAssetID = id; }
112
113 const LLString& getDefaultImageName() const { return mDefaultImageName; }
114 const LLUUID& getDefaultImageAssetID() const { return mDefaultImageAssetID; }
115
116 void setCaption(const LLString& caption);
117 void setCanApplyImmediately(BOOL b);
118
119 void setImmediateFilterPermMask(PermissionMask mask)
120 { mImmediateFilterPermMask = mask; }
121 void setNonImmediateFilterPermMask(PermissionMask mask)
122 { mNonImmediateFilterPermMask = mask; }
123 PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
124 PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; }
125
126 void closeFloater();
127
128 void onFloaterClose();
129 void onFloaterCommit(ETexturePickOp op);
130
131 // This call is returned when a drag is detected. Your callback
132 // should return TRUE if the drag is acceptable.
133 void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; }
134
135 // This callback is called when the drop happens. Return TRUE if
136 // the drop happened - resulting in an on commit callback, but not
137 // necessariliy any other change.
138 void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; }
139
140 void setOnCancelCallback(LLUICtrlCallback cb) { mOnCancelCallback = cb; }
141
142 void setOnSelectCallback(LLUICtrlCallback cb) { mOnSelectCallback = cb; }
143
144private:
145 BOOL allowDrop(LLInventoryItem* item);
146 BOOL doDrop(LLInventoryItem* item);
147
148private:
149 drag_n_drop_callback mDragCallback;
150 drag_n_drop_callback mDropCallback;
151 LLUICtrlCallback mOnCancelCallback;
152 LLUICtrlCallback mOnSelectCallback;
153 LLPointer<LLViewerImage> mTexturep;
154 LLColor4 mBorderColor;
155 LLUUID mImageItemID;
156 LLUUID mImageAssetID;
157 LLUUID mDefaultImageAssetID;
158 LLString mDefaultImageName;
159 LLViewHandle mFloaterHandle;
160 LLTextBox* mTentativeLabel;
161 LLTextBox* mCaption;
162 LLString mLabel;
163 BOOL mAllowNoTexture; // If true, the user can select "none" as an option
164 LLCoordGL mLastFloaterLeftTop;
165 PermissionMask mImmediateFilterPermMask;
166 PermissionMask mNonImmediateFilterPermMask;
167 BOOL mCanApplyImmediately;
168 BOOL mNeedsRawImageData;
169 LLViewBorder* mBorder;
170 BOOL mValid;
171};
172
173// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp
174// and class to LLTexturePicker
175#define LLTexturePicker LLTextureCtrl
176
177#endif // LL_LLTEXTURECTRL_H