dlgmgr.h

Go to the documentation of this file.
00001 // $Id: dlgmgr.h 1769 2007-06-17 19:33:43Z 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 // This file defines the DialogManager class
00100 
00101 /*
00102 
00103 */
00104 
00105 #ifndef INC_DLGMGR
00106 #define INC_DLGMGR         
00107 
00108 //------------------------------------------------------------------------------------------
00109 // Include files
00110  
00111 //#include "ccobject.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00112 //#include "dlgtypes.h"  // Dialog types         - in camtypes.h [AUTOMATICALLY REMOVED]
00113 //#include "listitem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 //#include "basestr.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "convert.h"   - in camtypes.h [AUTOMATICALLY REMOVED]
00117 #include "stack.h"
00118 //#include "xaraprop.h"
00119 
00120 class Node;
00121 class DialogOp;
00122 class DialogTabOp;
00123 class DialogColourInfo;
00124 class CustomComboBoxControlDataItem;
00125 class DialogEventHandler;
00126 
00127 #define WM_CTL_COMMIT   WM_USER + 211   // Message sent by subclassed edit/combo boxed when enter or 
00128                                         // control is pressed.
00129 
00130 #define WM_CTL_SETFOCUS WM_USER + 212   // Message sent by subclassed edit/combo boxed to parent tool bar
00131                                         // to indicate  gaining or losing the focus.
00132 
00133   
00134 //------------------------------------------------------------------------------------------
00135 
00137 //     SPECIAL TYPES FOR MERGING DIALOGS      // 
00139 
00140 // Special typedefs for WIN16 as these only exist in header files under NT.
00141 // (See Win3.1 SDK Help "Dialog Box resource")
00142 
00143 #if WIN16
00144 
00145 // These *MUST* be byte-packed
00146 #pragma pack(1)
00147 
00148 typedef struct
00149 {
00150     DWORD style;
00151     BYTE  cdit;
00152     WORD  x;
00153     WORD  y;
00154     WORD  cx;
00155     WORD  cy;
00156 } DLGTEMPLATE;
00157 
00158 typedef struct 
00159 {
00160     WORD  x;
00161     WORD  y;
00162     WORD  cx;
00163     WORD  cy;
00164     WORD  id;
00165     DWORD style;
00166 } DLGITEMTEMPLATE;
00167 
00168 //Back to normal packing
00169 #pragma pack()
00170 
00171 #endif
00172 
00173 WX_DECLARE_STRING_HASH_MAP( String_256, IdToSerializedPaneInfo );
00174 
00175 /********************************************************************************************
00176 
00177 >   class DialogPosition: public ListItem
00178 
00179     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00180     Created:    8/9/93
00181     Purpose:    DialogPosition ListItem's are stored in the DialogManager's DialogPositionList
00182                 they record the position of a dialog box before it is destroyed. They are 
00183                 used to restore the position of the dialog when it is created the next time. 
00184                  
00185     SeeAlso:    DialogManager
00186 
00187 ********************************************************************************************/
00188 
00189 
00190 class DialogPosition: public ListItem
00191 {
00192 public:                       
00193     CDlgResID DlgResourceID; // Resource ID of the dialog   
00194     List DlgWinList;         // A list of all live dialogs created from the DlgResourceID
00195     INT32 LastX;                 // Last X position  
00196     INT32 LastY;                 // Last Y position
00197     CDlgResID ActivePage;    // We remember the active page in a tabbed dialog.
00198     INT32 ActivePageIndex;   // The active page's index
00199 };
00200 
00201 /********************************************************************************************
00202 
00203 >   class ActiveDlgStateItem: public ListItem
00204 
00205     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00206     Created:    14/7/95
00207     Purpose:    Stored on  an ActiveDlgStateStack. See this class for a definition of its
00208                 purpose.
00209     SeeAlso:    ActiveDlgStateStack
00210 
00211 ********************************************************************************************/
00212 
00213 class ActiveDlgStateItem: public ListItem
00214 {
00215 public:
00216     wxWindow           *pActiveWindow;      // The active window
00217     BOOL                fIsAModalDialog;    // Is the active window a modal dialog
00218 };
00219 
00220 
00221 /********************************************************************************************
00222 
00223 >   class ActiveDlgStateStack: public Stack
00224 
00225     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00226     Created:    14/7/95
00227     Purpose:    An ActiveDlgStateStack holds ActiveDlgStateItems. Whenever a MODAL dialog is
00228                 closed we will need to restore the previously active window. What's more if
00229                 the previously active window is a MODAL dialog , then we must disable
00230                 the mainframe and other popups owned by the mainframe; so that the dialog 
00231                 continues to behave modally. This stack stores this information. 
00232 
00233     SeeAlso:    ActiveDlgStateItem
00234     SeeAlso:    DialogManager
00235 
00236 ********************************************************************************************/
00237 
00238 class ActiveDlgStateStack: public Stack
00239 {
00240     
00241 };
00242 
00243 
00244 
00245 
00246 /********************************************************************************************
00247 
00248 >   class CGadgetImageList : public CCObject
00249 
00250     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00251     Created:    08/02/2006
00252     Purpose:    Kernel-usable class represeting a list of images
00253 
00254 ********************************************************************************************/
00255 
00256 class CGadgetImageList : public CCObject
00257 {
00258     CC_DECLARE_DYNAMIC(CGadgetImageList);
00259 
00260     class ResIDListItem : public ListItem
00261     {
00262     public:
00263         ResIDListItem(ResourceID newresID = 0) {m_ResID = newresID;}
00264         ResourceID m_ResID;
00265     };
00266 
00267 public:
00268     CGadgetImageList(UINT32 width=0, UINT32 height=0) {m_width = width; m_height = height;}
00269     ~CGadgetImageList();
00270 
00271     UINT32 Add(CDlgResID resID);
00272     ListItem* FindFirstBitmap(ResourceID* presID) const;
00273     ListItem* FindNextBitmap(ListItem* pListItem, ResourceID* presID) const;
00274     UINT32 GetWidth() const {return m_width;}
00275     UINT32 GetHeight() const {return m_height;}
00276 
00277 private:
00278     List    m_BitmapIDList;
00279     UINT32  m_width;
00280     UINT32  m_height;
00281 };
00282 
00283 
00284 
00285 
00286 /********************************************************************************************
00287 
00288 >   class CamelotTreeItemData : public wxTreeItemData
00289 
00290     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00291     Created:    08/02/2006
00292     Purpose:    Hold pointer to CCObject associated with a wxTreeCtrl item
00293 
00294 ********************************************************************************************/
00295 
00296 class CamelotTreeItemData : public wxTreeItemData
00297 {
00298 public:
00299     CamelotTreeItemData(CCObject* pObj = NULL) {m_pObject = pObj;}
00300 
00301     CCObject* GetObject() {return m_pObject;}
00302 
00303 private:
00304     CCObject*   m_pObject;
00305 };
00306 
00307 
00308 
00309 
00310 /********************************************************************************************
00311 
00312 >   class DialogManager : public CCObject
00313 
00314     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00315     Created:    16/8/93
00316     Purpose:    There will only ever be one instance of the DialogManager. It resides in the 
00317                 oil layer and is used to perform all platform specific dialog box operations. 
00318                 It calls and is called by DialogOp. The interface to this object should be the
00319                 same no matter what platform it is ported to. That is with the exception of the
00320                 SendDialogMessage function which requires system specific types as its arguments. 
00321                 
00322     SeeAlso:    -
00323 
00324 ********************************************************************************************/
00325 
00326 class wxPropertySheetDialog;
00327 
00328 class DialogBarOp;
00329                
00330 class DialogManager: public CCObject  
00331 {
00332     friend class DialogEventHandler;
00333     friend class wxPropertySheetDialog; // Is a friend because when a property sheet is created 
00334                                // it needs to call PostCreate.
00335 public: 
00336 
00337     DialogManager();     // Constructor
00338    
00339     // The DialogManager's create function creates a DialogOp window
00340     static BOOL Create(DialogOp* DlgOp, /* HINSTANCE MainInstance, */ CDlgResID MainDlgID, 
00341                      /*HINSTANCE SubInstance, */ CDlgResID SubDlgID, 
00342                         CDlgMode Mode = MODELESS, INT32 OpeningPage = -1, CWindowID ParentWnd = NULL);
00343 private:
00344 
00345     static void CreateRecursor(wxWindow * pwxWindow);
00346 
00347     // Creates a DialogBarOp
00348     static BOOL CreateBar(DialogBarOp* DlgOp);
00349     static BOOL CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage, CDlgResID MainDlgID );
00350 
00351 
00352     // Post create gets called after a dialog window has been created.
00353     static BOOL PostCreate(DialogOp * pDialogOp, INT32 OpeningPage);
00354 
00355 public:
00356     // This should eventually be the only Create method that we require. If the DialogOp is 
00357     // a BarDialogOp then it will create a window of the correct type and attach it to the 
00358     // relevant docking bar. Otherwise it will create a regular modeless dialog. 
00359     CWindowID Create(DialogOp* DialogOp); 
00360 
00361     // The open method displays the dialog box on the display. 
00362     static void Open(CWindowID WindowID, DialogOp* DlgOp); 
00363 
00364     // The close method removes the dialog from the display but keeps all system     
00365     // resources associated with it. It hides the dialog.  
00366     static void Close(CWindowID WindowID, DialogOp* DlgOp); 
00367 
00368     // Place dialog above or below exist controls in dialog
00369     static BOOL MergeDialogs( CWindowID Dialog, CWindowID Mergee, bool fAbove );
00370 
00371     // Brings a dialog to the top-most z-order position
00372     static BOOL BringToTop(CWindowID WindowID, DialogOp* pDlgOp);
00373 
00374     // Get the book control
00375     static wxBookCtrlBase * GetBookControl(CWindowID WindowID, CGadgetID Gadget =0 );
00376 
00377     // Function to determine if a gadget is of a type that can be ticked 
00378     static BOOL IsGadgetTickable(CWindowID WindowID, 
00379                                  CGadgetID Gadget);
00380 
00381     // Used to abort the dragging of the custom colour picker control
00382     // from within the colour editor
00383     static BOOL ColourPickerAbort(CWindowID WindowID, CGadgetID Gadget, WPARAM wParam = 0);
00384 
00385     // The delete method will delete all system resources associated with the Dialog 
00386     // box and any information which is being kept about the dialog.  
00387     static void Delete(CWindowID WindowID, DialogOp* DlgOp);   
00388 
00389     // Called by SendDialogMessage to send messages for mouse events - for cc_DialogDraw
00390     // controls, this then sends an extra chunk of useful information to the owning Dlg,
00391     // so that it can handle the click intelligently.
00392     static void ProcessMouseEvent(CDlgMessage DialogMessageType,
00393                                     wxWindow *pDlg, UINT32 wParam, INT32 lParam);
00394 
00395     // The following functions are called by same named functions in the DialogOp   
00396     // class. The DialogOp functions are provided for ease of use and do not have a 
00397     // CWindowID argument. 
00398 
00399 
00400     static wxWindow * GetGadget(CWindowID WindowID, CGadgetID Gadget);
00401 
00402     static OpDescriptor * GetGadgetOpDescriptor(CWindowID WindowID, CGadgetID Gadget);
00403 
00404     // -------------------------------------------------------------------------------------         
00405     // Methods to set gadget values                                                        
00406     
00407     static BOOL SetUnitGadgetValue( CWindowID WindowID,
00408                          CGadgetID Gadget, 
00409                          UnitType Unit, 
00410                          MILLIPOINT value, 
00411                          BOOL EndOfList = TRUE, 
00412                          INT32 ListPos = 0
00413                          ); 
00414 
00415     static BOOL SetDimensionUnitGadgetValue(CWindowID WindowID, 
00416                                             CGadgetID Gadget, 
00417                                             UnitType  units, 
00418                                             double    value,
00419                                             Node*     pNode,
00420                                             BOOL      IncludeUnitSpecifier = TRUE,
00421                                             BOOL      EndOfList = FALSE, 
00422                                             INT32       ListPos   = 0); 
00423 
00424     static BOOL SetLongGadgetValue(CWindowID WindowID, 
00425                             CGadgetID Gadget, 
00426                             INT32 value, 
00427                             BOOL EndOfList = TRUE, 
00428                             INT32 ListPos = 0);   
00429                             
00430     static BOOL SetDoubleGadgetValue(CWindowID WindowID, 
00431                             CGadgetID Gadget, 
00432                             double value, 
00433                             BOOL EndOfList = TRUE, 
00434                             INT32 ListPos = 0);   
00435                             
00436     static BOOL SetStringGadgetValue(CWindowID WindowID,
00437                               CGadgetID Gadget, 
00438                               UINT32 IDStrID, 
00439                               BOOL EndOfList = TRUE, 
00440                               INT32 ListPos = 0);   
00441                                 
00442     static BOOL SetStringGadgetValue(CWindowID WindowID,
00443                               CGadgetID Gadget, 
00444                               const StringBase& StrVal, 
00445                               BOOL EndOfList = TRUE, 
00446                               INT32 ListPos = 0);    
00447 
00448     static BOOL SetCustomComboGadgetValue(CWindowID WindowID,
00449                                      CGadgetID Gadget, 
00450                                      CustomComboBoxControlDataItem* TheItem,   
00451                                      BOOL EndOfList = TRUE, 
00452                                      INT32 ListPos = 0);
00453 
00454     static BOOL SelectCustomComboGadgetValueOnString (CWindowID WindowID,
00455                                                       CGadgetID Gadget, 
00456                                                       StringBase* StrVal);
00457                               
00458     static BOOL SetGadgetRange(CWindowID WindowID, 
00459                         CGadgetID Gadget, 
00460                         INT32 Min, 
00461                         INT32 Max, 
00462                         INT32 PageInc = 1);   
00463 
00464     static BOOL SetListBoxSelection( CWindowID WindowID, CGadgetID Gadget, INT32 Index, BOOL SelectIt, BOOL SingleSelection );
00465 
00466     static BOOL SetBoolGadgetSelected(CWindowID WindowID,
00467                                 CGadgetID Gadget,
00468                                 BOOL IsSelected,
00469                                 INT32 ListPos = 0);
00470                         
00471     static BOOL SetSelectedValueIndex(CWindowID WindowID, 
00472                                CGadgetID Gadget, 
00473                                INT32 Index);
00474 
00475     static BOOL SetSelectedValueRange(CWindowID WindowID,
00476                                 CGadgetID Gadget,
00477                                 WORD StartIndex,
00478                                 WORD EndIndex,
00479                                 BOOL Selected = TRUE);
00480     
00481     static BOOL SetDimensionGadgetValue( CWindowID WindowID, 
00482                          CGadgetID Gadget, 
00483                          MILLIPOINT value,
00484                          Node* pNode,
00485                          BOOL IncludeUnitSpecifier = TRUE,
00486                          BOOL EndOfList = FALSE, 
00487                          INT32 ListPos = -1
00488                          ); 
00489 
00490     static BOOL SetMemoryGadgetValue( CWindowID WindowID, 
00491                                       CGadgetID Gadget, 
00492                                       UINT32 value, 
00493                                       BOOL EndOfList = TRUE, 
00494                                       INT32 ListPos = 0
00495                                     ); 
00496 
00497     static BOOL SetGadgetHelp( CWindowID WindowID, 
00498                                CGadgetID Gadget, 
00499                                UINT32 BubbleID, 
00500                                UINT32 StatusID, 
00501                                UINT32 ModuleID = 0);   
00502 
00503     // -------------------------------------------------------------------------------------      
00504     // Methods to get gadget values                                                         
00505     
00506     static MILLIPOINT GetUnitGadgetValue(CWindowID WindowID,
00507                               CGadgetID Gadget,  
00508                               UnitType DefaultType,
00509                               MILLIPOINT StartRange, 
00510                               MILLIPOINT EndRange,
00511                               UINT32 IDSInvalidMsg = 0,  
00512                               BOOL* Valid = NULL);
00513     
00514     static INT32 GetLongGadgetValue(CWindowID WindowID,
00515                                    CGadgetID Gadget, 
00516                                    INT32 StartRange, 
00517                                    INT32 EndRange, 
00518                                    UINT32 IDSInvalidMsg = 0, 
00519                                    BOOL* Valid = NULL,
00520                                    Convert::PFNSTRINGTOINT32 pfnParser = Convert::StringToLong);
00521 
00522     static double GetDoubleGadgetValue(CWindowID WindowID,
00523                                    CGadgetID Gadget, 
00524                                    double StartRange, 
00525                                    double EndRange, 
00526                                    UINT32 IDSInvalidMsg = 0, 
00527                                    BOOL* Valid = NULL,
00528                                    Convert::PFNSTRINGTODOUBLE pfnParser = Convert::StringToDouble);
00529 
00530     static BOOL GetBoolGadgetSelected(CWindowID WindowID,
00531                         CGadgetID Gadget,
00532                         UINT32 IDSInvalidMsg = 0,
00533                         BOOL* Valid = NULL,
00534                         INT32 ListPos = 0); 
00535 
00536     static String_256 GetStringGadgetValue(CWindowID WindowID,
00537                                            CGadgetID Gadget,
00538                                            BOOL* Valid = NULL,
00539                                            INT32 ListPos = -1);
00540     
00541     static BOOL GetGadgetRange(CWindowID WindowID, 
00542                         CGadgetID Gadget, 
00543                         INT32* Min, 
00544                         INT32* Max);
00545     
00546     static MILLIPOINT GetDimensionGadgetValue( CWindowID WindowID, 
00547                                         CGadgetID Gadget, 
00548                                         Node* pNode,
00549                                         BOOL* Valid = NULL,
00550                                         INT32 ListPos = -1);
00551 
00552     static BOOL GetDoubleAndUnitGadgetValue(double*   pMPValue,
00553                                             double*   pUnitValue,
00554                                             UnitType* pUnitType,
00555                                             CWindowID WindowID,
00556                                             CGadgetID Gadget,
00557                                             Node*     pNode);
00558 
00559     static UINT32 GetMemoryGadgetValue(CWindowID WindowID,
00560                                       CGadgetID Gadget,  
00561                                       UINT32 StartRange, 
00562                                       UINT32 EndRange,
00563                                       UINT32 IDSInvalidMsg = 0,  
00564                                       BOOL* Valid = NULL);
00565     
00566     // -------------------------------------------------------------------------------------
00567                         
00568     static BOOL DeleteAllValues(CWindowID WindowID, 
00569                         CGadgetID Gadget);
00570 
00571     static BOOL DeleteValue(CWindowID WindowID, 
00572                      CGadgetID Gadget, 
00573                      BOOL EndOfList = TRUE, 
00574                      INT32 ListPos = 0);     
00575                      
00576     static BOOL GetValueCount(CWindowID WindowID, 
00577                        CGadgetID Gadget, 
00578                        INT32* Count); 
00579     
00580     static BOOL GetValueIndex(CWindowID WindowID, 
00581                        CGadgetID Gadget, 
00582                        INT32* Index);     
00583 
00584     static BOOL GetValueIndex(CWindowID WindowID, 
00585                        CGadgetID Gadget, 
00586                        WORD* Index);     
00587 
00588     static INT32 GetSelectedCount(CWindowID WindowID, CGadgetID Gadget);
00589     static INT32 GetFirstSelectedItem(CWindowID WindowID, CGadgetID Gadget);
00590     static INT32* GetSelectedItems(CWindowID WindowID, CGadgetID Gadget);
00591     
00592     // ------------------------------------------------------------------------------------- 
00593     // Functions for changing a gadgets state 
00594     static BOOL EnableGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Enabled);
00595     static BOOL IsGadgetEnabled( CWindowID WindowID, CGadgetID Gadget );
00596     static BOOL SetGadgetWritable(CWindowID id, CGadgetID Gadget, BOOL enable);
00597     static BOOL HideGadget(CWindowID WindowID, CGadgetID Gadget, BOOL Hide); 
00598     static BOOL GadgetRedraw(CWindowID WindowID, CGadgetID Gadget, BOOL Redraw);
00599     static void Layout(CWindowID WindowID, BOOL CanYield=FALSE);
00600 
00601     // This function should be called after hiding\showing a control,
00602     // so the dialog can be resized
00603     static void RelayoutDialog(DialogTabOp* DlgOp);
00604 
00605     // ------------------------------------------------------------------------------------- 
00606     // Setting the keyboard input focus.
00607     static BOOL SetKeyboardFocus(CWindowID WindowID, CGadgetID Gadget);
00608     static BOOL DefaultKeyboardFocus();
00609     static BOOL HighlightText(CWindowID WindowID, CGadgetID Gadget, INT32 nStart = 0, INT32 nEnd = -1);
00610     static BOOL CaptureMouse(CWindowID WindowID, CGadgetID Gadget);
00611     static BOOL ReleaseMouse(CWindowID WindowID, CGadgetID Gadget);
00612     
00613     // ------------------------------------------------------------------------------------- 
00614     // Immediately updates gadget's appearance    
00615     static void PaintGadgetNow(CWindowID WindowID, CGadgetID gid);
00616     static void InvalidateGadget(CWindowID WindowID, CGadgetID Gadget, BOOL EraseBackround=TRUE);
00617 
00618                 // Invalidates a specific portion of a cc_DialogDraw gadget
00619     static void InvalidateGadget(CWindowID WindowID, CGadgetID Gadget,
00620                                         ReDrawInfoType *ExtraInfo,
00621                                         DocRect *InvalidRect);
00622 
00623                 // Scrolls (by blitting) the given area of the gadget, and invalidates
00624                 // the bit that has 'scrolled into view'
00625     static void ScrollKernelRenderedGadget(CWindowID WindowID, CGadgetID Gadget,
00626                                             DocRect *RectToScroll, DocCoord *ScrollBy);
00627 
00628                 // Gets information on a cc_DislogDraw gadget
00629     static BOOL GetKernelRenderedGadgetInfo(CWindowID WindowID, CGadgetID Gadget,
00630                                             ReDrawInfoType *Result);
00631     
00632                                         
00633     // -------------------------------------------------------------------------------------                                        
00634     // Methods for setting the types of edit fields      
00635     static void SetEditGadgetType(CWindowID WindowID, CGadgetID Gadget, EditGadgetType Type);
00636     static void SetEditGadgetType(CWindowID WindowID, CGadgetID, UINT32 IDSValidChar); 
00637    
00638     static void DualFunctionButton(CWindowID DialogWnd, 
00639                             CGadgetID ButtonGadget);  
00640             
00641     // -------------------------------------------------------------------------------------
00642     // Method for making a listbox dragable                         
00643     static BOOL MakeListBoxDragable(CWindowID WindowID, 
00644                              CGadgetID Gadget);                                  
00645 
00646     static void SetComboListLength(CWindowID WindowID,CGadgetID Gadget);
00647 
00648     // Methods to allow you to set the bitmaps associated with a control
00649     static void SetGadgetBitmaps(CWindowID DialogWnd, CGadgetID Gadget, UINT32 Bitmap1, UINT32 Bitmap2);
00650     static void SetGadgetBitmaps(CWindowID DialogWnd, CGadgetID Gadget, const CGadgetImageList& images);
00651     static void SetGadgetBitmap(CWindowID WindowID, CGadgetID Gadget, ResourceID Bitmap);
00652     static ResourceID GetGadgetBitmap(CWindowID WindowID, CGadgetID Gadget);
00653 
00654     /* specific to the cc_BitmapButton control, allows you to specify both 
00655     selected and unselected bitmaps */
00656     static void SetBitmapButtonIndexes(CWindowID WindowID, CGadgetID Gadget, 
00657                                     UINT32 UnselectedIndex, UINT32 SelectedIndex);
00658 
00659 //  static void SetGadgetBitmaps( wxWindow *pGadget,
00660 //                                /* HINSTANCE hResInstance, */
00661 //                                INT32 SelectedIndex = -1,
00662 //                                INT32 UnselectedIndex = -1 );
00663     static UINT32 GetGadgetImageCount(CWindowID wnd, CGadgetID Gadget);
00664 
00665     static void DeInit(); 
00666 
00667     ~DialogManager(); 
00668 
00669     // This function called by CCamApp::PreTranslateMessage
00670     static BOOL IsADialogWindow(wxWindow *pWnd);
00671 
00672     // --------------------------------------------------------------------------------------
00673     // Methods related to tree controls
00674     static CTreeItemID  SetTreeGadgetItem(CWindowID wnd, CGadgetID Gadget, CTreeItemID hParent, const StringBase& str, CTreeItemID hInsAfter, INT32 iImage, CCObject* pObj = NULL);
00675     static CCObject*    GetTreeGadgetItemData(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem);
00676     static BOOL         SelectTreeGadgetItem(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem, BOOL bNewState = TRUE);
00677     static CTreeItemID  GetTreeGadgetRootItem(CWindowID wnd, CGadgetID Gadget);
00678     static CTreeItemID  GetTreeGadgetFirstSelectedItem(CWindowID wnd, CGadgetID Gadget);
00679     static BOOL         TreeGadgetExpandItem(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem);
00680     static CTreeItemID  GetTreeGadgetNextVisItem(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem);
00681     static CTreeItemID  GetTreeGadgetFirstChildItem(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem);
00682     static UINT32       GetTreeGadgetChildrenCount(CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem, BOOL bRecursive = FALSE);
00683 
00684     // --------------------------------------------------------------------------------------
00685     // Functions which are specific to Tabbed dialogs
00686     // This function adds a page to a tabbed dialog
00687     static BOOL AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID, CGadgetID Gadget=0); 
00688 
00689     // This function maps a property sheet window ID, and a PageID to a Page window ID
00690     static CWindowID GetPageWindow(CWindowID Win, CDlgResID PageID,  INT32* PageIndex = NULL);
00691 
00692     // Used to set the dialog's titlebar text
00693     static BOOL SetTitlebarName(CWindowID Win, String_256* Name);
00694 
00695     // When a dialog becomes active its window ID is assigned to hDlgCurrent. This is required
00696     // for IsDialogMessage handling
00697 
00698     static wxWindow *pDlgCurrent; 
00699 
00700     // Used to determine if there is an open modal dialog
00701     static BOOL ModalDialogOpen(DialogOp** pModal = NULL); 
00702 
00703     // Used to test the visibility status of the window
00704     static BOOL IsWindowVisible(CWindowID Win);
00705 
00706     // Used to test the visibility status of the window (primarily for stopping rampant escape
00707     // keys within the custom control)
00708     static BOOL IsCustomComboDropdownVisible(CWindowID WindowID, CGadgetID Gadget);
00709 
00710     // Used in conjunction with the above, this command can be used to close the controls
00711     // dropdown on the event of a suitable keypress
00712     static BOOL CloseDropdown (CWindowID WindowID, CGadgetID Gadget, BOOL CloseVal);
00713 
00714     // This routine comes in handy when we create a modal dialog box. If any modeless dialogs
00715     // exist then they need disabling. a modal dialog only disables its parent ! (Learnt from MSDN)
00716     static void EnableAllDialogs(BOOL Enable, wxWindow *pExceptMe = NULL); 
00717 
00718     // Functions to Save and restore the active dialog state
00719     static BOOL RecordActiveDialogState();
00720     static void  RestoreActiveDialogState();
00721 
00722     // functions to access property pages
00723     static CDlgResID GetActivePage(CWindowID WindowID, CGadgetID Gadget = 0);
00724     void SetPropertyPageModified(BOOL Value);
00725 
00726     // adds the control to the dialog helper class
00727     static BOOL AddDialogControlToHelper(CWindowID WindowID, CGadgetID Gadget);
00728     static BOOL RemoveDialogControlFromHelper(CWindowID, CGadgetID);
00729 
00730     static BOOL GetStatusLineText(String_256* ptext, CWindowID window);
00731     static CWindowID GetWindowUnderPointer(WinCoord * wc = NULL);
00732 
00733 public:
00734     // Setting up and killing timer events for dialog boxes
00735     static UINT32 SetTimer(DialogOp *pDialogOp, CWindowID WindowID, UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *) = NULL, void * param=NULL, BOOL OneShot=FALSE);
00736     static BOOL KillTimer( DialogOp * pDialogOp, CWindowID WindowID, INT32 nIDEvent);
00737 
00738     // Get and set the position of a window or a gadget
00739     static BOOL GetWindowPosition(CWindowID WindowID, wxRect *pRect);
00740     static BOOL GetWindowPosition(CWindowID WindowID, RECT *pRect);
00741     static BOOL GetGadgetPosition(CWindowID WindowID, CGadgetID Gadget, wxRect *pRect);
00742     static BOOL GetGadgetPosition(CWindowID WindowID, CGadgetID Gadget, RECT *pRect);
00743     static BOOL SetWindowPosition(CWindowID WindowID, const wxRect &Rect);
00744     static BOOL SetWindowPosition(CWindowID WindowID, const RECT &Rect);
00745     static BOOL SetGadgetPosition(CWindowID WindowID, CGadgetID Gadget, const wxRect &Rect);
00746     static BOOL SetGadgetPosition(CWindowID WindowID, CGadgetID Gadget, const RECT &Rect);
00747 
00748     static INT32 GetScreenDpi();
00749     static BOOL GetScreenSize(INT32 * pWidth, INT32 * pHeight);
00750 
00751 private:
00752     static void DeletePropShtDetails(DialogTabOp* pOp);
00753 
00754     // Merges two dialog resources together
00755     static DLGTEMPLATE *MergeDialog( /*HINSTANCE MainInst, */  CDlgResID Main, 
00756                                      /*HINSTANCE OtherInst, */ CDlgResID Other );
00757     
00758     static void SetGadgetIDToFocus(wxWindow *pDialogWnd);
00759     static List *GetControlList( CWindowID );
00760     static void DeleteControlList( CWindowID );
00761     
00762     // Helper functions for merging dialogs.
00763     static LPWSTR MovePastWideStr(LPWSTR pWideStr);
00764     static size_t SizeDlgHeader(DLGTEMPLATE *pHeader);
00765     static size_t SizeCtrlData(DLGITEMTEMPLATE *pData);
00766 
00767     // DiscardStrList holds a pointer to all strings which must be deleted after the dialog 
00768     // has been deleted. 
00769     static List DiscardStrList; 
00770     
00771     // Stores a list of the DialogPositions of all dialogs which have ever been created using the
00772     // Dialog Manager. Initially when a dialog is created the dialog is positioned centrally 
00773     // on the display. When the dialog is destroyed its position is recorded so that if it is 
00774     // ever created again it can have its position restored. 
00775     static List DialogPositionList; 
00776                             
00777     // The ScrollPageIncList holds a list of all scroll bars along with their page increment 
00778     // values which are specified by the SetGadgetRange function.                         
00779     static List ScrollPageIncList;  
00780 
00781     static wxPropertySheetDialog* GetPropertySheetFromOp( DialogTabOp* pDialogTabOp );
00782     
00783     static BOOL HandleScrollBarMsg(wxWindow *pScrollWnd, 
00784                                                   UINT32 wParam, 
00785                                                   INT32 lParam,   
00786                                                   WORD CurrentThumbPos);
00787 
00788     static DialogPosition* FindDialogPositionRecord(CDlgResID DialogID);
00789 
00790                                                   
00791     // -------------------------------------------------------------------------------------
00792     //Control subclass procs
00793       
00794     // Proc to enable edit controls to restrict their range of valid characters
00795     static INT32 FAR PASCAL EXPORT ValidateEditGadgetProc(wxWindow *pwnd, 
00796                                                          UINT32 message, 
00797                                                          UINT32 wParam, 
00798                                                          INT32 lParam); 
00799                              
00800     // Proc to enable a control to react to a right mouse button click                              
00801     static INT32 FAR PASCAL EXPORT RgtMouseButtonProc(wxWindow *pwnd, 
00802                                                      UINT32 message, 
00803                                                      UINT32 wParam, 
00804                                                      INT32 lParam); 
00805 
00806     static UINT32 MsgDragList; // Drag list message as used by the Drag list box common control
00807     static UINT32 MsgSlaveDrawItem; // Used to field WM_DRAWITEM messages back to the controls which need them
00808 //  static ATOM GetListAtom;
00809 
00810     static BOOL CustomControlMsg(wxWindow *pwnd, UINT32 wParam, INT32 lParam);
00811 
00812 private:
00813     // The ActiveDialogStack is used to restore previously active dialogs after a Modal dialog
00814     // is closed.
00815     static ActiveDlgStateStack ActiveDlgStack;
00816 
00817 
00818 protected:
00819     // Now our event handlers
00820     static void Event (DialogEventHandler *pEvtHandler, wxEvent &event);
00821 
00822     static void EnsurePanePreferenceDeclared(wxString key);
00823     static void InitPaneInfoHash();
00824     static void LoadPaneInfo(wxString key, wxAuiPaneInfo &paneinfo);
00825     static void SavePaneInfo(wxString key, wxAuiPaneInfo &paneinfo);
00826     static IdToSerializedPaneInfo * s_pPaneInfoHash;
00827 
00828 public:
00829     static void FreePaneInfoHash();
00830 };         
00831 
00832 
00833 
00834 
00835 
00836 /********************************************************************************************
00837 
00838 >   class ScrollPageInc : public ListItem
00839 
00840     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00841     Created:    6/9/93
00842     Purpose:    ScrollPageInc records the number of units a scroll bars thumb should move 
00843                 for a page up or down scrollbar action. A ScrollPageInc is created and added 
00844                 to the DialogManager's ScrollPageIncList whenever the 
00845                 DialogManager::SetGadgetRange is called for a scrollbar or trackbar control. 
00846                 
00847     SeeAlso:    DialogManager
00848 
00849 ********************************************************************************************/
00850                        
00851 class ScrollPageInc: public ListItem
00852 {  
00853 public: 
00854     wxWindow           *pDlgWindow;    // The dialog's window 
00855     wxWindow           *pScrollBarWnd; // The scroll bars window
00856     INT32                   PageInc;       // Scroll bar page up/down unit increase
00857 };
00858 
00859 
00860 
00861 /********************************************************************************************
00862 
00863 >   class DlgDiscardString: public ListItem
00864 
00865     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00866     Created:    6/9/93
00867     Purpose:    This simple class holds a pointer to a string which must be deleted when a 
00868                 dialog is deleted. 
00869     SeeAlso:    DialogManager
00870 
00871 ********************************************************************************************/
00872 
00873 class DlgDiscardString: public ListItem
00874 {                         
00875 public:
00876     wxWindow           *DlgWindow; 
00877     StringBase         *pStr; 
00878 };                 
00879 
00880 
00881 
00882 /********************************************************************************************
00883 
00884 >   class ControlInfo: public ListItem
00885 
00886     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00887     Created:    6/9/93
00888     Purpose:    A list of  ConrolInfo ListItem's are stored 'in' a dialog box. They are used 
00889                 to store information which is required in a subclassed controls proc. Currently
00890                 Edit controls and Button controls create a ControlInfo item when they 
00891                 are subclassed.  
00892     SeeAlso:    DialogManager
00893 
00894 ********************************************************************************************/
00895 
00896 class ControlInfo: public ListItem
00897 {      
00898 public:   
00899     ~ControlInfo();   
00900     wxWindow *pControlWnd;      // The windows control (Identifier)
00901     UINT32 IDSValidCh;      // Resource ID of the valid characters allowed in an edit control
00902     FARPROC lpfnOldProc;  // Pointer to the old proc of the control before it was subclassed
00903                           // this is generally called at the end of the new proc. 
00904 };           
00905 
00906 
00907                                       
00908 /********************************************************************************************
00909 
00910 >   class CWindowIDItem: public ListItem
00911 
00912     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00913     Created:    11/10/93
00914     Purpose:    A very simple class which contains a CWindowID. A list of CWindowIDItems are 
00915                 stored in the DialogPosition list.   
00916     SeeAlso:    DialogPosition
00917 
00918 ********************************************************************************************/
00919                                     
00920 class CWindowIDItem: public ListItem
00921 {                 
00922     public:
00923     CWindowID DlgWin; // Dialog window
00924 }; 
00925 
00926 
00927 
00928 
00929 
00930 #endif      // !INC_DLGMGR

Generated on Sat Nov 10 03:48:23 2007 for Camelot by  doxygen 1.4.4