00001 // $Id: uielem.h 751 2006-03-31 15:43:49Z alex $ 00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00003 ================================XARAHEADERSTART=========================== 00004 00005 Xara LX, a vector drawing and manipulation program. 00006 Copyright (C) 1993-2006 Xara Group Ltd. 00007 Copyright on certain contributions may be held in joint with their 00008 respective authors. See AUTHORS file for details. 00009 00010 LICENSE TO USE AND MODIFY SOFTWARE 00011 ---------------------------------- 00012 00013 This file is part of Xara LX. 00014 00015 Xara LX is free software; you can redistribute it and/or modify it 00016 under the terms of the GNU General Public License version 2 as published 00017 by the Free Software Foundation. 00018 00019 Xara LX and its component source files are distributed in the hope 00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 See the GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with Xara LX (see the file GPL in the root directory of the 00026 distribution); if not, write to the Free Software Foundation, Inc., 51 00027 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 00029 00030 ADDITIONAL RIGHTS 00031 ----------------- 00032 00033 Conditional upon your continuing compliance with the GNU General Public 00034 License described above, Xara Group Ltd grants to you certain additional 00035 rights. 00036 00037 The additional rights are to use, modify, and distribute the software 00038 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00039 library and any other such library that any version of Xara LX relased 00040 by Xara Group Ltd requires in order to compile and execute, including 00041 the static linking of that library to XaraLX. In the case of the 00042 "CDraw" library, you may satisfy obligation under the GNU General Public 00043 License to provide source code by providing a binary copy of the library 00044 concerned and a copy of the license accompanying it. 00045 00046 Nothing in this section restricts any of the rights you have under 00047 the GNU General Public License. 00048 00049 00050 SCOPE OF LICENSE 00051 ---------------- 00052 00053 This license applies to this program (XaraLX) and its constituent source 00054 files only, and does not necessarily apply to other Xara products which may 00055 in part share the same code base, and are subject to their own licensing 00056 terms. 00057 00058 This license does not apply to files in the wxXtra directory, which 00059 are built into a separate library, and are subject to the wxWindows 00060 license contained within that directory in the file "WXXTRA-LICENSE". 00061 00062 This license does not apply to the binary libraries (if any) within 00063 the "libs" directory, which are subject to a separate license contained 00064 within that directory in the file "LIBS-LICENSE". 00065 00066 00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00068 ---------------------------------------------- 00069 00070 Subject to the terms of the GNU Public License (see above), you are 00071 free to do whatever you like with your modifications. However, you may 00072 (at your option) wish contribute them to Xara's source tree. You can 00073 find details of how to do this at: 00074 http://www.xaraxtreme.org/developers/ 00075 00076 Prior to contributing your modifications, you will need to complete our 00077 contributor agreement. This can be found at: 00078 http://www.xaraxtreme.org/developers/contribute/ 00079 00080 Please note that Xara will not accept modifications which modify any of 00081 the text between the start and end of this header (marked 00082 XARAHEADERSTART and XARAHEADEREND). 00083 00084 00085 MARKS 00086 ----- 00087 00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00089 designs are registered or unregistered trademarks, design-marks, and/or 00090 service marks of Xara Group Ltd. All rights in these marks are reserved. 00091 00092 00093 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00094 http://www.xara.com/ 00095 00096 =================================XARAHEADEREND============================ 00097 */ 00098 // 00099 00100 #ifndef INC_UIELEM 00101 #define INC_UIELEM 00102 00103 00104 /************************************************************************************** 00105 00106 > class UserInterface : public CC_CLASS_MEMDUMP 00107 00108 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00109 Created: 15/10/96 00110 00111 Purpose: Allows a user to edit a list of items 00112 00113 **************************************************************************************/ 00114 class UserInterface : public CC_CLASS_MEMDUMP 00115 { 00116 CC_DECLARE_MEMDUMP(UserInterface); 00117 public: 00118 virtual ~UserInterface() { }; 00119 virtual BOOL Display(DialogOp& Dialog) = 0; 00120 virtual BOOL Interact(DialogOp& Dialog) = 0; 00121 virtual void Hide() = 0; 00122 }; 00123 00124 00125 class ListControl; 00126 class TextControl; 00127 /************************************************************************************** 00128 00129 > class VisibleListItem : public UserInterface 00130 00131 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00132 Created: 15/10/96 00133 00134 Purpose: Allows a user to edit a list of items 00135 00136 **************************************************************************************/ 00137 class VisibleListItem : public UserInterface 00138 { 00139 CC_DECLARE_MEMDUMP(VisibleListItem); 00140 00141 public: 00142 virtual ~VisibleListItem() {} 00143 00144 // Overridden implementation does nothing 00145 virtual BOOL Display(DialogOp& Dialog) { return TRUE; } 00146 virtual BOOL Interact(DialogOp& Dialog) { return TRUE; } 00147 virtual void Hide() {} 00148 00149 virtual StringBase& GetText(StringBase& Description) const = 0; 00150 virtual BOOL operator > (const VisibleListItem& OtherItem) const; 00151 }; 00152 00153 inline BOOL VisibleListItem::operator > (const VisibleListItem& OtherItem) const 00154 { 00155 String_64 ThisItemText; 00156 String_64 OtherItemText; 00157 00158 return GetText(ThisItemText) > OtherItem.GetText(OtherItemText); 00159 } 00160 00161 00162 00163 class VisibleListItemPtr; 00164 /************************************************************************************** 00165 00166 > class VisibleListIterator 00167 00168 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00169 Created: 15/10/96 00170 00171 Purpose: Returns entries in a visible list 00172 00173 See Also: VisibleList::Begin(), End() 00174 00175 **************************************************************************************/ 00176 class VisibleListIterator 00177 { 00178 public: 00179 VisibleListIterator& operator ++(); 00180 VisibleListIterator& operator --(); 00181 VisibleListItem& operator*(); 00182 BOOL operator!=(const VisibleListIterator& Other); 00183 00184 00185 VisibleListIterator(List& Container, VisibleListItemPtr* const pPointer, 00186 INT32* IndexesOfItemsToReturn = NULL); 00187 ~VisibleListIterator(); 00188 00189 VisibleListIterator(const VisibleListIterator& Other); 00190 const VisibleListIterator& operator=(const VisibleListIterator& Other); 00191 private: 00192 VisibleListItemPtr* m_VisibleListItemPtr; 00193 List& m_Container; 00194 INT32* m_IndexesOfItemsToReturn; 00195 UINT32 m_IndexInIndex; 00196 }; 00197 00198 /************************************************************************************** 00199 00200 > class VisibleList : public UserInterface 00201 00202 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00203 Created: 15/10/96 00204 00205 Purpose: Allows a user to edit a list of items 00206 00207 **************************************************************************************/ 00208 class VisibleList : public UserInterface, public Notifier 00209 { 00210 CC_DECLARE_MEMDUMP(VisibleList); 00211 00212 public: 00213 VisibleList() : m_pUIElement(NULL) {} 00214 virtual ~VisibleList(); 00215 00216 // Overridden implementations...do nothing for now (use non-virtuals) 00217 virtual BOOL Display(DialogOp& Dialog); 00218 virtual BOOL Interact(DialogOp& Dialog); 00219 virtual void Hide(); 00220 00221 virtual BOOL Display(ListControl& Control); 00222 virtual BOOL Interact(ListControl& Control); 00223 00224 // Visible List specific 00225 virtual BOOL InsertEntry(VisibleListItem& EntryToInsert); 00226 virtual BOOL DeleteSelectedEntries(); 00227 virtual BOOL DeleteAllEntries(); 00228 00229 virtual UINT32 GetNumberOfEntries() const; 00230 virtual UINT32 GetNumberOfSelectedEntries() const; 00231 virtual VisibleListItem* GetFirstSelectedEntry() const; 00232 virtual void RemoveSelection(); 00233 00234 virtual VisibleListIterator Begin(); 00235 virtual const VisibleListIterator& End() const; 00236 virtual VisibleListIterator BeginOfEnd(); 00237 00238 virtual VisibleListIterator SelectionBegin(); 00239 00240 protected: 00241 // Implementation 00242 virtual VisibleListItem& GetEntryAt(UINT32 Index); 00243 virtual BOOL DeleteEntryAtIndex(UINT32 Index); 00244 00245 List& GetContainer(); 00246 00247 private: 00248 ListControl* m_pUIElement; 00249 List m_Container; 00250 }; 00251 00252 00253 /************************************************************************************** 00254 00255 > class EditableText : public UserInterface 00256 00257 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00258 Created: 15/10/96 00259 00260 Purpose: Allows a user to edit a list of items 00261 00262 **************************************************************************************/ 00263 class EditableText : public UserInterface, public Notifier 00264 { 00265 public: // overrides of User_interface functions 00266 EditableText(const StringBase& TextString = NullString); 00267 00268 virtual ~EditableText(); 00269 EditableText(const EditableText& Other); 00270 virtual const EditableText& operator=(const EditableText& Other); 00271 00272 virtual const EditableText& operator=(const StringBase& NewText ); 00273 operator const StringBase&(); 00274 00275 // Overridden implementation does nothing...slightly bodgy this 00276 virtual BOOL Display(DialogOp& Dialog) { return TRUE; } 00277 virtual BOOL Interact(DialogOp& Dialog) { return TRUE; } 00278 virtual BOOL Display(TextControl& Control); 00279 virtual void Hide(); 00280 00281 private: 00282 // Implementation 00283 class Observer : public Notifiable 00284 { 00285 EditableText* m_pTheTextObject; 00286 public: 00287 Observer( EditableText* const pContainer ): m_pTheTextObject(pContainer){} 00288 void Notify( Notifier* const pSender ); 00289 } 00290 m_Watcher; 00291 00292 friend void Observer::Notify( Notifier* const pSender ); 00293 00294 TextControl* m_pUIElement; 00295 String_256 m_String; 00296 00297 00298 }; 00299 00300 00301 00302 /************************************************************************************** 00303 00304 > class VisibleLabel : public UserInterface, public Notifier 00305 00306 Author: Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com> 00307 Created: 15/10/96 00308 00309 Purpose: Allows a user to edit a list of items 00310 00311 **************************************************************************************/ 00312 class VisibleLabel : public UserInterface, public Notifier 00313 { 00314 public: // overrides of User_interface functions 00315 VisibleLabel(const StringBase& TextString = NullString); 00316 00317 virtual ~VisibleLabel(); 00318 00319 virtual const VisibleLabel& operator=(const StringBase& NewText ); 00320 operator const StringBase&() const; 00321 00322 // Overridden implementation does nothing...slightly bodgy this 00323 virtual BOOL Display(DialogOp& Dialog); 00324 virtual BOOL Interact(DialogOp& Dialog); 00325 virtual void Hide(); 00326 00327 private: 00328 // Implementation 00329 class Observer : public Notifiable 00330 { 00331 VisibleLabel* m_pTheTextObject; 00332 public: 00333 Observer( VisibleLabel* const pContainer ): m_pTheTextObject(pContainer){} 00334 void Notify( Notifier* const pSender ); 00335 } 00336 m_Watcher; 00337 00338 friend void Observer::Notify( Notifier* const pSender ); 00339 00340 StaticTextControl* m_pUIElement; 00341 String_256 m_String; 00342 }; 00343 00344 00345 #endif // INC_UIELEM