DialogManager Class Reference

#include <dlgmgr.h>

Inheritance diagram for DialogManager:

CCObject SimpleCCObject List of all members.

Public Member Functions

 DialogManager ()
 DialogManager constructor. It allocates our special Property atom.
CWindowID Create (DialogOp *DialogOp)
 ~DialogManager ()
 DialogManager destructor.
void SetPropertyPageModified (BOOL Value)
 Sets the modified property of the currently active property page of the current tabbed dialog (if it exists).

Static Public Member Functions

static BOOL Create (DialogOp *DlgOp, CDlgResID MainDlgID, CDlgResID SubDlgID, CDlgMode Mode=MODELESS, INT32 OpeningPage=-1, CWindowID ParentWnd=NULL)
static void Open (CWindowID WindowID, DialogOp *DlgOp)
static void Close (CWindowID WindowID, DialogOp *DlgOp)
 The close method removes a modeless dialog from the display but keeps all system resources associated with it. It hides the dialog. It can be called on a modal dialog but it does nothing.
static BOOL MergeDialogs (CWindowID Dialog, CWindowID Mergee, bool fAbove)
 This function places the contents of a dialog above or below the contents of an existing dialog.
static BOOL BringToTop (CWindowID WindowID, DialogOp *pDlgOp)
 This function brings an open dialog to the top of the z-order.
static wxBookCtrlBase * GetBookControl (CWindowID WindowID, CGadgetID Gadget=0)
 This function will return a pointer to the book control in a window. If the window is of type wxPropertySheetDialog then it Gadget is not required.
static BOOL IsGadgetTickable (CWindowID WindowID, CGadgetID Gadget)
 Determines if the gadget is of a type that can be ticked.
static BOOL ColourPickerAbort (CWindowID WindowID, CGadgetID Gadget, WPARAM wParam=0)
 Instructs camelots custom colour control (which I also wrote) to 'shutdown' and (indirectly) return control to the colour editor dialog.
static void Delete (CWindowID WindowID, DialogOp *DlgOp)
 The delete method will delete all system resources and other information which is kept about the dialog. It also records the dialogs current position so that it can be restored the next time the dialog is created.
static void ProcessMouseEvent (CDlgMessage DialogMessageType, wxWindow *pDlg, UINT32 wParam, INT32 lParam)
static wxWindow * GetGadget (CWindowID WindowID, CGadgetID Gadget)
static OpDescriptorGetGadgetOpDescriptor (CWindowID WindowID, CGadgetID Gadget)
static BOOL SetUnitGadgetValue (CWindowID WindowID, CGadgetID Gadget, UnitType Unit, MILLIPOINT value, BOOL EndOfList=TRUE, INT32 ListPos=0)
 Send custom WM_SETBITMAPEX message to custom controls This method is used to set a gadget which should hold a number to a certain value. The actual type of the gadget does not matter.
static BOOL SetDimensionUnitGadgetValue (CWindowID WindowID, CGadgetID Gadget, UnitType units, double value, Node *pNode, BOOL IncludeUnitSpecifier=TRUE, BOOL EndOfList=FALSE, INT32 ListPos=0)
 as SetDimensionGadgetValue() but you can specify the units in which it is displayed
static BOOL SetLongGadgetValue (CWindowID WindowID, CGadgetID Gadget, INT32 value, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This function is used to set a numeric gadget value. It performs different functions depending on the type of the gadget.
static BOOL SetDoubleGadgetValue (CWindowID WindowID, CGadgetID Gadget, double value, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This function is used to set a numeric gadget value. It performs different functions depending on the type of the gadget.
static BOOL SetStringGadgetValue (CWindowID WindowID, CGadgetID Gadget, UINT32 IDStrID, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This function is used to set a gadgets value to a resource string. It can only be used on gadgets with a string value type.
static BOOL SetStringGadgetValue (CWindowID WindowID, CGadgetID Gadget, const StringBase &StrVal, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This function is used to set a gadgets string value. It can only be used on gadgets with a string value type.
static BOOL SetCustomComboGadgetValue (CWindowID WindowID, CGadgetID Gadget, CustomComboBoxControlDataItem *TheItem, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This function is used to set a CustomComboBoxes item (i.e. basically insert another item).
static BOOL SelectCustomComboGadgetValueOnString (CWindowID WindowID, CGadgetID Gadget, StringBase *StrVal)
 This function is used to select an item (StrVal) within cc_2dBitmapComboBoxEdit custom comboboxes.
static BOOL SetGadgetRange (CWindowID WindowID, CGadgetID Gadget, INT32 Min, INT32 Max, INT32 PageInc=1)
 For setting the range of a gadget.
static BOOL SetListBoxSelection (CWindowID WindowID, CGadgetID Gadget, INT32 Index, BOOL SelectIt, BOOL SingleSelection)
 For selecting the Value specified by Index in a list Gadget. A subroutine used by the selection-setting DialogManager calls.
static BOOL SetBoolGadgetSelected (CWindowID WindowID, CGadgetID Gadget, BOOL IsSelected, INT32 ListPos=0)
 For setting the selection state of a gadget, or an item within a list gadget.
static BOOL SetSelectedValueIndex (CWindowID WindowID, CGadgetID Gadget, INT32 Index)
 For selecting the Value specified by Index in a list Gadget.
static BOOL SetSelectedValueRange (CWindowID WindowID, CGadgetID Gadget, WORD StartIndex, WORD EndIndex, BOOL Selected=TRUE)
 For selecting the Value specified by Index in a list Gadget.
static BOOL SetDimensionGadgetValue (CWindowID WindowID, CGadgetID Gadget, MILLIPOINT value, Node *pNode, BOOL IncludeUnitSpecifier=TRUE, BOOL EndOfList=FALSE, INT32 ListPos=-1)
 This is the routine to call for displaying a node's dimension in a control. It creates a string that represents 'Value' in the units the user wants, possibly scaled up/down if the user has specified a dimension scaling factor (e.g. 1 mile = 2 cm) Once the string is created, SetStringGadgetValue is called on the control, so you should be aware of this routine's features/limitations before calling SetDimensionGadgetValue.
static BOOL SetMemoryGadgetValue (CWindowID WindowID, CGadgetID Gadget, UINT32 value, BOOL EndOfList=TRUE, INT32 ListPos=0)
 This method is used to set a gadget which should display an amount of memory being used or allocated. The value will be rounded to the nearest K or M or G byte value. The actual type of the gadget does not matter.
static BOOL SetGadgetHelp (CWindowID WindowID, CGadgetID Gadget, UINT32 BubbleID, UINT32 StatusID, UINT32 ModuleID=0)
 Allows the Bubble and Status ID's of a control to be changed at runtime.
static MILLIPOINT GetUnitGadgetValue (CWindowID WindowID, CGadgetID Gadget, UnitType DefaultType, MILLIPOINT StartRange, MILLIPOINT EndRange, UINT32 IDSInvalidMsg=0, BOOL *Valid=NULL)
 This function will obtain the gadget value and validate it. Validation will check that data has been entered in a correct unit type, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.
static INT32 GetLongGadgetValue (CWindowID WindowID, CGadgetID Gadget, INT32 StartRange, INT32 EndRange, UINT32 IDSInvalidMsg=0, BOOL *Valid=NULL, Convert::PFNSTRINGTOINT32 pfnParser=Convert::StringToLong)
 This function will obtain the gadget value and validate it. Validation will check that a correct INT32 value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.
static double GetDoubleGadgetValue (CWindowID WindowID, CGadgetID Gadget, double StartRange, double EndRange, UINT32 IDSInvalidMsg=0, BOOL *Valid=NULL, Convert::PFNSTRINGTODOUBLE pfnParser=Convert::StringToDouble)
 This function will obtain the gadget value and validate it. Validation will check that a correct double value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.
static BOOL GetBoolGadgetSelected (CWindowID WindowID, CGadgetID Gadget, UINT32 IDSInvalidMsg=0, BOOL *Valid=NULL, INT32 ListPos=0)
 This function will obtain the gadget value and validate it. Validation will check that a correct INT32 value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value. [This does not seem correct - AMB].
static String_256 GetStringGadgetValue (CWindowID WindowID, CGadgetID Gadget, BOOL *Valid=NULL, INT32 ListPos=-1)
 For finding a gadgets string value. This function can only be used for gadgets with a text value.
static BOOL GetGadgetRange (CWindowID WindowID, CGadgetID Gadget, INT32 *Min, INT32 *Max)
 For obtaining the range of a gadget.
static MILLIPOINT GetDimensionGadgetValue (CWindowID WindowID, CGadgetID Gadget, Node *pNode, BOOL *Valid=NULL, INT32 ListPos=-1)
 This is the routine to call for getting user-entered dimensions from a control. The value is scaled from user dimensions to an internal millipoint value. The routine uses DialogManager::GetStringGadgetValue to extract the string from the control. The caller should be aware of the features/limitations of this routine before calling GetDimensionGadgetValue.
static BOOL GetDoubleAndUnitGadgetValue (double *pMPValue, double *pUnitValue, UnitType *pUnitType, CWindowID WindowID, CGadgetID Gadget, Node *pNode)
 Read the value from a gadget as a double millipont values accounting for unit scaling ALSO read the type of unit specified and the gadget value in terms of these units ie 0.5m would return 36000.0, 0.5 and METERS (assuming scaling 1m->1in).
static UINT32 GetMemoryGadgetValue (CWindowID WindowID, CGadgetID Gadget, UINT32 StartRange, UINT32 EndRange, UINT32 IDSInvalidMsg=0, BOOL *Valid=NULL)
 This function allows a memory value to be read back from a control. It will cope with the memory being specified in bytes, K, M or G bytes and will also validate it. Validation will check that data has been entered in a correct unit type, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.
static BOOL DeleteAllValues (CWindowID WindowID, CGadgetID Gadget)
 For deleting all values in a list-gadget.
static BOOL DeleteValue (CWindowID WindowID, CGadgetID Gadget, BOOL EndOfList=TRUE, INT32 ListPos=0)
 For deleting a gadget value.
static BOOL GetValueCount (CWindowID WindowID, CGadgetID Gadget, INT32 *Count)
 For finding the number of values stored in a gadget.
static BOOL GetValueIndex (CWindowID WindowID, CGadgetID Gadget, INT32 *Index)
 For finding the index of the currently selected item in a gadget.
static BOOL GetValueIndex (CWindowID WindowID, CGadgetID Gadget, WORD *Index)
 For finding the index of the currently selected item in a gadget.
static INT32 GetSelectedCount (CWindowID WindowID, CGadgetID Gadget)
 Returns the number of selected items in a list-type gadget.
static INT32 GetFirstSelectedItem (CWindowID WindowID, CGadgetID Gadget)
 Returns the index of the first selected item in a list-type gadget.
static INT32 * GetSelectedItems (CWindowID WindowID, CGadgetID Gadget)
 Returns a ptr to an INT32 array that holds the list of selected indexes. The last array entry contains -1.
static BOOL EnableGadget (CWindowID WindowID, CGadgetID Gadget, BOOL Enabled)
 For enabling/disabling a gadget.
static BOOL IsGadgetEnabled (CWindowID WindowID, CGadgetID Gadget)
 For checking if a gadget is enabled/disabled.
static BOOL SetGadgetWritable (CWindowID id, CGadgetID Gadget, BOOL enable)
 Sets the state of the 'Read Only' flag of an edit field or combo box.
static BOOL HideGadget (CWindowID WindowID, CGadgetID Gadget, BOOL Hide)
 For hiding/showing gadgets.
static BOOL GadgetRedraw (CWindowID WindowID, CGadgetID Gadget, BOOL Redraw)
 This function sets a gadgets redraw state. If Redraw = FALSE then the gadget will not be redrawn when changes are made to it. Conversely if Redraw = TRUE then the Gadget will redraw itself after any changes are made.
static void Layout (CWindowID WindowID, BOOL CanYield=FALSE)
 Relayout dialog - for sizer changes.
static void RelayoutDialog (DialogTabOp *DlgOp)
 Force the dialog to relayout after control hide Scope: public.
static BOOL SetKeyboardFocus (CWindowID WindowID, CGadgetID Gadget)
 Sets the keyboard focus to the given control.
static BOOL DefaultKeyboardFocus ()
 Sets the keyboard focus to the "default" window, which currently is the main frame window (which in turn sets it to the active view window).
static BOOL HighlightText (CWindowID WindowID, CGadgetID Gadget, INT32 nStart=0, INT32 nEnd=-1)
 Highlights the given range of text (by default all of it) within a control that holds editable text, eg. an edit field.
static BOOL CaptureMouse (CWindowID WindowID, CGadgetID Gadget)
 Allows the given control to Capture the mouse.
static BOOL ReleaseMouse (CWindowID WindowID, CGadgetID Gadget)
 Release the mouse captured by the given control.
static void PaintGadgetNow (CWindowID WindowID, CGadgetID gid)
 Immediate paints any invalid areas of the given control (like the Windows "UpdateWindow" function).
static void InvalidateGadget (CWindowID WindowID, CGadgetID Gadget, BOOL EraseBackround=TRUE)
 Invalidates the control so that it will be repainted soon.
static void InvalidateGadget (CWindowID WindowID, CGadgetID Gadget, ReDrawInfoType *ExtraInfo, DocRect *InvalidRect)
 Causes the Dialog Manager to tell the host os to get the cc_DialogDraw gadget to be redrawn, over the specfied rectangle. You should recieve a DIM_REDRAW message in the not too distant future.
static void ScrollKernelRenderedGadget (CWindowID WindowID, CGadgetID Gadget, DocRect *RectToScroll, DocCoord *ScrollBy)
 Causes the Dialog Manager to tell the host os to get the cc_DialogDraw gadget to be scrolled, over the specfied rectangle. You should recieve a DIM_REDRAW message in the not too distant future, to update any portions that 'scroll into view'.
static BOOL GetKernelRenderedGadgetInfo (CWindowID WindowID, CGadgetID Gadget, ReDrawInfoType *Result)
 Allows the user access to the same information which is passed in to DIM_REDRAW and the kernel-rendered-dialogue mouse-handling messages. This is just for convenience so they can calculate stuff at a time other than handling those two types of dialogue event (e.g. if a document message causes you to have to redraw a small portion of your gadget, you need this information to calculate the invalidation rectangle from).
static void SetEditGadgetType (CWindowID WindowID, CGadgetID Gadget, EditGadgetType Type)
 Subclasses the edit gadget so that it only accepts characters specified by the Type parameter.
static void SetEditGadgetType (CWindowID WindowID, CGadgetID, UINT32 IDSValidChar)
 To subclass the edit gadget so that it only accepts characters in the string specified by IDSValidChar.
static void DualFunctionButton (CWindowID DialogWnd, CGadgetID ButtonGadget)
 To subclass the button gadget so that it accepts right mouse button clicks.
static BOOL MakeListBoxDragable (CWindowID WindowID, CGadgetID Gadget)
static void SetComboListLength (CWindowID WindowID, CGadgetID Gadget)
static void SetGadgetBitmaps (CWindowID DialogWnd, CGadgetID Gadget, UINT32 Bitmap1, UINT32 Bitmap2)
 This function will set the bitmaps associated with a gadget.
static void SetGadgetBitmaps (CWindowID DialogWnd, CGadgetID Gadget, const CGadgetImageList &images)
 This function will set the bitmaps associated with a gadget.
static void SetGadgetBitmap (CWindowID WindowID, CGadgetID Gadget, ResourceID Bitmap)
 This function will set the bitmaps associated with a gadget.
static ResourceID GetGadgetBitmap (CWindowID WindowID, CGadgetID Gadget)
 This function will get the bitmaps associated with a gadget.
static void SetBitmapButtonIndexes (CWindowID WindowID, CGadgetID Gadget, UINT32 UnselectedIndex, UINT32 SelectedIndex)
 This function allows you to specify bitmaps for both the selected and unselected states of a bitmap button. Most likely you have already selected your bitmap for the selected state in your resource file, however this allows you to specify the unselected state also.
static UINT32 GetGadgetImageCount (CWindowID wnd, CGadgetID Gadget)
 To get the number of images set in the trree control.
static void DeInit ()
 Deinitialise the DialogManager.
static BOOL IsADialogWindow (wxWindow *pWnd)
 To determine if hwnd is the handle of a dialog.
static CTreeItemID SetTreeGadgetItem (CWindowID wnd, CGadgetID Gadget, CTreeItemID hParent, const StringBase &str, CTreeItemID hInsAfter, INT32 iImage, CCObject *pObj=NULL)
 To insert an item into a tree control.
static CCObjectGetTreeGadgetItemData (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem)
 To insert an item into a tree control.
static BOOL SelectTreeGadgetItem (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem, BOOL bNewState=TRUE)
 To select an item in a tree control.
static CTreeItemID GetTreeGadgetRootItem (CWindowID wnd, CGadgetID Gadget)
 To get the ID of the root item in the tree control.
static CTreeItemID GetTreeGadgetFirstSelectedItem (CWindowID wnd, CGadgetID Gadget)
 To get the ID of the first selected item in the tree control.
static BOOL TreeGadgetExpandItem (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem)
 To expand an item in the tree control.
static CTreeItemID GetTreeGadgetNextVisItem (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem)
 To get the ID of the next visible item in the tree control after a specified item.
static CTreeItemID GetTreeGadgetFirstChildItem (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem)
 To get the ID of the first child item of the specified in the tree control.
static UINT32 GetTreeGadgetChildrenCount (CWindowID wnd, CGadgetID Gadget, CTreeItemID hItem, BOOL bRecursive=FALSE)
 To get the number of children of an item in a tree control.
static BOOL AddAPage (DialogTabOp *pDialogTabOp, CDlgResID DialogResID, CGadgetID Gadget=0)
 Adds a page to the tabbed dialog with resource ID DialogResID.
static CWindowID GetPageWindow (CWindowID Win, CDlgResID PageID, INT32 *PageIndex=NULL)
 Returns the Window ID of a page within a property sheet. If the page is NULL then Win is simply returned, It can be called on a non property sheet dialog. Just pretend that they are property sheets without any pages.
static BOOL SetTitlebarName (CWindowID Win, String_256 *Name)
 Sets the titlebar text of the dialog.
static BOOL ModalDialogOpen (DialogOp **pModal=NULL)
 To determine if there is currently an open modal dialog.
static BOOL IsWindowVisible (CWindowID Win)
 To test the visibility of Win.
static BOOL IsCustomComboDropdownVisible (CWindowID WindowID, CGadgetID Gadget)
 To test the visibility of WinID's dropdown.
static BOOL CloseDropdown (CWindowID WindowID, CGadgetID Gadget, BOOL CloseVal)
 Used to close the controls dropdown. This routine was written because of the amount of trouble that I was experiencing with my custom controls down to escape key processing (which is viewed as a hotkey within camelot).
static void EnableAllDialogs (BOOL Enable, wxWindow *pExceptMe=NULL)
 Enables or Disables all Dialogs on the DialogOp message handler list. This is useful when opening/closing modal dialogs.
static BOOL RecordActiveDialogState ()
 This function will get called before a MODAL dialog is opened. It records which window is currently active, and if the window is a MODAL dialog. After a MODAL dialog is closed RestoreActiveDialogState is called to restore the active window.
static void RestoreActiveDialogState ()
 This function is called after a MODAL dialog is closed. it restores the Active window.
static CDlgResID GetActivePage (CWindowID WindowID, CGadgetID Gadget=0)
 To find out the currently active page in a tabbed dialog.
static BOOL AddDialogControlToHelper (CWindowID WindowID, CGadgetID Gadget)
 To add this control to the static dialog control helper, which will subclass it.
static BOOL RemoveDialogControlFromHelper (CWindowID, CGadgetID)
 To add this control to the static dialog control helper, which will subclass it.
static BOOL GetStatusLineText (String_256 *ptext, CWindowID window)
 Fills in the status line text from the help text if over a control Scope: Public.
static CWindowID GetWindowUnderPointer (WinCoord *wc=NULL)
 Fills in the status line text from the help text if over a control Scope: Public.
static UINT32 SetTimer (DialogOp *pDialogOp, CWindowID WindowID, UINT32 nIDEvent, UINT32 nElapse, void(*lpfnTimer)(void *)=NULL, void *param=NULL, BOOL OneShot=FALSE)
 Allows the user access to setting a timer caller back or event for a dialog box. The caller can either specify a call back procedure to be called when the timer goes off or if null is specified, a DIM_TIMER message will be sent. This maps onto the Windows API/CWnd call. The return value is effectively the handle onto the timer system. It must be passed to the KillTimer member function to kill the timer. A Nonzero value indicates successful allocation of the timer; non-zero implies a problem.
static BOOL KillTimer (DialogOp *pDialogOp, CWindowID WindowID, INT32 nIDEvent)
 Allows the user access to killing a timer caller back or event that has been set up for a dialog box. Kills the timer event identified by nIDEvent from the earlier call to SetTimer. Any pending WM_TIMER messages associated with the timer are removed from the message queue.
static BOOL GetWindowPosition (CWindowID WindowID, wxRect *pRect)
 Allows the user to get the current window position.
static BOOL GetWindowPosition (CWindowID WindowID, RECT *pRect)
static BOOL GetGadgetPosition (CWindowID WindowID, CGadgetID Gadget, wxRect *pRect)
 Allows the user to get the current position of the specified gadget or icon.
static BOOL GetGadgetPosition (CWindowID WindowID, CGadgetID Gadget, RECT *pRect)
static BOOL SetWindowPosition (CWindowID WindowID, const wxRect &Rect)
 Allows the user to set the current window position.
static BOOL SetWindowPosition (CWindowID WindowID, const RECT &Rect)
static BOOL SetGadgetPosition (CWindowID WindowID, CGadgetID Gadget, const wxRect &Rect)
 Allows the user to set the current position of the specified gadget or icon.
static BOOL SetGadgetPosition (CWindowID WindowID, CGadgetID Gadget, const RECT &Rect)
static INT32 GetScreenDpi ()
 Allows the user to find out the screen dpi.
static BOOL GetScreenSize (INT32 *pWidth, INT32 *pHeight)
 Allows the user to find out the screen size.
static void FreePaneInfoHash ()
 Free the pane info hash if it exists Scope: protected.

Static Public Attributes

static wxWindow * pDlgCurrent = NULL

Static Protected Member Functions

static void Event (DialogEventHandler *pEvtHandler, wxEvent &event)
 OnCommand message handler. Translates a windows Command message into a DIM.
static void EnsurePanePreferenceDeclared (wxString key)
 Ensures the relevant preference has been declared Scope: protected.
static void InitPaneInfoHash ()
 Initializes the pane info hash if it has not been previously initialized Scope: protected.
static void LoadPaneInfo (wxString key, wxAuiPaneInfo &paneinfo)
 Loads the pane info structure from the hash Scope: protected.
static void SavePaneInfo (wxString key, wxAuiPaneInfo &paneinfo)
 Saves the pane info structure to the hash Scope: protected.

Static Protected Attributes

static IdToSerializedPaneInfo * s_pPaneInfoHash = NULL

Static Private Member Functions

static void CreateRecursor (wxWindow *pwxWindow)
 Initialize platform dependent resources.
static BOOL CreateBar (DialogBarOp *DlgOp)
 Handles the creation of a bar Scope: private.
static BOOL CreateTabbedDialog (DialogTabOp *pTabDlgOp, CDlgMode Mode, INT32 OpeningPage, CDlgResID MainDlgID)
 Handles the creation of a tabbed dialog Opening page allows a page to be specified that is not the initial page, which will be the default if this is the first time the dialog has been opened or if it has been opened before then the initial page will be the last one opened. Scope: private.
static BOOL PostCreate (DialogOp *pDialogOp, INT32 OpeningPage)
 This function will get called after a dialog has been created. If a modeless dialog has been created then it gets called directly from the Create method. For a modal dialog however it gets called after receiving a WM_INIT_DIALOG message. It completes the creation process.
static void DeletePropShtDetails (DialogTabOp *pOp)
static DLGTEMPLATEMergeDialog (CDlgResID Main, CDlgResID Other)
 Merge two dialogs together into one dialog template. The return value points to the new merged dialog, which the caller should pass to CreateDialogIndirect(). Once the dialog has been created using this block, CCFree() should be called on the block to return it to the system pool. The significance of the 'Main' and 'Other' names is that the dialog style (border, menuname, classname, title and font) is taken from 'Main' - the header of 'Other' is discarded.
static void SetGadgetIDToFocus (wxWindow *pDialogWnd)
 If a child control of the dialog window has the focus then the function sets the Gadget to the ID of this control.
static ListGetControlList (CWindowID)
 Hide the mechanism we use to attach our lists to various windows. In fact we use window properties.
static void DeleteControlList (CWindowID)
 Deletes the Properties that are used to store the ControlList. Should be called as the very last thing before the Window is vaped e.g. in response to a WM_DESTROY message. Destroying it earlier will cause GetControlList to return NULL which proves fatal within the various message handlers. Scope: Private, static.
static LPWSTR MovePastWideStr (LPWSTR pWideStr)
 Given a ptr to the first byte in a wide string (or char string if win16) return a ptr to the byte past the null.
static size_t SizeDlgHeader (DLGTEMPLATE *pHeader)
 Given a ptr to DIALOGBOXHEADER, return its size.
static size_t SizeCtrlData (DLGITEMTEMPLATE *pData)
 Given a ptr to a controldata struct, return its length. Under Win32, all strings are UniCode (as they are in the res file).
static wxPropertySheetDialog * GetPropertySheetFromOp (DialogTabOp *pDialogTabOp)
static BOOL HandleScrollBarMsg (wxWindow *pScrollWnd, UINT32 wParam, INT32 lParam, WORD CurrentThumbPos)
static DialogPositionFindDialogPositionRecord (CDlgResID DialogID)
 Searches the DialogPositionList to see if this dialog has been created before if it has then a pointer to its DialogPosition record is returned, else NULL is retuned. Scope: private.
static INT32 FAR PASCAL EXPORT ValidateEditGadgetProc (wxWindow *pwnd, UINT32 message, UINT32 wParam, INT32 lParam)
 subclassed edit control proc
static INT32 FAR PASCAL EXPORT RgtMouseButtonProc (wxWindow *pwnd, UINT32 message, UINT32 wParam, INT32 lParam)
 subclassed button control proc
static BOOL CustomControlMsg (wxWindow *pwnd, UINT32 wParam, INT32 lParam)
 Handles custom control messages.

Static Private Attributes

static List DiscardStrList
static List DialogPositionList
static List ScrollPageIncList
static UINT32 MsgDragList
static UINT32 MsgSlaveDrawItem
static ActiveDlgStateStack ActiveDlgStack

Friends

class DialogEventHandler
class wxPropertySheetDialog

Detailed Description

Definition at line 330 of file dlgmgr.h.


Constructor & Destructor Documentation

DialogManager::DialogManager  ) 
 

DialogManager constructor. It allocates our special Property atom.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/12/93

Definition at line 192 of file dlgmgr.cpp.

00193 {
00194     // we must use a unique string so we don't clash with anyone else
00195 }

DialogManager::~DialogManager  ) 
 

DialogManager destructor.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/9/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogManager::DeInit

Definition at line 6428 of file dlgmgr.cpp.

06429 {
06430 }


Member Function Documentation

BOOL DialogManager::AddAPage DialogTabOp pDialogTabOp,
CDlgResID  DialogResID,
CGadgetID  Gadget = 0
[static]
 

Adds a page to the tabbed dialog with resource ID DialogResID.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/94
Parameters:
pDialogTabOp,: The operation we wish to add a page too [INPUTS] DialogResID: The resource ID of the dialog page we wish to add to the DialogTabOp Gadget The gadget of the book control to add the page to (or zero to take a good guess)
- [OUTPUTS]
Returns:
TRUE if the page was added successfully.

Errors: -

See also:
-

Definition at line 7003 of file dlgmgr.cpp.

07004 {
07005     // Try to add the page to the property sheet associated with the DialogTabOp
07006     // let's try and find it
07007     wxBookCtrlBase* pNoteBook = GetBookControl(pDialogTabOp->WindowID, Gadget);
07008 
07009     // We need to create a page object
07010     // Because wxNotebookPage is derived from an MFC object we have to cope with exceptions
07011     wxWindow*   pNewPage;
07012     wxString    ObjectName;
07013     try
07014     {
07015         const TCHAR* pDialogName=CamResource::GetObjectNameFail( DialogResID );
07016         ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
07017         TRACEUSER( "jlh92", _T("Cre tab %s\n"), pDialogName );
07018         ObjectName = pDialogName;
07019 
07020         pNewPage = wxXmlResource::Get()->LoadPanel( pNoteBook, pDialogName );
07021         ERROR1IF(pNewPage == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
07022         pNewPage->SetId( DialogResID );
07023 
07024         CamArtProvider::Get()->EnsureChildBitmapsLoaded( pNewPage );
07025     }
07026     catch( CMemoryException )
07027     {
07028         ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY));
07029     }
07030 
07031     // Just to  be safe
07032     ERROR1IF(pNewPage == NULL, FALSE, _R(IDS_OUT_OF_MEMORY));
07033 
07034     wxString Title = wxEmptyString;
07035     if (pNewPage->IsKindOf(CLASSINFO(wxDialog)))
07036         Title=((wxDialog *)pNewPage)->GetTitle();
07037     if (Title.IsEmpty()) 
07038         Title = pNewPage->GetLabel(); // because wxPanel doesn't seem to support a title
07039     if( Title.IsEmpty() )
07040     {
07041         ResourceID  NameResID = CamResource::GetResourceID( PCTSTR(ObjectName) );
07042         PCTSTR      pszStringLookup = CamResource::GetTextFail( NameResID );
07043         if( NULL != pszStringLookup )
07044         {
07045             Title = pszStringLookup;
07046             TRACEUSER( "jlh92", _T("Page (FST) = \"%s\"\n"), pszStringLookup );
07047         }
07048     }
07049     if( Title.IsEmpty() )
07050     {
07051         // Finally, in desperation, we (mis-)use the tooltip string because now the wx folks have removed
07052         // the label, even though it's needed for accessibility. Aarrghh
07053         wxToolTip* pTip = pNewPage->GetToolTip();
07054         if (pTip) Title=pTip->GetTip();
07055     }
07056 
07057     wxImageList * pImageList = NULL;
07058     wxBitmap b;
07059     // Add images if present
07060     if (pDialogTabOp->HasImages())
07061     {
07062         // Get the image list 
07063         pImageList = pNoteBook->GetImageList();
07064 
07065         wxBitmap * pBitmap = CamArtProvider::Get()->FindBitmap(DialogResID);
07066         if (!pBitmap || (pBitmap==CamArtProvider::Get()->GetMissingBitmap()) || !pBitmap->Ok())
07067         {
07068             TRACEUSER("Phil", _T("Unable to use options tab icon %d\n"), DialogResID);
07069             int /*TYPENOTE: Correct */ w=32;
07070             int /*TYPENOTE: Correct */ h=32;
07071             if (pImageList)
07072                 pImageList->GetSize(0, w, h);
07073             b = wxArtProvider::GetBitmap(wxART_HELP_SETTINGS, wxART_OTHER, wxSize(w, h));
07074         }
07075         else
07076             b= *pBitmap;
07077 
07078         // If there is no image list, create one
07079         if (!pImageList)
07080         {
07081             pImageList = new wxImageList(b.GetWidth(), b.GetHeight());
07082             if (pImageList)
07083                 pNoteBook->AssignImageList(pImageList);
07084         }
07085 
07086     }
07087 
07088     if (pImageList)
07089         pImageList->Add(b);
07090     pNoteBook->AddPage( pNewPage, Title );
07091     if (pImageList)
07092         pNoteBook->SetPageImage(pNoteBook->GetPageCount()-1, pImageList->GetImageCount()-1);
07093 
07094     return true;
07095 }

BOOL DialogManager::AddDialogControlToHelper CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

To add this control to the static dialog control helper, which will subclass it.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/7/2000
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
[OUTPUTS] 
Returns:
TRUE if successful, else FALSE

Definition at line 5103 of file dlgmgr.cpp.

05104 {
05105     // For the time being, we do this by Hide/Unhide
05106     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05107     if (!pGadget) return FALSE;
05108     pGadget->Show(TRUE);
05109     return TRUE;
05110 }

BOOL DialogManager::BringToTop CWindowID  WindowID,
DialogOp pDlgOp
[static]
 

This function brings an open dialog to the top of the z-order.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/6/95
Parameters:
- [INPUTS]
Returns:
FALSE if the function failed.

Definition at line 1087 of file dlgmgr.cpp.

01088 {
01089     ERROR2IF(!WindowID, FALSE, "BringToTop called on a dialog without a window");
01090     ( (wxWindow *)WindowID )->Raise();
01091     if (pDlgOp->pEvtHandler->wxAUImanaged)
01092         CCamFrame::GetMainFrame()->UpdateFrameManager();
01093     return TRUE;
01094 }

BOOL DialogManager::CaptureMouse CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Allows the given control to Capture the mouse.

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/04/97
Parameters:
WindowID ID of the window / dialogue box containing . . . [INPUTS] Gadget ID of the "gadget" (control) to receive the focus
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
DialogManager::DefaultKeyboardFocus; DialogOp::SetKeyboardFocus

Definition at line 5384 of file dlgmgr.cpp.

05385 {
05386     // Set the focus to the control within the given window/dialogue box.
05387     // For the time being, we do this by Hide/Unhide
05388     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05389     if (!pGadget) return FALSE;
05390 
05391     pGadget->CaptureMouse();
05392     return TRUE;
05393 }

void DialogManager::Close CWindowID  WindowID,
DialogOp pDlgOp
[static]
 

The close method removes a modeless dialog from the display but keeps all system resources associated with it. It hides the dialog. It can be called on a modal dialog but it does nothing.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/93
Parameters:
WindowID,: Dialog's window identifier [INPUTS] pDlgOp: The DialogOp
See also:
DialogOp::Close

Definition at line 1017 of file dlgmgr.cpp.

01018 {
01019     // Hide the dialog
01020 
01021     // Determine if we are hiding a bar
01022 PORTNOTE("dialog","Removed DialogBarOp usage")
01023 #ifndef EXCLUDE_FROM_XARALX
01024     if (pDlgOp->IsKindOf(CC_RUNTIME_CLASS(DialogBarOp)))
01025     {
01026         // Find the BaseBar object
01027         wxWindow* pCWnd = CWnd::FromHandlePermanent(WindowID);
01028         ENSURE(pCWnd != NULL, "Could not find bar object");
01029         // Show the bar window
01030         if (pCWnd != NULL)
01031         {
01032             ((BaseBar*)pCWnd)->Hide((DialogBarOp*)pDlgOp);
01033         }
01034     }
01035     else
01036 #endif
01037     if (!(pDlgOp->IsModal())) // The delete method closes a modal dialog
01038     {
01039         ENSURE(WindowID != NULL,"NULL WindowID");
01040         ( (wxWindow *)WindowID )->Show( false );
01041     }
01042 
01043     if (pDlgOp->pEvtHandler->wxAUImanaged)
01044         CCamFrame::GetMainFrame()->UpdateFrameManager();
01045 }

BOOL DialogManager::CloseDropdown CWindowID  WindowID,
CGadgetID  Gadget,
BOOL  CloseVal
[static]
 

Used to close the controls dropdown. This routine was written because of the amount of trouble that I was experiencing with my custom controls down to escape key processing (which is viewed as a hotkey within camelot).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/2/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if things went ok

Errors: -

See also:
-

Definition at line 6956 of file dlgmgr.cpp.

06957 {
06958 PORTNOTE("dialog","Programatic CB drop not supported by wx")
06959     return (TRUE);
06960 }

BOOL DialogManager::ColourPickerAbort CWindowID  WindowID,
CGadgetID  Gadget,
WPARAM  wParam = 0
[static]
 

Instructs camelots custom colour control (which I also wrote) to 'shutdown' and (indirectly) return control to the colour editor dialog.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/1/2000
Parameters:
WindowID,: Dialog's window identifier [INPUTS] Gadget: The colourpicker that this request is made upon (which is checked to ensure that it is a custom colour picker).

Definition at line 1769 of file dlgmgr.cpp.

01770 {
01771     PORTNOTETRACE("dialog","DialogManager::ColourPickerAbort - do nothing");
01772 #ifndef EXCLUDE_FROM_XARALX
01773     // Currently the gadget is only tickable if it is a button
01774     HWND hGadget = GetDlgItem((HWND)WindowID, (INT32)Gadget);
01775     String_256 ClassNameStr;  // The control type
01776 
01777     // Find out the class type of the gadget
01778     GetClassName(hGadget, (TCHAR*)ClassNameStr, 255);
01779 
01780     if (ClassNameStr == String_8(TEXT("cc_colPicker")))
01781     {
01782         BOOL RetVal = FALSE;
01783 
01784         RetVal = SendMessage(hGadget, WM_COLOURPICKERABORT, wParam, 0);
01785 
01786         return (RetVal);
01787     }
01788 
01789     return (TRUE);
01790     ENSURE(FALSE, "Calling ColourPickerAbort for an invalid control");
01791 #endif
01792     return FALSE;
01793 }

CWindowID DialogManager::Create DialogOp DialogOp  ) 
 

BOOL DialogManager::Create DialogOp DlgOp,
CDlgResID  MainDlgID,
CDlgResID  SubDlgID,
CDlgMode  Mode = MODELESS,
INT32  OpeningPage = -1,
CWindowID  ParentWnd = NULL
[static]
 

Definition at line 320 of file dlgmgr.cpp.

00324 {
00325     ERROR2IF(!DlgOp, FALSE, _T("Create Passed Null DialogOp"));
00326     ERROR2IF(DlgOp->pEvtHandler, FALSE, _T("Window has already been created. Having two is greedy"));
00327 
00328     DlgOp->pEvtHandler = new DialogEventHandler(DlgOp);
00329     ERRORIF(!DlgOp->pEvtHandler || !DlgOp->pEvtHandler->pDialogOp, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00330 
00331     BOOL wxAUImanaged = FALSE;
00332     if ( DlgOp->IsABar() || DlgOp->IsAGallery() )
00333     {
00334         BOOL modal = DlgOp->IsModal();
00335         ERROR2IF(modal, FALSE, "Attempting to create a wxAUImanaged Dialog that is modal");
00336         // They wanted a bar. Well, the main difference to us is we let wxAUI manage it.
00337         wxAUImanaged = TRUE;
00338     }
00339 
00340 //  ERROR2IF( DlgOp->IS_KIND_OF(DialogBarOp), FALSE, _T("Bar creation not yet supported"));
00341 //  ERROR2IF( DlgOp->IS_KIND_OF(DialogTabOp), FALSE, _T("Tabbed dialogs not yet supported"));
00342     ERROR2IF( SubDlgID !=0, FALSE, _T("Merging of dialogs not yet supported"));
00343 
00344     // if no parent dialog window specified use the main frame window
00345     if ((ParentWnd == NULL) || wxAUImanaged)
00346         ParentWnd = GetMainFrame();
00347 
00348     const TCHAR*    pDialogName = NULL;
00349     wxWindow*       pDialogWnd = NULL;
00350 
00351     if( DlgOp->IS_KIND_OF(DialogTabOp) && !(((DialogTabOp*)DlgOp)->LoadFrameFromResources()))
00352     {
00353         // ok first try and create the property sheet
00354         wxDynamicPropertySheetDialog* pPropertySheet;
00355 
00356         // error handling done later
00357         pPropertySheet = new wxDynamicPropertySheetDialog();
00358         if (pPropertySheet)
00359         {
00360             pPropertySheet->SetTabType(((DialogTabOp*)DlgOp)->GetTabType());
00361             if (!pPropertySheet->Create((wxWindow *)ParentWnd, wxID_ANY, (TCHAR*) (*((DialogTabOp*)DlgOp)->GetName()) ))
00362             {
00363                 delete pPropertySheet;
00364                 pPropertySheet=NULL; // error handling done below
00365             }
00366             else
00367             {
00368                 wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer();
00369                 wxButton * ok=new wxButton(pPropertySheet, wxID_OK);
00370                 sizer->AddButton(ok); // Add an OK button
00371                 sizer->AddButton(new wxButton(pPropertySheet, wxID_CANCEL)); // Add a Cancel button
00372                 sizer->AddButton(new wxButton(pPropertySheet, wxID_APPLY)); // Add an Apply button
00373                 sizer->AddButton(new wxButton(pPropertySheet, wxID_HELP)); // Add a Help button
00374                 ok->SetDefault();
00375                 ok->SetFocus();
00376                 pPropertySheet->SetAffirmativeId(wxID_OK);
00377                 sizer->Realize();
00378                 pPropertySheet->GetInnerSizer()->Add( sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2);
00379                 pPropertySheet->GetInnerSizer()->AddSpacer(2);
00380             }
00381         }
00382         pDialogWnd=pPropertySheet;
00383     }
00384     else
00385     {
00386         pDialogName=CamResource::GetObjectNameFail(MainDlgID);
00387         ERROR1IF(pDialogName == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00388 
00389 PORTNOTE("dialog","A more general scheme is needed to allow creation of a panel for non-toolbar type dialog")
00390         if (wxAUImanaged || _R(IDD_BITMAPPREVIEWDIALOG) == MainDlgID )
00391             pDialogWnd = wxXmlResource::Get()->LoadPanel((wxWindow *)ParentWnd, pDialogName);
00392         else
00393             pDialogWnd = wxXmlResource::Get()->LoadDialog((wxWindow *)ParentWnd, pDialogName);
00394     }
00395 
00396     ERROR1IF(pDialogWnd == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00397 
00398     pDialogWnd->Hide();
00399     CamArtProvider::Get()->EnsureChildBitmapsLoaded(pDialogWnd);
00400 
00401     // On the Mac, panels etc. are by default transparent; fix them up
00402 #ifdef __WXMAC__
00403     pDialogWnd->SetBackgroundStyle(wxBG_STYLE_COLOUR);
00404     pDialogWnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
00405 #endif
00406 
00407     // Note that we might one day want to create (say) wxPanels, or wxToolbars instead above
00408     // It deosn't matter to us, we just want a wxWindow
00409 
00410     DlgOp->pEvtHandler->pwxWindow = pDialogWnd;
00411     DlgOp->pEvtHandler->wxAUImanaged = wxAUImanaged;
00412     DlgOp->pEvtHandler->ID =MainDlgID;
00413     // Set the DialogOp's WindowID
00414     DlgOp->WindowID = (CWindowID)pDialogWnd;
00415     pDialogWnd->PushEventHandler(DlgOp->pEvtHandler);
00416 
00417     if (DlgOp->IS_KIND_OF(DialogTabOp))
00418     {
00419         // on balance we might be best ignoring errors here - we are really now past
00420         // the point of no return, and the dialog can be closed cleanly by the user
00421         // but let's try anyway
00422         if (!CreateTabbedDialog( (DialogTabOp*)DlgOp, Mode, OpeningPage, MainDlgID ))
00423         {
00424             // try using our own tolerant delete mechanism
00425             Delete(pDialogWnd, DlgOp);
00426             ERROR1(FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
00427         }
00428     }
00429 
00430     CreateRecursor(pDialogWnd);
00431 
00432     // Register all the child controls
00433     ControlList::Get()->RegisterWindowAndChildren(pDialogWnd, DlgOp);
00434 
00435     ControlList::Get()->ReflectAllStates(); // might as well do the processing before the bar / dialog appears
00436 
00437     // we call this directly now
00438     BOOL ok = PostCreate(DlgOp, OpeningPage);
00439 
00440     if( ok && 
00441         Mode == MODAL && 
00442         pDialogWnd->IsKindOf( CLASSINFO(wxDialog) ) )
00443     {
00444         ((wxDialog *) pDialogWnd)->ShowModal();
00445     }
00446 
00447 #ifdef USE_WXAUI
00448     if (wxAUImanaged)
00449     {
00450         wxString Title = wxEmptyString;
00451         if (pDialogWnd->IsKindOf(CLASSINFO(wxDialog)))
00452             Title=((wxDialog *)pDialogWnd)->GetTitle();
00453         if (Title.IsEmpty()) Title = pDialogWnd->GetLabel(); // because wxPanel doesn't seem to support a title
00454         if (Title.IsEmpty())
00455         {
00456             const TCHAR * ResString=CamResource::GetTextFail(pDialogWnd->GetId());
00457             if (ResString)
00458                 Title=wxString(ResString);
00459         }
00460         if (Title.IsEmpty())
00461         {
00462             // Finally, in desperation, we (mis-)use the tooltip string because now the wx folks have removed
00463             // the label, even though it's needed for accessibility. Aarrghh
00464             wxToolTip* pTip = pDialogWnd->GetToolTip();
00465             if (pTip) Title=pTip->GetTip();
00466         }
00467         if (Title.IsEmpty())
00468             Title = wxString(CamResource::GetText(_R(IDS_ANONYMOUSBARTITLE)));
00469 
00470 
00471         // We really should take a wxPaneInfo() as an additional parameter to this function to allow this sort
00472         // of stuff to be specified. Or try and retrieve it from the DialogBarOp or similar. Anyway, for now
00473         // give it some default parameters
00474         wxAuiPaneInfo paneinfo;
00475         if (!DlgOp->IsABar())
00476         {
00477             // default galleries to 300 deep. Specifying -1 as a width doesn't seem to work
00478             paneinfo.FloatingSize(100,300);
00479         }
00480         LoadPaneInfo(wxString(CamResource::GetObjectName(pDialogWnd->GetId())), paneinfo);
00481         paneinfo.DestroyOnClose(FALSE);
00482         if (DlgOp->IsABar())
00483         {           
00484             if (DlgOp->IsKindOf(CC_RUNTIME_CLASS(StatusLine)))
00485                 paneinfo.Bottom().Layer(1).Row(2).LeftDockable(FALSE).RightDockable(FALSE).Floatable(FALSE).Movable(FALSE).Gripper(FALSE).CaptionVisible(FALSE).PaneBorder(FALSE);
00486             else    
00487             {
00488                 paneinfo.ToolbarPane().Fixed();
00489                 if (DlgOp->IsVertical())
00490                 {
00491                     paneinfo.Left().Layer(0).GripperTop().TopDockable(FALSE).BottomDockable(FALSE);
00492                 }
00493                 else
00494                 {
00495                     paneinfo.Top().Layer(1).Row(2).LeftDockable(FALSE).RightDockable(FALSE);
00496                 }
00497             }
00498         }
00499         else
00500         {
00501             // Gallery
00502             paneinfo.Layer(3).GripperTop().TopDockable(FALSE).BottomDockable(FALSE).Float().Dockable(FALSE); // temporarilly stop galleries from docking
00503         }
00504 
00505         if (DlgOp->IsKindOf(CC_RUNTIME_CLASS(InformationBarOp)))
00506         {
00507             paneinfo.Floatable(FALSE);  // temporarilly do not allow Info Bars to float as they can be closed
00508                                         // which means they can't be reopened (no UI), and wxAUI rightly objects to the
00509                                         // tool switch that deletes them deleting the window.
00510         }
00511 
00512         paneinfo.Name(pDialogName).Caption(Title).PinButton(TRUE);
00513 
00514         wxSizer * pSizer = pDialogWnd->GetSizer();
00515         if (pSizer)
00516         {
00517             pSizer->SetSizeHints(pDialogWnd);
00518             pDialogWnd->SetSizerAndFit(pSizer);
00519         }
00520 
00521         // Ensure the main frame is shown if the pane is floating, or it can get "behind"
00522         // the main frame on wxGTK
00523         if (paneinfo.IsFloating() && !CCamFrame::GetFrameManager()->GetManagedWindow()->IsShown())
00524             CCamFrame::GetFrameManager()->GetManagedWindow()->Show();
00525 
00526         CCamFrame::GetFrameManager()->AddPane(pDialogWnd, paneinfo);
00527 
00528         CCamFrame::GetMainFrame()->UpdateFrameManager();
00529 
00530         // Make sure newly created floating panes are at the top in an attempt to fix
00531         // Bugzilla bug 1393 (can't duplicate here...)
00532         wxWindow * pTLW = pDialogWnd;
00533         while (pTLW->GetParent())
00534             pTLW=pTLW->GetParent();
00535         if (pTLW->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
00536             pTLW->Raise();
00537 
00538     }
00539 #endif
00540 
00541     return ok;
00542 }

BOOL DialogManager::CreateBar DialogBarOp DlgOp  )  [static, private]
 

Handles the creation of a bar Scope: private.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
DlgOp,: The DialogBarOp to create [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogManager::Create

Definition at line 7642 of file dlgmgr.cpp.

07643 {
07644     PORTNOTETRACE("dialog","DialogManager::CreateBar - do nothing");
07645 #ifndef EXCLUDE_FROM_XARALX
07646     BaseBar* DBWnd = NULL;
07647     // We need to create a DialogBar object
07648     if ( DlgOp->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)) )
07649     {
07650 #ifdef EXCLUDE_GALS
07651         return FALSE;
07652 #else
07653         DBWnd = new GalleryBar();
07654 #endif
07655     }
07656     else
07657     {
07658         DBWnd = new DialogBar();
07659     }
07660 
07661 
07662     if (DBWnd != NULL)
07663     {
07664         // Attempt to create the window
07665         if(!(DBWnd->Create((DialogBarOp*)DlgOp)))  // Should set the error code
07666         {
07667             delete DBWnd;
07668         }
07669     }
07670     else
07671     {
07672 
07673         ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY));  // Failed to create the DialogBar
07674     }
07675 #endif
07676     return TRUE;
07677 }

void DialogManager::CreateRecursor wxWindow *  pwxWindow  )  [static, private]
 

Initialize platform dependent resources.

Author:
Alex_Bligh <alex@alex.org.uk>
Date:
02/12/2005
Parameters:
pWindow - pointer to window to process [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: -

See also:
-

Definition at line 560 of file dlgmgr.cpp.

00561 {
00562     // Process this one
00563     wxPlatformDependent::Get()->InitWindow(pwxWindow);
00564 
00565     // bodge OD combo boxes not to have scroll bars so often
00566     if (pwxWindow->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
00567     {
00568         ((wxOwnerDrawnComboBox*)pwxWindow)->SetPopupMaxHeight(600);
00569         ((wxOwnerDrawnComboBox*)pwxWindow)->SetPopupAnchor(wxLEFT);
00570     }
00571 
00572     // Now process children if any
00573     wxWindowList::Node * pNode = pwxWindow->GetChildren().GetFirst();
00574     while (pNode)
00575     {
00576         CreateRecursor(pNode->GetData());
00577         pNode = pNode->GetNext();
00578     }
00579     return;
00580 }

BOOL DialogManager::CreateTabbedDialog DialogTabOp pTabDlgOp,
CDlgMode  Mode,
INT32  OpeningPage,
CDlgResID  mainDlgID
[static, private]
 

Handles the creation of a tabbed dialog Opening page allows a page to be specified that is not the initial page, which will be the default if this is the first time the dialog has been opened or if it has been opened before then the initial page will be the last one opened. Scope: private.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
DlgOp,: The DialogTabOp to create [INPUTS] CDlgMode: MODAL/MODELESS OpeningPage: Override the page which is active (defaults to -1)
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogManager::Create

Definition at line 7727 of file dlgmgr.cpp.

07729 {
07730     wxBookCtrlBase * pBook = GetBookControl(pTabDlgOp->WindowID);
07731     if (!pBook)
07732         return TRUE; // nothing to do
07733 
07734     // Before we can create the property sheet we must add pages to it.
07735     // Let's ask the op do do this for us
07736     if (!(pTabDlgOp->RegisterYourPagesInOrderPlease()))
07737     {
07738         // We failed to add pages to the dialog so we must tidy-up and fail
07739         return FALSE;
07740     }
07741 #if 0
07742     // Something very odd happens with the image list so we copy and reset it
07743     if (pBook->GetImageList())
07744     {
07745         wxImageList temp=*pBook->GetImageList();
07746         pBook->SetImageList(&temp);
07747     }
07748 #endif
07749 
07750     // Get the dialog sized to fit
07751     RelayoutDialog(pTabDlgOp);
07752 
07753     // Scroll to start and end after yeild
07754     ::wxYield();
07755     pBook->SetSelection(pBook->GetPageCount()-1);
07756     pBook->SetSelection(0);
07757 
07758     // First check if the OpeningPage parameter is not equal to -1, in which case this
07759     // specifies the active page to be opened.
07760     // Has to be an index as otherwise we have not specified the pages yet and so cannot
07761     // convert the PageID into an index which is what the PropertySheets require.
07762     UINT32 ActivePageIndex = 0;
07763     if (OpeningPage != -1)
07764     {
07765         // Set the index of the page that is to be the active one to the one that has
07766         // been specified.
07767         ActivePageIndex = OpeningPage;
07768     }
07769     else
07770     {
07771         // Determine if this dialog has been created before
07772         DialogPosition* pPosDetails = FindDialogPositionRecord( mainDlgID );
07773         if (pPosDetails != NULL)
07774         {
07775             // The dialog has been created before so find out the index of the active page
07776             ActivePageIndex = pPosDetails->ActivePageIndex;
07777         }
07778     }
07779 
07780     // Now that the pages have been registered, check if the dialog has been opened
07781     // before. If so force the new ActivePage to be specified rather than the old.
07782     if (OpeningPage != -1)
07783     {
07784         // Determine if this dialog has been created before
07785         DialogPosition* pPosDetails = FindDialogPositionRecord( mainDlgID );
07786         if (pPosDetails != NULL)
07787         {
07788             // The dialog has been created before so check if the specified page was the
07789             // last active one. If it was then everything should be ok.
07790 //          if (OpeningPage != pPosDetails->ActivePageIndex)
07791 //          {
07792                 ERROR3IF(pBook == NULL, "There is no current PropertySheet");
07793                 wxNotebookPage* pPage = (wxNotebookPage*)(pBook->GetPage(OpeningPage));
07794                 ERROR3IF(pPage == NULL, "There is no active page");
07795                 pPosDetails->ActivePage = pPage->GetId();
07796 TRACEUSER( "MarkH", _T("CreateTabbedDialog ActivePage = %d\n"),pPosDetails->ActivePage);
07797 //              pPosDetails->ActivePage = 27666;
07798                 pPosDetails->ActivePageIndex = OpeningPage;
07799 //          }
07800         }
07801     }
07802 
07803     return TRUE;
07804 }

BOOL DialogManager::CustomControlMsg wxWindow *  pDlg,
UINT32  wParam,
INT32  lParam
[static, private]
 

Handles custom control messages.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/94
Parameters:
hdlg,: Dialog HWND [INPUTS]
- [OUTPUTS]
Returns:
TRUE if message handled

Errors: -

See also:
-

Definition at line 5884 of file dlgmgr.cpp.

05885 {
05886     PORTNOTETRACE("dialog","DialogManager::CustomControlMsg - do nothing");
05887 #ifndef EXCLUDE_FROM_XARALX
05888     String_256 ClassNameStr;
05889     GetClassName( HWND(lParam), (TCHAR*)ClassNameStr, 255);
05890     if ((ClassNameStr == String_16(TEXT("cc_BitmapButton")))||
05891         ClassNameStr == String_16(TEXT("cc_SmallButton")))
05892     {
05893         Gadget = HIWORD(wParam);
05894         switch (LOWORD(wParam))
05895         {
05896         case BN_CLICKED:
05897             DialogManager::DIM = DIM_LFT_BN_CLICKED;
05898             DialogManager::HandleMessage = TRUE;
05899             return TRUE;
05900 
05901         case BN_BUTTONUP:
05902             DialogManager::DIM = DIM_LFT_BN_UP;
05903             DialogManager::HandleMessage = TRUE;
05904             return TRUE;
05905 
05906         case WM_MOUSEMOVE:
05907             DialogManager::DIM = DIM_MOUSE_MOVE;
05908             DialogManager::HandleMessage = TRUE;
05909             return TRUE;
05910 
05911 
05912         default:
05913             TRACEUSER( "JustinF", _T("Unknown message ID in DialogManager::CustomControlMsg\n"));
05914             break;
05915         }
05916     }
05917 #endif
05918     return FALSE; // Not a custom control message
05919 }

BOOL DialogManager::DefaultKeyboardFocus  )  [static]
 

Sets the keyboard focus to the "default" window, which currently is the main frame window (which in turn sets it to the active view window).

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful.

Errors: -

See also:
DialogManager::SetKeyboardFocus; DialogOp::SetKeyboardFocus

Definition at line 5444 of file dlgmgr.cpp.

05445 {
05446     // Set the focus to the main window, which will in turn set it to the active view.
05447     GetMainFrame()->SetFocus();
05448     return TRUE;
05449 }

void DialogManager::DeInit void   )  [static]
 

Deinitialise the DialogManager.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/9/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 6361 of file dlgmgr.cpp.

06362 {
06363     // Because this function is called from CCamApp::SaveAllModified, of all places,
06364     // it gets called twice on system shutdown (once on receipt of WM_QUERYENDSESSION,
06365     // which itself calls CCamApp::SaveAllModified, and once on receipt of WM_ENDSESSION,
06366     // which performs a SC_CLOSE system command which ultimately also calls SaveAllModified.
06367     // This flags is a bodge for v1.1 to stop this happening, a better solution would be
06368     // to rewrite the dialog manager to be more rational.
06369 
06370     // It's not currently broken this way changed TRACE to ERROR3- Alex
06371 
06372     static BOOL fCalledOnceBodge = FALSE;
06373     if (!fCalledOnceBodge) fCalledOnceBodge = TRUE;
06374     else
06375     {
06376         ERROR3( wxT("DialogManager::DeInit called twice - please fix me properly sometime\n") );
06377         return;
06378     }
06379 
06380     // save current bar state - this should check whether save prefs on exit is set!!!!
06381 PORTNOTE("dialog","Removed IsFullScreenMode usage")
06382 #ifndef EXCLUDE_FROM_XARALX
06383     if( GetMainFrame()->IsFullScreenMode() )
06384         DialogBarOp::WriteNamedBars("clean");
06385     else
06386         DialogBarOp::WriteNamedBars("normal");
06387 #endif
06388 
06389     // Send a CANCEL message to all open dialogs
06390     BROADCAST_TO_CLASS(DialogMsg(NULL, DIM_CANCEL, 0), DialogOp);
06391     // BODGE Special nasty stuff for v1 release.
06392 
06393     // InformationBarOp is completely deaf to the message broadcast above so we must
06394     // make sure their windows are destroyed (manually)
06395     InformationBarOp::SetVisibility(FALSE, TRUE);
06396 
06397     // Delete all Dialog position info
06398     ListItem* DlgPos = DialogPositionList.GetHead();
06399     ListItem* NextPos;
06400     while (DlgPos != NULL)
06401     {
06402         // Make sure that all dialogs have been deleted.
06403         ENSURE( ((DialogPosition*)DlgPos)->DlgWinList.IsEmpty(),
06404             "Live Dialog box found whilst destoying dialog manager");
06405 
06406         NextPos =  DialogPositionList.GetNext(DlgPos);
06407         delete DialogPositionList.RemoveItem(DlgPos);
06408         DlgPos = NextPos;
06409     }
06410     // We do not delete s_pPaneInfoHash here because the preferences have not been written out
06411 }

void DialogManager::Delete CWindowID  WindowID,
DialogOp pDlgOp
[static]
 

The delete method will delete all system resources and other information which is kept about the dialog. It also records the dialogs current position so that it can be restored the next time the dialog is created.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/93
Parameters:
WindowID,: Dialog's window identifier [INPUTS] pDlgOp: The DialogOp
See also:
DialogOp::Delete

Definition at line 1811 of file dlgmgr.cpp.

01812 {
01813     ERROR2IF (!pDlgOp, (void)0, "No dialog op to DialogManager::Delete()");
01814     ERROR2IF (!WindowID, (void)0, "No window to DialogManager::Delete()");
01815 
01816     if (!pDlgOp->pEvtHandler)
01817     {
01818         ERROR3("DialogManager::Delete() No dialog op event handler - has this window been deleted twice?");
01819         return;
01820     }
01821 
01822     // If we've already been destroyed (by something else) - a situation which should never happen - then
01823     // return without doing anything
01824     if (pDlgOp->pEvtHandler && pDlgOp->pEvtHandler->m_GrimReaperSent)
01825     {
01826         TRACEALL(_T("DialogManager::Delete() Window has been deleted by something else, then Delete() called"));
01827         return;
01828     }
01829 
01830     if (((wxWindow *)WindowID)->IsBeingDeleted())
01831     {
01832         ERROR3("Trying to delete a window that is already being deleted, has an event handler, but has not sent grim reaper");
01833         return;
01834     }
01835 
01836     wxBookCtrlBase * pBook=NULL;
01837     // Only do special processing for DialogTabOp
01838     if (pDlgOp->IS_KIND_OF(DialogTabOp))
01839         pBook=GetBookControl(WindowID);
01840 //  ResourceID BookGadget=pBook?pBook->GetId():0;
01841 
01842     // See if the dialogs has a position record  (If it's a DialogBarOp it won't have one)
01843     DialogPosition* DlgPos = (DialogPosition*)DialogPositionList.GetHead();
01844     CWindowIDItem* WinID;
01845     while(DlgPos != NULL)
01846     {
01847         // Search the DlgWinList for the DlgPos for WindowID
01848         WinID = (CWindowIDItem*)DlgPos->DlgWinList.GetHead();
01849         while (WinID != NULL)
01850         {
01851             if ((WinID->DlgWin) == WindowID) // Found the dialogs position record
01852             {
01853                 // The Dialogs window is about to be destroyed so delete the WinID from the
01854                 // DlgWinList of DlgPos.
01855                 delete(DlgPos->DlgWinList.RemoveItem((ListItem*)WinID));
01856                 goto FoundPos; // What a rebel
01857             }
01858             WinID = (CWindowIDItem*)DlgPos->DlgWinList.GetNext((ListItem*)WinID);
01859         }
01860         // Get the next position record
01861         DlgPos = ((DialogPosition*)DialogPositionList.GetNext((ListItem*)DlgPos));
01862     }
01863     // No DialogPosition record was found so must be a DialogBarOp
01864 
01865 
01866     FoundPos:
01867 
01868     wxWindow           *pCWnd = (wxWindow *)WindowID;
01869 
01870 
01871     if (DlgPos != NULL)
01872     {
01873         // Record the dialog's position so that it can be restored if the dialog is created again
01874         wxRect          DialogRect( pCWnd->GetRect() );
01875         DlgPos->LastX = DialogRect.x;
01876         DlgPos->LastY = DialogRect.y;
01877         DlgPos->ActivePage = 0;
01878         DlgPos->ActivePageIndex = 0;
01879 
01880         // If the dialog is tabbed then we need to record the active page as well
01881         // We can't find the runtime class of the DialogOp at this point because Delete can be called
01882         // from its destructor
01883         if (pBook)
01884         {
01885             wxNotebookPage* pPage = pBook->GetCurrentPage();
01886             if (pPage)
01887             {
01888                 DlgPos->ActivePage = pPage->GetId();
01889                 // Store the pages index as well
01890                 GetPageWindow(WindowID, DlgPos->ActivePage, &(DlgPos->ActivePageIndex));
01891             }
01892             else
01893                 ERROR3("There is no active page");
01894         }
01895     }
01896 
01897     if (pDlgOp->pEvtHandler->wxAUImanaged)
01898     {
01899         wxAuiPaneInfo paneinfo = CCamFrame::GetMainFrame()->GetFrameManager()->GetPane(pCWnd);
01900         if (paneinfo.IsOk())
01901             SavePaneInfo(wxString(CamResource::GetObjectName(pCWnd->GetId())), paneinfo);
01902         // Remove the bar from wxAUI
01903         CCamFrame::GetMainFrame()->GetFrameManager()->DetachPane(pCWnd);
01904         CCamFrame::GetMainFrame()->UpdateFrameManager();
01905     }
01906 
01907     // Delete all discardable strings associated with the dialog
01908     DlgDiscardString* DiscardStr = (DlgDiscardString*)(DiscardStrList.GetHead());
01909     while (DiscardStr != NULL) // While there are still strings to delete
01910     {
01911         DlgDiscardString* Next = (DlgDiscardString*)(DiscardStrList.GetNext(DiscardStr));
01912         if (DiscardStr->DlgWindow == WindowID)  // The string belongs to the dialog being
01913                                                 // deleted
01914         {
01915             delete (DiscardStr->pStr); // Delete the string
01916             delete(DiscardStrList.RemoveItem(DiscardStr)); // Delete the DiscardStr record
01917         }
01918         DiscardStr = Next;  // Get next string record
01919     }
01920 
01921     // Delete all scrollPageInc information associated with the dialog
01922     ScrollPageInc* PgInc = (ScrollPageInc*)(ScrollPageIncList.GetHead());
01923     while (PgInc != NULL)
01924     {
01925         ScrollPageInc* Next = (ScrollPageInc*)(ScrollPageIncList.GetNext((ListItem*)PgInc));
01926         if( PgInc->pDlgWindow == WindowID ) // The ScrollPageInc record belongs to the dialog
01927                                             // being deleted.
01928             delete (ScrollPageIncList.RemoveItem( (ListItem*)PgInc) );  // Delete the
01929                                                                         // ScrollPageInc record
01930         PgInc = Next; // Get next record
01931     }
01932 
01933     // Delete all ControlInfo records
01934     List* ControlInfoList = GetControlList( (wxWindow *)WindowID );
01935 
01936     // Kill of Dropdowns
01937     DropDown::KillDropDownsByWindow(WindowID);
01938     CGridDropDown::KillDropDownsByWindow(WindowID);
01939 
01940     // Remove new-form control list
01941     ControlList::Get()->RemoveWindowAndChildren((wxWindow *)WindowID);
01942 
01943     // We are about to destroy the window. Disconnecting our event handler sounds like a good
01944     // idea at this point, as Destroy() does not destroy the window immediately, so there
01945     // is a possibility of receiving further events
01946     ((wxWindow *)WindowID)->PopEventHandler(FALSE); // leave the DialogOp's destructor to delete it
01947     pDlgOp->pEvtHandler->Destroy();
01948 
01949 
01950     if (pDlgOp->IsModal() && WindowID->IsKindOf(CLASSINFO(wxDialog)))
01951     // A normal Modal
01952     {
01953         ( (wxDialog *)WindowID )->EndModal( TRUE );
01954         ( (wxWindow *)WindowID )->Destroy();
01955     }
01956     else
01957     {
01958         ( (wxWindow *)WindowID )->Destroy();
01959     }
01960 
01961     if (ControlInfoList)
01962     {
01963         // Its one of our special windows with an attached list
01964 
01965         while (!ControlInfoList->IsEmpty())
01966             delete(ControlInfoList->RemoveHead());
01967         // Delete the ControlInfo list
01968         delete (ControlInfoList);
01969         ControlInfoList = NULL;
01970     }
01971 
01972     // Restore the active/disabled window state
01973     if (pDlgOp->IsModal())
01974     {
01975         // DialogManager::RestoreActiveDialogState();
01976     }
01977 
01978     DefaultKeyboardFocus();
01979     // All spick and span
01980 }

BOOL DialogManager::DeleteAllValues CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

For deleting all values in a list-gadget.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/5/94
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Returns:
TRUE if the values could be deleted, else FALSE.
For Windows -----------

This function can be used to delete list items from ComboBox, ListBox, or cc_ListBox controls. ALL items in the given Gadget will be deleted (i.e. it resets the list to containing no items at all. This is equivalent to calling DeleteValue for each list item in turn)

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::DeleteAllValues; DialogManager::DeleteValue

Definition at line 4683 of file dlgmgr.cpp.

04684 {
04685     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04686     if (!pGadget) return FALSE;
04687 
04688     //if ( pGadget->IsKindOf(CLASSINFO(wxControlWithItems)) ) // Includes wxListBox - this seems to have false positives
04689     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04690         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04691         pGadget->IsKindOf(CLASSINFO(wxChoice))
04692         )
04693     {
04694         ((wxControlWithItems *)pGadget)->Clear();
04695         return TRUE;
04696     }
04697     else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04698     {
04699         ((wxOwnerDrawnComboBox *)pGadget)->Clear();
04700         return TRUE;
04701     }
04702     else if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
04703         )
04704     {
04705         ((wxTreeCtrl*)pGadget)->DeleteAllItems();
04706         return TRUE;
04707     }
04708 
04709     ERROR3("Invalid control");
04710     return FALSE;
04711 }

void DialogManager::DeleteControlList CWindowID  hWnd  )  [static, private]
 

Deletes the Properties that are used to store the ControlList. Should be called as the very last thing before the Window is vaped e.g. in response to a WM_DESTROY message. Destroying it earlier will cause GetControlList to return NULL which proves fatal within the various message handlers. Scope: Private, static.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/11/94
Parameters:
A Window handle [INPUTS]

Definition at line 6484 of file dlgmgr.cpp.

06485 {
06486     PORTNOTETRACE("dialog","DialogManager::DeleteControlList - do nothing");
06487 #ifndef EXCLUDE_FROM_XARALX
06488     RemoveProp( hWnd, MAKEINTATOM(GetListAtom) );
06489 #ifndef WIN32
06490     RemoveProp( hWnd, MAKEINTATOM(GetListAtomSegment) );
06491 #endif
06492 #endif
06493 }

static void DialogManager::DeletePropShtDetails DialogTabOp pOp  )  [static, private]
 

BOOL DialogManager::DeleteValue CWindowID  WindowID,
CGadgetID  Gadget,
BOOL  EndOfList = TRUE,
INT32  ListPos = 0
[static]
 

For deleting a gadget value.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
The following inputs only need to be provided if the gadget has multiple values, for example a ListBox.

EndOfList: TRUE if the value is to be deleted from the end of the gadgets value list. (Default = TRUE)

ListPos: If EndOfList = FALSE then this input specifies the position in the list (Default = 0, so if you want to delete the value at the top of the list simply specify EndOfList = FALSE)

Returns:
TRUE if the value could be deleted, else FALSE.
For Windows -----------

This function can be used to delete list items from ListBox or ComboBox controls.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::DeleteValue

Definition at line 4753 of file dlgmgr.cpp.

04757 {
04758     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04759     if (!pGadget) return FALSE;
04760 
04761     //if ( pGadget->IsKindOf(CLASSINFO(wxControlWithItems)) ) // Includes wxListBox - this seems to have false positives
04762     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04763         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04764         pGadget->IsKindOf(CLASSINFO(wxChoice))
04765         )
04766     {
04767         if (EndOfList)
04768             ((wxControlWithItems *)pGadget)->Delete(((wxControlWithItems *)pGadget)->GetCount()-1);
04769         else
04770             ((wxControlWithItems *)pGadget)->Delete(ListPos);
04771         return TRUE;
04772     }
04773     else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04774     {
04775         if (EndOfList)
04776             ((wxOwnerDrawnComboBox *)pGadget)->Delete(((wxOwnerDrawnComboBox *)pGadget)->GetCount()-1);
04777         else
04778             ((wxOwnerDrawnComboBox *)pGadget)->Delete(ListPos);
04779         return TRUE;
04780     }
04781 
04782     ERROR3("Invalid control");
04783     return FALSE;
04784 }

void DialogManager::DualFunctionButton CWindowID  DialogWnd,
CGadgetID  ButtonGadget
[static]
 

To subclass the button gadget so that it accepts right mouse button clicks.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/9/93
Parameters:
DialogWnd,: Dialog box window identifier [INPUTS] ButtonGadget: Button gadget identifier
- [OUTPUTS]
Returns:
-

Errors: -

See also:
DialogOp::DualFunctionButton

Definition at line 6126 of file dlgmgr.cpp.

06128 {
06129     PORTNOTETRACE("dialog","DialogManager::DualFunctionButton - do nothing");
06130 #ifndef EXCLUDE_FROM_XARALX
06131     // This function should only be called for a button control
06132     HWND hGadget = GetDlgItem((HWND)DialogWnd, (INT32)ButtonGadget);
06133     #if _DEBUG
06134     String_256 ClassNameStr;
06135     GetClassName(hGadget, (TCHAR*)ClassNameStr, 255);
06136 
06137     ENSURE((ClassNameStr == String_8(TEXT("Button"))), "DualFunctionButton function called\n"
06138                                                     "on a gadget which is not a button");
06139     #endif
06140 
06141     ControlInfo* ControlInfoPtr;               // This structure will be passed to the
06142                                             // RgtMOuseButtonProc.
06143 
06144     ControlInfoPtr = new ControlInfo;
06145     ControlInfoPtr->pControlWnd = hGadget;
06146     ControlInfoPtr->lpfnOldProc = (FARPROC) GetWindowLong(hGadget, GWL_WNDPROC);
06147 
06148     // Store the button control info in the dialog's Edit control info list
06149     GetControlList( DialogWnd )->AddHead(ControlInfoPtr);
06150 
06151     FARPROC lpfnDualFn = MakeProcInstance((FARPROC) DialogManager::RgtMouseButtonProc,
06152                                         AfxGetApp()->m_hInstance);
06153 
06154     // Subclass the control so that it calls the new button proc
06155     SetWindowLong(hGadget, GWL_WNDPROC, (INT32) lpfnDualFn );
06156 #endif
06157 }

void DialogManager::EnableAllDialogs BOOL  Enable,
wxWindow *  pExceptMe = NULL
[static]
 

Enables or Disables all Dialogs on the DialogOp message handler list. This is useful when opening/closing modal dialogs.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/95
Parameters:
Enable,: When TRUE all dialogs are enabled [INPUTS]
ExceptMe: An optional dialog to exclude. If a modal dialog X has just been created then all dialogs except X will need disabling
Parameters:
- [OUTPUTS]
Returns:
-

Definition at line 5939 of file dlgmgr.cpp.

05940 {
05941     // Obtain a list of all live dialogs
05942     List               *pDlgList = MessageHandler::GetClassList( CC_RUNTIME_CLASS(DialogOp) );
05943 
05944     ERROR3IF( pDlgList == NULL, "Could not find the DialogOp Class List" );
05945     if( NULL != pDlgList )
05946     {
05947         ListItem       *CurrentOp = pDlgList->GetHead();
05948         DialogOp       *pDlgOp;
05949         while( CurrentOp != NULL )
05950         {
05951             if (CurrentOp->IS_KIND_OF(DialogOp)) // They all should be
05952             {
05953                 pDlgOp = (DialogOp*)CurrentOp;
05954                 // Determine if the dialog has an associated window
05955                 if (pDlgOp->HasWindow())
05956                 {
05957                     if (pDlgOp->WindowID != pExceptMe)
05958                     {
05959                         ( (wxWindow *)pDlgOp->WindowID )->Enable( FALSE != Enable );
05960                     }
05961                 }
05962             }
05963             CurrentOp = pDlgList->GetNext(CurrentOp); // Get next operation in the live list
05964         }
05965     }
05966 
05967     // For some reason, the green bit of code below did not disable common dialogs. Therefore
05968     // the semi-bodge below was added to disable the active window.
05969 
05970     wxWindow           *pActiveWindow = wxWindow::FindFocus();
05971     if( NULL != pActiveWindow )
05972     {
05973         if( pActiveWindow != pExceptMe )
05974         {
05975             pActiveWindow->Enable( FALSE != Enable );
05976         }
05977     }
05978 }

BOOL DialogManager::EnableGadget CWindowID  WindowID,
CGadgetID  Gadget,
BOOL  Enabled
[static]
 

For enabling/disabling a gadget.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier Enabled: TRUE if the gadget is to be enabled. FALSE if the gadget is to be disabled.
[OUTPUTS] 
Returns:
TRUE if successful, else FALSE
For Windows -----------

This function can be called for all controls

Returns:
Errors: -
See also:
DialogOp::EnableGadget

Definition at line 5160 of file dlgmgr.cpp.

05161 {
05162     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05163     if (!pGadget) return FALSE;
05164     pGadget->Enable( FALSE != Enabled );
05165     return (TRUE);
05166 }

void DialogManager::EnsurePanePreferenceDeclared wxString  key  )  [static, protected]
 

Ensures the relevant preference has been declared Scope: protected.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
25/07/06
Parameters:
key - the key the pane info will be stored under [INPUTS]
None [OUTPUTS]
Returns:
None

Definition at line 821 of file dlgmgr.cpp.

00822 {
00823     if (!s_pPaneInfoHash)
00824         InitPaneInfoHash();
00825 
00826     if (!s_pPaneInfoHash)
00827         return;
00828 
00829     IdToSerializedPaneInfo::iterator i=s_pPaneInfoHash->find(key);
00830     if (i==s_pPaneInfoHash->end())
00831     {
00832         // ok, it's not in the hash, so it can't have been declared as a preference
00833         // yet. So we will declare it as a preference now
00834         (*s_pPaneInfoHash)[key]=_T("");
00835         i=s_pPaneInfoHash->find(key);
00836         if (i==s_pPaneInfoHash->end())
00837         {
00838             ERROR3("This hash leaks like a seive");
00839             return;
00840         }
00841         // --------------------------------------------------------------------------
00842         // Detect first-time run and make Open File dialog default to Examples folder
00843         if (Camelot.DeclareSection(_T("BarPositions"), 10))
00844         {
00845             Camelot.DeclarePref( NULL, (TCHAR *)(key.c_str()), &(i->second) );
00846         }
00847     }
00848 }

void DialogManager::Event DialogEventHandler pEvtHandler,
wxEvent &  event
[static, protected]
 

OnCommand message handler. Translates a windows Command message into a DIM.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/9/93
Returns:
Errors: -
See also:
-

Definition at line 1110 of file dlgmgr.cpp.

01111 {
01112     WXTYPE EventType = event.GetEventType();
01113 //  CDlgMessage DIM = DIM_NONE;
01114     ResourceID id = event.GetId();
01115     UINT_PTR DlgMsgParam = 0;
01116     INT32 PageID = 0;
01117     BOOL HandleMessage=FALSE;
01118     BOOL Defer=TRUE;
01119 
01120     if (!pEvtHandler->pwxWindow || !pEvtHandler->pDialogOp)
01121     {
01122         // We are in the process of destruction
01123         event.Skip();
01124         return;
01125     }
01126 
01127     // First handle events we previously asked to defer processing of
01128     if (event.IsKindOf(CLASSINFO(wxCamDialogEvent)) && (EventType == wxEVT_CAMDIALOG_DEFERREDMSG))
01129     {
01130         // We posted this event and asked it to come back later, and it duly has
01131         wxCamDialogEvent * pDialogEvent = (wxCamDialogEvent *)(&event);
01132         pDialogEvent->msg.DlgWndID = pEvtHandler->pwxWindow; // this ensures we are using a valid window pointer
01133         // Send it around
01134         BROADCAST_TO_CLASS( DialogMsg(pDialogEvent->msg), DialogOp );
01135         return;
01136     }
01137 
01138     wxWindow * pGadget = NULL;
01139     if (id) pGadget = GetGadget(pEvtHandler->pwxWindow, id);
01140 
01141     // We tend to get this second-hand from our child, we handle this differently
01142     if( !pGadget && (event.GetEventObject() != pEvtHandler->pwxWindow))
01143     {
01144         pGadget = (wxWindow *)event.GetEventObject();
01145         id = pGadget->GetId();
01146     }
01147 
01148     // Try and find-out whether our control is part of a tabbed dialog page
01149     if( NULL != pGadget )
01150     {
01151         // pEvtHandler->pwxWindow maybe our immediate wxPanel\wxDialog, but won't
01152         // be in case of tabbed dialog
01153         wxWindow*   pDialog = pGadget->GetParent();
01154         while( NULL != pDialog && !pDialog->IsKindOf( CLASSINFO(wxDialog) ) && 
01155             !pDialog->IsKindOf( CLASSINFO(wxPanel) ) )
01156         {
01157             pDialog = pDialog->GetParent();
01158         }
01159 
01160         // Could this be part of a tabbed dialog?
01161         if( NULL != pDialog && pDialog->IsKindOf( CLASSINFO(wxPanel) ) )
01162         {
01163             // A parent of type wxBookCtrlBase would synch it
01164             wxWindow *pDialogParent = pDialog->GetParent();
01165             if( NULL != pDialogParent && pDialogParent->IsKindOf( CLASSINFO(wxBookCtrlBase) ) )
01166                 PageID = pDialog->GetId();
01167         }
01168     }
01169 
01170     // Make up a default message
01171     DialogMsg msg(pEvtHandler->pwxWindow, DIM_NONE, id, DlgMsgParam, PageID);
01172 
01173     if (!event.IsKindOf(CLASSINFO(wxMouseEvent))) // MouseEvents are too noisy
01174     {
01175         TRACEUSER("amb",_T("event %d(%s) received, ID=%d(%s), wxw=%llx"), EventType, DialogEventHandler::GetEventName(EventType), id,
01176                     CamResource::GetObjectName((ResourceID)id), pEvtHandler->pwxWindow);
01177     }
01178 
01179     if (
01180         (EventType == wxEVT_LEFT_DCLICK) ||
01181         (EventType == wxEVT_MIDDLE_DCLICK) ||
01182         (EventType == wxEVT_RIGHT_DCLICK) ||
01183         FALSE)
01184     {
01185         // OK, these are a bit deadly. We expected there to be TWO mouse up mouse downs. People
01186         // don't seem to hang off double clicks themselves, but do their own double click handling
01187         // (why oh why). So we generate an extra mouse down and mouse up, and sending them to
01188         // ourselves. This may not be necessary on all platforms.
01189         wxMouseEvent *MouseDown = (wxMouseEvent *)(event.Clone());
01190         wxMouseEvent *MouseUp = (wxMouseEvent *)(event.Clone());
01191         if (MouseDown && MouseUp)
01192         {
01193             if (EventType == wxEVT_LEFT_DCLICK)
01194             {
01195                 MouseDown->SetEventType(wxEVT_LEFT_DOWN);
01196                 MouseUp->SetEventType(wxEVT_LEFT_UP);
01197             }
01198             else if (EventType == wxEVT_MIDDLE_DCLICK)
01199             {
01200                 MouseDown->SetEventType(wxEVT_MIDDLE_DOWN);
01201                 MouseUp->SetEventType(wxEVT_MIDDLE_UP);
01202             }
01203             else
01204             {
01205                 MouseDown->SetEventType(wxEVT_RIGHT_DOWN);
01206                 MouseUp->SetEventType(wxEVT_RIGHT_UP);
01207             }
01208             
01209             //MouseDown.SetEventObject(pEvtHandler->pwxWindow);
01210             // MouseUp.SetEventObject(pEvtHandler->pwxWindow);
01211             // set it for processing later
01212             pEvtHandler->pwxWindow->GetEventHandler()->ProcessEvent(*MouseDown);
01213             pEvtHandler->pwxWindow->GetEventHandler()->ProcessEvent(*MouseUp);
01214         }
01215         if (MouseDown) delete MouseDown;
01216         if (MouseUp) delete MouseUp;
01217     }   
01218 
01219     /* Here is a list of possible command events
01220     wxEVT_COMMAND_BUTTON_CLICKED
01221     wxEVT_COMMAND_CHECKBOX_CLICKED
01222     wxEVT_COMMAND_CHOICE_SELECTED
01223     wxEVT_COMMAND_LISTBOX_SELECTED
01224     wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
01225     wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
01226     wxEVT_COMMAND_TEXT_UPDATED  // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01227     wxEVT_COMMAND_TEXT_ENTER    // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01228     wxEVT_COMMAND_TEXT_URL      // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01229     wxEVT_COMMAND_TEXT_MAXLEN   // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01230     wxEVT_COMMAND_MENU_SELECTED
01231     wxEVT_COMMAND_SLIDER_UPDATED
01232     wxEVT_COMMAND_RADIOBOX_SELECTED
01233     wxEVT_COMMAND_RADIOBUTTON_SELECTED
01234     wxEVT_COMMAND_SCROLLBAR_UPDATED // Obselete - see wxWVT_SCROLL
01235     wxEVT_COMMAND_VLBOX_SELECTED
01236     wxEVT_COMMAND_COMBOBOX_SELECTED
01237     wxEVT_COMMAND_TOOL_RCLICKED
01238     wxEVT_COMMAND_TOOL_ENTER
01239     wxEVT_COMMAND_SPINCTRL_UPDATED
01240 
01241     We can't use switch on these - GRRR!
01242     */
01243 
01244     if (
01245         (EventType == wxEVT_COMMAND_BUTTON_CLICKED) ||
01246         FALSE)
01247     {
01248         // We should cope with Right Button here
01249         if ((ResourceID)id == _R(wxID_OK) )
01250         {
01251             msg.DlgMsg = DIM_COMMIT;
01252             HandleMessage = TRUE;
01253         }
01254         else if (id == _R(ID_CC_APPLY_NOW))
01255         {
01256             // Clicking on the apply now button is the same as a soft commit
01257             msg.DlgMsg = DIM_SOFT_COMMIT;
01258             HandleMessage = TRUE;
01259         }
01260         else if (id == _R(wxID_CANCEL))
01261         {
01262             msg.DlgMsg = DIM_CANCEL;
01263             // Do not defer processing of clicks on the close button because the default handler may destroy the window on
01264             // exit from this call
01265             Defer=FALSE; 
01266             HandleMessage = TRUE;
01267         }
01268         else if (id == _R(wxID_HELP))
01269         {
01270             // Our clients expect this ID, so keep them happy
01271             msg.DlgMsg = DIM_LFT_BN_CLICKED;
01272             msg.GadgetID = _R(ID_HELP);
01273             HandleMessage = TRUE;
01274         }
01275         else
01276         {
01277             msg.DlgMsg = DIM_LFT_BN_CLICKED;
01278             HandleMessage = TRUE;
01279         }
01280     }
01281     else if (
01282         (EventType == wxEVT_COMMAND_CHOICE_SELECTED) ||
01283         (EventType == wxEVT_COMMAND_LISTBOX_SELECTED) ||
01284         (EventType == wxEVT_COMMAND_CHECKLISTBOX_TOGGLED) ||
01285 //      We skip this because it's generated when we change the text ourselves. We should probably do something more subtle
01286 //      (EventType == wxEVT_COMMAND_TEXT_UPDATED) ||    // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01287         (EventType == wxEVT_COMMAND_TEXT_URL) ||        // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01288 //      (EventType == wxEVT_COMMAND_TEXT_MAXLEN) ||     // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01289         (EventType == wxEVT_COMMAND_MENU_SELECTED) ||
01290 //      (EventType == wxEVT_COMMAND_SLIDER_UPDATED) ||
01291         (EventType == wxEVT_COMMAND_RADIOBOX_SELECTED) ||
01292         (EventType == wxEVT_COMMAND_VLBOX_SELECTED) ||
01293         (EventType == wxEVT_COMMAND_COMBOBOX_SELECTED) ||
01294         (EventType == wxEVT_COMMAND_SPINCTRL_UPDATED) ||
01295         ((
01296         (EventType == wxEVT_SCROLL_CHANGED) || 
01297         (EventType == wxEVT_SCROLL_THUMBTRACK) || 
01298         (EventType == wxEVT_SCROLL_THUMBRELEASE) ||
01299         (EventType == wxEVT_SCROLL_LINEUP) ||
01300         (EventType == wxEVT_SCROLL_LINEDOWN) ||
01301         (EventType == wxEVT_SCROLL_PAGEUP) ||
01302         (EventType == wxEVT_SCROLL_PAGEDOWN)
01303         ) &&
01304         !(
01305           (pGadget && pGadget->IsKindOf(CLASSINFO(wxSlider))) ||
01306           (pGadget && pGadget->IsKindOf(CLASSINFO(wxSliderCombo)))
01307         )
01308         ) || // Don't handle slider scroll stuff here
01309         (EventType == wxEVT_COMMAND_TREE_SEL_CHANGED) ||
01310         FALSE)
01311     {
01312         msg.DlgMsg = DIM_SELECTION_CHANGED;
01313         msg.DlgMsgParam = NO_COMMIT;
01314         HandleMessage = TRUE;
01315     }
01316     else if( EventType == wxEVT_COMMAND_TEXT_UPDATED &&     // only with WXWIN_COMPATIBILITY_EVENT_TYPES
01317         pGadget == wxWindow::FindFocus() )
01318     {
01319         msg.DlgMsg = DIM_TEXT_CHANGED;
01320         HandleMessage = TRUE;
01321     }
01322     else if(
01323         (EventType == wxEVT_COMMAND_TEXT_ENTER) ||
01324         FALSE)
01325     {
01326         msg.DlgMsg = DIM_SELECTION_CHANGED;
01327         msg.DlgMsgParam = ENTER_COMMIT;
01328         HandleMessage = TRUE;
01329     }
01330     else if(
01331         (( (EventType == wxEVT_SCROLL_THUMBTRACK) ||
01332         (EventType == wxEVT_SCROLL_LINEUP) ||
01333         (EventType == wxEVT_SCROLL_LINEDOWN) ||
01334         (EventType == wxEVT_SCROLL_PAGEUP) ||
01335         (EventType == wxEVT_SCROLL_PAGEDOWN)
01336         ) && (pGadget && ( pGadget->IsKindOf(CLASSINFO(wxSlider)) || pGadget->IsKindOf(CLASSINFO(wxSliderCombo)) ))) || 
01337         FALSE) // Handle slider movements - note SCROLL_CHANGED always comes later
01338     {
01339         msg.DlgMsg = DIM_SLIDER_POS_CHANGING;
01340         HandleMessage = TRUE;
01341     }
01342     else if(
01343         // Do not handle THUMB_RELEASE because we get a SCROLL_CHANGED anyway, and having two means we generate two SETs which will generate 2 undo records
01344         // on (for instance) transparency and Bevel tools
01345         ((/*EventType == wxEVT_SCROLL_THUMBRELEASE ||*/ EventType == wxEVT_SCROLL_CHANGED) &&
01346          ( (pGadget && pGadget->IsKindOf(CLASSINFO(wxSlider))) || (pGadget && pGadget->IsKindOf(CLASSINFO(wxSliderCombo))) )
01347         ) || // Handle slider changes
01348         FALSE)
01349     {
01350         msg.DlgMsg = DIM_SLIDER_POS_SET;
01351         HandleMessage = TRUE;
01352     }
01353     else if(
01354         (EventType == wxEVT_COMMAND_CHECKBOX_CLICKED) ||
01355         (EventType == wxEVT_COMMAND_RADIOBUTTON_SELECTED) ||
01356         FALSE)
01357     {
01358         msg.DlgMsg = DIM_LFT_BN_CLICKED; // apparently not a DIM_SELECTION_CHANGED - the click itself is eaten by the radio control - please do not change - AMB
01359         HandleMessage = TRUE;
01360     }
01361     else if (
01362         (EventType == wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) ||
01363         FALSE)
01364     {
01365         msg.DlgMsg = DIM_SELECTION_CHANGED_COMMIT;
01366         HandleMessage = TRUE;
01367     }
01368     else if (
01369         (EventType == wxEVT_LEFT_DOWN) ||
01370         FALSE)
01371     {
01372         msg.DlgMsg = DIM_LFT_BN_DOWN;
01373         HandleMessage = TRUE;
01374     }   
01375     else if (
01376         (EventType == wxEVT_LEFT_UP) ||
01377         FALSE)
01378     {
01379         msg.DlgMsg = DIM_LFT_BN_UP;
01380         HandleMessage = TRUE;
01381     }   
01382     else if (
01383         (EventType == wxEVT_RIGHT_DOWN) ||
01384         FALSE)
01385     {
01386         msg.DlgMsg = DIM_RGT_BN_DOWN;
01387         HandleMessage = TRUE;
01388     }   
01389     else if (
01390         (EventType == wxEVT_RIGHT_UP) ||
01391         FALSE)
01392     {
01393         msg.DlgMsg = DIM_RGT_BN_UP;
01394         HandleMessage = TRUE;
01395     }   
01396     else if (
01397         (EventType == wxEVT_MIDDLE_DOWN) ||
01398         FALSE)
01399     {
01400         msg.DlgMsg = DIM_MID_BN_DOWN;
01401         HandleMessage = TRUE;
01402     }   
01403     else if (
01404         (EventType == wxEVT_MIDDLE_UP) ||
01405         FALSE)
01406     {
01407         msg.DlgMsg = DIM_MID_BN_UP;
01408         HandleMessage = TRUE;
01409     }   
01410     else if (
01411         (EventType == wxEVT_MOTION) ||
01412         FALSE)
01413     {
01414         msg.DlgMsg = ((wxMouseEvent *)&event)->Dragging()?DIM_MOUSE_DRAG:DIM_MOUSE_MOVE;
01415         HandleMessage = TRUE;
01416     }   
01417     else if (
01418         (EventType == wxEVT_MOUSEWHEEL) ||
01419         FALSE)
01420     {
01421         msg.DlgMsg = (((wxMouseEvent *)&event)->GetWheelRotation()>0)?DIM_MOUSEWHEEL_UP:DIM_MOUSEWHEEL_DOWN;
01422         HandleMessage = TRUE;
01423     }   
01424     else if (
01425         (EventType == wxEVT_MOVE) ||
01426         FALSE)
01427     {
01428         msg.DlgMsg = DIM_DLG_MOVED;
01429         HandleMessage = TRUE;
01430     }   
01431     else if (
01432         (EventType == wxEVT_SIZE) ||
01433         FALSE)
01434     {
01435         if (event.GetEventObject() != pEvtHandler->pwxWindow)
01436         {
01437             Defer = FALSE;
01438             msg.DlgMsg = DIM_CTRL_RESIZED;
01439             HandleMessage = TRUE;   
01440         }
01441         else
01442         {
01443             msg.DlgMsg = DIM_DLG_RESIZED;
01444             HandleMessage = TRUE;
01445         }
01446     }
01447     else if (
01448         (EventType == wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED) &&
01449         pGadget && pGadget->IsKindOf(CLASSINFO(wxBookCtrlBase)))
01450     {
01451         msg.DlgMsg = DIM_SET_ACTIVE;
01452         wxWindow *pPage = ((wxBookCtrlBase*)pGadget)->GetCurrentPage();
01453         msg.PageID = pPage?(pPage->GetId()):0;
01454         HandleMessage = TRUE;
01455     }
01456     else if (
01457         ((EventType == wxEVT_CAMDIALOG_REDRAW) && (pGadget)) ||
01458         FALSE)
01459     {
01460         if (CCamApp::IsDisabled())
01461         {
01462             TRACE( _T("kernel-rendered gadget repaint has been aborted: the system is disabled (due to an error/ensure?)\n"));
01463             HandleMessage = FALSE;
01464         }
01465         else
01466         {
01467             // HDC hDC = pInfo->PaintInfo.hdc;
01468             // HPALETTE OldPalette = PaletteManager::StartPaintPalette(hDC);
01469         
01470             ReDrawInfoType ExtraInfo;
01471         
01472             ExtraInfo.pMousePos = NULL;     // No mouse position info for redraw events
01473 
01474 
01475             // Build a CC dc out of it for rendering to the screen
01476             // Get a MFC CDC to put the DC in
01477             CCPaintDC MyDc(pGadget);
01478 
01479             ExtraInfo.pDC = &MyDc;
01480         
01481             // The devices DPI
01482             ExtraInfo.Dpi = OSRenderRegion::GetFixedDCPPI(MyDc).GetHeight();
01483 
01484             // How big the window is
01485             wxSize WindowSize = pGadget->GetClientSize();
01486             ExtraInfo.dx = (((INT32)WindowSize.GetWidth())*72000) / ExtraInfo.Dpi;
01487             ExtraInfo.dy = (((INT32)WindowSize.GetHeight())*72000) / ExtraInfo.Dpi;
01488         
01489             MyDc.GetDC()->BeginDrawing();
01490 
01491             wxRegionIterator upd(pGadget->GetUpdateRegion()); // get the update rect list
01492 
01493             BOOL Stop = FALSE;
01494 
01495             while (upd && !Stop)
01496             {
01497                 // Alternatively we can do this:
01498                 wxRect ClipRect(upd.GetRect());
01499                 // Should we clip this to the WindowSize here? For reasons which are not entirely clear, setting the
01500                 // ClipRect breaks GRenderRegions. But if we don't set the clip rect, it breaks (at least some)
01501                 // code that uses OSRenderRegion (sigh). Right now this is too painful to debug, so instead we
01502                 // cop out, and ask the control whether or not it would like a ClipRect set. Those that say no
01503                 // will paint the entire area, so we only give them one call
01504 
01505                 BOOL UseClipRect = (pGadget->IsKindOf(CLASSINFO(wxCamDrawControl)))
01506                                     && (((wxCamDrawControl*)pGadget)->GetStyle() & wxCDCS_SETCLIPRECT);
01507 
01508                 if (UseClipRect)
01509                 {
01510                     MyDc.GetDC()->SetClippingRegion(ClipRect);
01511                     ClipRect.Inflate(1,1); // work around wxRect problems.
01512                 }
01513                 else
01514                 {
01515                     ClipRect = wxRect(WindowSize);
01516                     Stop = TRUE; // cease drawing after this one
01517                 }
01518                 
01519                 DocRect DocClipRect;
01520             
01521                 // Convert to millipoints, Also need to flip the y coords to get a
01522                 // rectangle in with the origin in the bottom left.
01523                 DocClipRect.lo.x = (ClipRect.GetLeft() * 72000) / ExtraInfo.Dpi;
01524                 DocClipRect.lo.y = ExtraInfo.dy - ((ClipRect.GetBottom() * 72000) / ExtraInfo.Dpi);
01525             
01526                 DocClipRect.hi.x = (ClipRect.GetRight() * 72000) / ExtraInfo.Dpi;
01527                 DocClipRect.hi.y = ExtraInfo.dy - ((ClipRect.GetTop() * 72000) / ExtraInfo.Dpi);
01528             
01529                 // Set the pointer in the extra info structure
01530                 ExtraInfo.pClipRect = &DocClipRect;
01531             
01532                 // Build the message and send it to the dialog op
01533                 // It is up to the dialog op to build a render region etc and attach the CCDC to it
01534                 // and to tidy the region up after it has finished drawing in it CDlgMessage
01535                 BROADCAST_TO_CLASS(DialogMsg(pEvtHandler->pwxWindow, DIM_REDRAW, id, (UINT_PTR)(void *)&ExtraInfo, PageID), DialogOp);
01536                 
01537                 upd ++ ;
01538             }
01539         
01540             MyDc.GetDC()->EndDrawing();     
01541         
01542             // if (OldPalette)
01543             //  PaletteManager::StopPaintPalette(hDC, OldPalette);
01544         }
01545     }
01546 
01547     //case  wxEVT_COMMAND_TOOL_RCLICKED:
01548     //case  wxEVT_COMMAND_TOOL_ENTER:
01549 
01550 
01551     // Handle filling in ExtraInfo on redraw events
01552     if ((msg.DlgMsg != DIM_NONE) && pGadget && pGadget->IsKindOf(CLASSINFO(wxCamDrawControl)) && event.IsKindOf(CLASSINFO(wxMouseEvent)))
01553     {
01554         switch (msg.DlgMsg)
01555         {
01556             case DIM_LFT_BN_DOWN:
01557             case DIM_LFT_BN_UP:
01558             case DIM_LFT_BN_CLICKED:
01559             case DIM_RGT_BN_DOWN:
01560             case DIM_RGT_BN_UP:
01561             case DIM_RGT_BN_CLICKED:
01562             case DIM_MID_BN_DOWN:
01563             case DIM_MID_BN_UP:
01564             case DIM_MID_BN_CLICKED:
01565             case DIM_MOUSE_DRAG:
01566             case DIM_MOUSE_MOVE:
01567             case DIM_MOUSEWHEEL_UP:
01568             case DIM_MOUSEWHEEL_DOWN:
01569             {
01570 
01571                 // HDC hDC = pInfo->PaintInfo.hdc;
01572                 // HPALETTE OldPalette = PaletteManager::StartPaintPalette(hDC);
01573             
01574                 ReDrawInfoType ExtraInfo;
01575             
01576                 ExtraInfo.pMousePos = NULL;     // No mouse position info for redraw events
01577         
01578         
01579                 // Build a CC dc out of it for rendering to the screen
01580                 // Get a MFC CDC to put the DC in
01581                 CCPaintDC MyDc(pGadget);
01582         
01583                 ExtraInfo.pDC = NULL;
01584             
01585                 // The devices DPI
01586                 ExtraInfo.Dpi = OSRenderRegion::GetFixedDCPPI(MyDc).GetHeight();
01587         
01588                 // How big the window is
01589                 wxSize WindowSize = pGadget->GetClientSize();
01590                 ExtraInfo.dx = (((INT32)WindowSize.GetWidth())*72000) / ExtraInfo.Dpi;
01591                 ExtraInfo.dy = (((INT32)WindowSize.GetHeight())*72000) / ExtraInfo.Dpi;
01592 
01593                 // Work out the MILLIPOINT coordinates of the mouse position
01594                 // Note that the Y value is flipped, as the kernel-origin is at the bottom left
01595                 INT32 XPos = ((wxMouseEvent *)(&event))->GetX();
01596                 INT32 YPos = ((wxMouseEvent *)(&event))->GetY();
01597     
01598                 DocCoord MousePos;
01599                 MousePos.x = (XPos * 72000) / ExtraInfo.Dpi;
01600                 MousePos.y = ExtraInfo.dy - ((YPos * 72000) / ExtraInfo.Dpi);
01601                 ExtraInfo.pMousePos = &MousePos;
01602 
01603                 BROADCAST_TO_CLASS(DialogMsg(pEvtHandler->pwxWindow, msg.DlgMsg, id, (UINT_PTR)(void *)&ExtraInfo, PageID), DialogOp);
01604 
01605                 msg.DlgMsg = DIM_NONE; // Stop further processing
01606             }
01607 
01608             default:
01609                 break;
01610         }
01611     }
01612 
01613 
01614     // If we have a message to send, then send it (or defer it for later)
01615     if (msg.DlgMsg != DIM_NONE)
01616     {
01617         // Restore focus after selection change etc. if the dialog Op is non-modal
01618         if (!(pEvtHandler->pDialogOp->IsModal()) && (( DIM_SELECTION_CHANGED == msg.DlgMsg ) || ( DIM_SLIDER_POS_SET == msg.DlgMsg )))
01619         {
01620             TRACEUSER( "luke", _T("Change focus") );
01621             AfxGetApp().GiveActiveCanvasFocus();
01622         }
01623 
01624         if (Defer)
01625         {
01626             // We should send the message out later - we use the same ID
01627             wxCamDialogEvent deferredevent (wxEVT_CAMDIALOG_DEFERREDMSG, event.GetId(), msg);
01628             deferredevent.SetEventObject(pEvtHandler->pwxWindow);
01629             // set it for processing later
01630             pEvtHandler->pwxWindow->GetEventHandler()->AddPendingEvent(deferredevent);
01631         }
01632         else
01633         {
01634             BROADCAST_TO_CLASS( DialogMsg(msg), DialogOp );
01635         }
01636     }
01637     
01638     // If we haven't marked this message as handled, call Skip() so that others can handle
01639     // it
01640     if (!HandleMessage) event.Skip(); // we didn't handle it
01641     return;
01642 }

DialogPosition * DialogManager::FindDialogPositionRecord CDlgResID  DialogID  )  [static, private]
 

Searches the DialogPositionList to see if this dialog has been created before if it has then a pointer to its DialogPosition record is returned, else NULL is retuned. Scope: private.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
DialogID,: The dialog's resource id [INPUTS]
Returns:
The DialogPosition record for the dialog, or NULL if the dialog has not been created before

Definition at line 940 of file dlgmgr.cpp.

00941 {
00942     // Search the DialogPositionList to see if the dialog has been created before
00943     DialogPosition* DlgPos = (DialogPosition*)(DialogPositionList.GetHead());
00944     while (DlgPos != NULL)
00945     {
00946         if (DlgPos->DlgResourceID == DialogID) // The dialog has been created before
00947         {
00948             return DlgPos;
00949             break;
00950         }
00951         // Get the next DialogPosition record
00952         DlgPos = (DialogPosition*)(DialogPositionList.GetNext((ListItem*)DlgPos));
00953     }
00954     return NULL; // Dialog has not been created before
00955 }

void DialogManager::FreePaneInfoHash  )  [static]
 

Free the pane info hash if it exists Scope: protected.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
25/07/06
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
This function MUST be called ONLY after the preference system has been de-inited. This may be after dialogmanager deinit.

Definition at line 798 of file dlgmgr.cpp.

00799 {
00800     if (s_pPaneInfoHash)
00801     {
00802         delete s_pPaneInfoHash;
00803         s_pPaneInfoHash = NULL;
00804     }
00805 }

BOOL DialogManager::GadgetRedraw CWindowID  WindowID,
CGadgetID  Gadget,
BOOL  Redraw
[static]
 

This function sets a gadgets redraw state. If Redraw = FALSE then the gadget will not be redrawn when changes are made to it. Conversely if Redraw = TRUE then the Gadget will redraw itself after any changes are made.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier Redraw: TRUE to turn on gadget redraw FALSE to turn off gadget redraw
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE
For Windows -----------

This function can be called for all controls

Returns:
Errors: -
See also:
DialogOp::GadgetRedraw

Definition at line 5324 of file dlgmgr.cpp.

05325 {
05326     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05327     if (!pGadget) return FALSE;
05328 
05329     if( Redraw )
05330     {
05331         pGadget->Thaw();
05332     }
05333     else
05334     {
05335         pGadget->Freeze();
05336     }
05337 
05338     return TRUE;
05339 }

CDlgResID DialogManager::GetActivePage CWindowID  WindowID,
CGadgetID  Gadget = 0
[static]
 

To find out the currently active page in a tabbed dialog.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com> Inputs WindowID - The window GadgetID - The gadget of the book control, or zero for none
Date:
23/3/2000
Returns:
the pageID of the currently active page in an open tabbed dialog, or -1 if there isn't one
Alex unbroke this function which used to take no parameters, meaning it would only work reliably if only one tabbed dialog was up at a time... So if you are trying to call it, you now know how to fix your parameters...

For an unknown reason this function returns -1 if the gadget is not found. Which I think is wxID_OK. Who knows

DONT USE THIS FUNCTION

Definition at line 7556 of file dlgmgr.cpp.

07557 {
07558     // first check to see if we have a property sheet object
07559     wxBookCtrlBase * pBookControl = GetBookControl(WindowID, Gadget);
07560     if (pBookControl == NULL)
07561         return CDlgResID(-1);
07562 
07563     wxNotebookPage* pOurPage = pBookControl->GetCurrentPage();
07564     if (pOurPage == NULL)
07565         return CDlgResID(-1);
07566 
07567     return pOurPage->GetId();
07568 }

wxBookCtrlBase * DialogManager::GetBookControl CWindowID  WindowID,
CGadgetID  Gadget = 0
[static]
 

This function will return a pointer to the book control in a window. If the window is of type wxPropertySheetDialog then it Gadget is not required.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
11/05/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Identifier of the gadget OR zero Returns pointer to the book control or NULL
Note that the intelligence to use the default gadget won't be there until the window has been created properly and the event handler added. So if this is being called from a window creation function (like AddAPage) it is worth specifying the gadget explicitly.

Definition at line 1666 of file dlgmgr.cpp.

01667 {
01668     // No window ID? Well no book control then
01669     if (!WindowID) return NULL;
01670 
01671     // If it's a property sheet dialog then we know a quick way...
01672     if (WindowID->IsKindOf(CLASSINFO(wxPropertySheetDialog)))
01673         return ((wxPropertySheetDialog*)WindowID)->GetBookCtrl();
01674 
01675     // Let's see if there is a default gadget to use in the DialogOp
01676     if (!Gadget)
01677     {
01678         if ((WindowID->GetEventHandler())->IsKindOf(CLASSINFO(DialogEventHandler)))
01679         {
01680             DialogOp * pDialogOp = ((DialogEventHandler *)(WindowID->GetEventHandler()))->pDialogOp;
01681             // If it's a DialogTabOp, ask it for its default book gadget. If there isn't
01682             // one, that's OK too
01683             if ((pDialogOp) && (pDialogOp->IS_KIND_OF(DialogTabOp)))
01684                 Gadget=((DialogTabOp*)pDialogOp)->GetDefaultBookGadget();
01685         }
01686     }
01687 
01688     // If we were passed a gadget ID, we can go use it
01689     if (Gadget)
01690     {
01691         wxWindow * pGadget = GetGadget(WindowID, Gadget);
01692         if (pGadget->IsKindOf(CLASSINFO(wxBookCtrlBase)))
01693             return (wxBookCtrlBase*)pGadget;
01694         else
01695             return NULL;
01696     }
01697 
01698     // See if any of the children are wxBookCtrlBase
01699     wxWindowList::Node * pNode = WindowID->GetChildren().GetFirst();
01700     while (pNode)
01701     {
01702         wxWindow * child = pNode->GetData();
01703         if (child->IsKindOf(CLASSINFO(wxBookCtrlBase)))
01704             return (wxBookCtrlBase*)child;
01705         pNode = pNode->GetNext();
01706     }
01707 
01708     // OK, they aren't. Recurse through them
01709     pNode = WindowID->GetChildren().GetFirst();
01710     while (pNode)
01711     {
01712         wxBookCtrlBase * pBook=GetBookControl(WindowID, 0);
01713         if (pBook)
01714             return pBook;
01715         pNode = pNode->GetNext();
01716     }
01717 
01718     return NULL;
01719 }

BOOL DialogManager::GetBoolGadgetSelected CWindowID  WindowID,
CGadgetID  Gadget,
UINT32  IDSInvalidMsg = 0,
BOOL *  Valid = NULL,
INT32  ListPos = 0
[static]
 

This function will obtain the gadget value and validate it. Validation will check that a correct INT32 value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value. [This does not seem correct - AMB].

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/4/94
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Dialog identifier InvalidMsgID: Message displayed to the user when they have entered invalid data (either not the correct type or not in the correct range) This may be 0 if you do not wish an error to be reported ListPos: Specifies which item in a list to read (defaults to 0)
Valid,: Flag indicating if the value entered was valid or not. [OUTPUTS] If the Valid parameter is NULL, then validity of the result will not be checked, and the actual value of the control will be returned even if it was "invalid". If this flag is returned FALSE then the return value will be 0.
Returns:
The value entered by the user. If Valid is FALSE then FALSE will be returned.
For Windows -----------

The function can be used to obtain a BOOL value from the following controls:

Button ListBox cc_CheckList

For ListBox/cc_CheckList controls the bool value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetLongGadgetValue

Definition at line 4215 of file dlgmgr.cpp.

04220 {
04221     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04222     if (!pGadget) return FALSE;
04223 
04224     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04225         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04226         pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) ||
04227         pGadget->IsKindOf(CLASSINFO(wxChoice)) )
04228     {
04229         // Support listboxes with multiple selections
04230         if (pGadget->IsKindOf(CLASSINFO(wxListBox)))
04231         {
04232             return ((wxListBox *)pGadget)->IsSelected(ListPos);
04233         }
04234         if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04235             return (((wxOwnerDrawnComboBox *)pGadget)->GetSelection() == ListPos);
04236         else
04237             return (((wxControlWithItems *)pGadget)->GetSelection() == ListPos);
04238     }
04239 
04240     return GetLongGadgetValue(WindowID, Gadget, 0, 1, IDSInvalidMsg, Valid);
04241 }

List * DialogManager::GetControlList CWindowID  hWnd  )  [static, private]
 

Hide the mechanism we use to attach our lists to various windows. In fact we use window properties.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
A Window handle [INPUTS]
- [OUTPUTS]
Returns:
A pointer to its special list, or NULL if it doesn't have one.

Errors: -

See also:
- Scope: Private, static

Definition at line 6449 of file dlgmgr.cpp.

06450 {
06451     PORTNOTETRACE("dialog","DialogManager::GetControlList - do nothing");
06452 #ifndef EXCLUDE_FROM_XARALX
06453     HANDLE Prop = GetProp( hWnd, MAKEINTATOM(GetListAtom) );    // Atoms & Properties are fast
06454     if (Prop)
06455     {
06456     #if WIN32
06457         return (List*)(INT32)Prop;
06458     #else
06459         HANDLE Seg = GetProp( hWnd, MAKEINTATOM(GetListAtomSegment) );
06460         INT32 ptr = MAKEINT32( Prop, Seg );
06461         return (List*)ptr;
06462     #endif
06463     }
06464     else
06465 #endif
06466         return NULL;
06467 }

MILLIPOINT DialogManager::GetDimensionGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
Node pNode,
BOOL *  Valid = NULL,
INT32  ListPos = -1
[static]
 

This is the routine to call for getting user-entered dimensions from a control. The value is scaled from user dimensions to an internal millipoint value. The routine uses DialogManager::GetStringGadgetValue to extract the string from the control. The caller should be aware of the features/limitations of this routine before calling GetDimensionGadgetValue.

Returns:
The internal millipoint representation of the string in this control

Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.

See also:
DialogOp::GetDimensionGadgetValue

DialogManager::GetStringGadgetValue

Definition at line 4483 of file dlgmgr.cpp.

04488 {
04489     MILLIPOINT Val=72000;
04490     DimScale* pDimScale = DimScale::GetPtrDimScale(pNode);
04491     String_256 Str;
04492 
04493     Str = GetStringGadgetValue(WindowID,Gadget,Valid,ListPos);
04494     if (Valid != NULL && *Valid)
04495         *Valid = pDimScale->ConvertToMillipoints(Str,&Val);
04496     return Val;
04497 }

BOOL DialogManager::GetDoubleAndUnitGadgetValue double *  pMPValue,
double *  pUnitValue,
UnitType pUnitType,
CWindowID  WindowID,
CGadgetID  Gadget,
Node pNode
[static]
 

Read the value from a gadget as a double millipont values accounting for unit scaling ALSO read the type of unit specified and the gadget value in terms of these units ie 0.5m would return 36000.0, 0.5 and METERS (assuming scaling 1m->1in).

BOOL DialogManager::GetDoubleAndUnitGadgetValue(double* pMPValue, double* pUnitValue, UnitType* pUnitType, CWindowID WindowID, CGadgetID Gadget, Node* pNode)

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/95
Parameters:
WindowID - [INPUTS] Gadget - pNode - node from which to determine default units (ie page units)
pMPValue - value of gadget converted to millipoints (accounting for scaling) [OUTPUTS] pUnitValue - value of gadget in terms of units output in pUnitType pUnitType - type of unit the value was specified in (or page units if none)
Returns:
FALSE if fails

Definition at line 4521 of file dlgmgr.cpp.

04527 {
04528     ERROR2IF(  pMPValue==NULL,FALSE,"DialogManager::GetDoubleAndUnitGadgetValue() - pMPValue==NULL");
04529     ERROR2IF(pUnitValue==NULL,FALSE,"DialogManager::GetDoubleAndUnitGadgetValue() - pUnitValue==NULL");
04530     ERROR2IF( pUnitType==NULL,FALSE,"DialogManager::GetDoubleAndUnitGadgetValue() - pUnitType==NULL");
04531     ERROR2IF(     pNode==NULL,FALSE,"DialogManager::GetDoubleAndUnitGadgetValue() - pNode==NULL");
04532     DimScale* pDimScale = DimScale::GetPtrDimScale(pNode);
04533     ERROR2IF( pDimScale==NULL,FALSE,"DialogManager::GetDoubleAndUnitGadgetValue() - pDimScale==NULL");
04534 
04535     // separate string into double value and unit type
04536     BOOL     ok         = TRUE;
04537     double   UnitValue  = 1.0;
04538     UnitType units;
04539     String_256 GadgetString=GetStringGadgetValue(WindowID,Gadget,&ok);
04540     if (ok) ok=Convert::StringToComponents(GadgetString, &UnitValue, &units);
04541     if (!ok) return FALSE;
04542 
04543     // if no unit type specified, use units associated with the specified node
04544     if (units==NOTYPE)
04545         units=pDimScale->GetUnits();
04546 
04547     // and get the value in millipoints accounting for scaled units
04548     double MPValue = 1.0;
04549     ok=pDimScale->ConvertToDouble(GadgetString,&MPValue);
04550     if (!ok) return FALSE;
04551 
04552     // set outputs and return
04553     *pMPValue   = MPValue;
04554     *pUnitValue = UnitValue;
04555     *pUnitType  = units;
04556 
04557     return TRUE;
04558 }

double DialogManager::GetDoubleGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
double  StartRange,
double  EndRange,
UINT32  IDSInvalidMsg = 0,
BOOL *  Valid = NULL,
Convert::PFNSTRINGTODOUBLE  pfnParser = Convert::StringToDouble
[static]
 

This function will obtain the gadget value and validate it. Validation will check that a correct double value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com> (liberally copied from GetLongGadgetValue)
Date:
16/12/94
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Dialog identifier StartRange: Minimum gadget value EndRange: Maximum gadget value InvalidMsgID: Message displayed to the user when they have entered invalid data (either not the correct type or not in the correct range) This may be 0 if you do not wish an error to be reported pfnParser optional pointer to a function that converts a StringBase to a double. The default is:- double StringToDouble(StringBase* in, Double* out) but any function with a similar prototype will work. This function is called for controls that contain text, eg. a combo-box. Ask JustinF about this if you aren't sure.
Valid,: Flag indicating if the value entered was valid or not. [OUTPUTS] If the Valid parameter is NULL, then validity of the result will not be checked, and the actual value of the control will be returned even if it was out of range. If this flag is returned FALSE then the return value will be 0.
Returns:
The value entered by the user. If Valid is FALSE then NULL will be returned.
For Windows -----------

The function can be used to obtain a double value from the string value of the following controls:

Edit ListBox ComboBox Static cc_CheckList Button

For ListBox and ComboBox controls the INT32 value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

You can override the conversion from the string value to the double by providing your own pfnParser parameter. This could, for example, remove percentage signs from the text before conversion.

For Button controls this function returns back the current state of the button

For ScrollBar controls this function returns back the current position of the scroll bars thumb.

For cc_Slider controls this function returns the current position of the bar in the slider.

Note for some controls, like sliders, the value comes back as an INT32 converted to a double so you might as well use GetLongGadgetValue.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetDoubleGadgetValue, DialogManager::GetLongGadgetValue

Definition at line 4113 of file dlgmgr.cpp.

04120 {
04121     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04122     if (!pGadget) return FALSE;
04123 
04124     if (( pGadget->IsKindOf(CLASSINFO(wxButton))) ||
04125         ( pGadget->IsKindOf(CLASSINFO(wxBitmapButton))) ||
04126         ( pGadget->IsKindOf(CLASSINFO(wxCheckBox))) ||
04127         ( pGadget->IsKindOf(CLASSINFO(wxRadioButton))) ||
04128         ( pGadget->IsKindOf(CLASSINFO(wxScrollBar))) ||
04129         ( pGadget->IsKindOf(CLASSINFO(wxSlider))) ||
04130         ( pGadget->IsKindOf(CLASSINFO(wxSliderCombo))) ||
04131         ( pGadget->IsKindOf(CLASSINFO(wxGauge)))
04132         )
04133         return (double)GetLongGadgetValue( WindowID, Gadget, (INT32)(floor(StartRange+0.5)), (INT32)(floor(EndRange+0.5)), IDSInvalidMsg, Valid);
04134 
04135     String_256 StrValue = GetStringGadgetValue(WindowID, Gadget, NULL);
04136 
04137     // Convert the string to an INT32 if it's valid
04138     double Value=0.0;
04139     BOOL IsValid = (*pfnParser)(StrValue, &Value);
04140     if (IsValid)
04141     {
04142         IsValid = ((Value >= StartRange) && (Value <= EndRange));
04143     }
04144 
04145     if (Valid != NULL)
04146     {
04147         *Valid = IsValid;
04148 
04149         if (!IsValid)   // The value is invalid
04150         {
04151             if (IDSInvalidMsg != 0)
04152                 InformWarning(IDSInvalidMsg); // Scold the user, if a message was supplied
04153             return (0);
04154         }
04155     }
04156 
04157     return Value; // Valid input, or caller did not want validation
04158 }

INT32 DialogManager::GetFirstSelectedItem CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Returns the index of the first selected item in a list-type gadget.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/95
Parameters:
WindowID = ID of window that contains the gadget [INPUTS] Gadget = ID of list-type gadget
Returns:
The index of the firsted selected items in the list-type gadget, or -1 if it fails
See also:
-

Definition at line 4898 of file dlgmgr.cpp.

04899 {
04900     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04901     if (!pGadget) return -1;
04902 
04903     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04904         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04905         pGadget->IsKindOf(CLASSINFO(wxChoice)) )
04906     {
04907         // Support listboxes with multiple selections
04908         if (pGadget->IsKindOf(CLASSINFO(wxListBox)))
04909         {
04910             wxArrayInt sels;
04911             if ( ((wxListBox *)pGadget)->GetSelections(sels) )
04912             {
04913                 return sels[0];
04914             }
04915             return -1;
04916         }
04917         return ((wxControlWithItems *)pGadget)->GetSelection();
04918     }
04919     else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04920         return ((wxOwnerDrawnComboBox *)pGadget)->GetSelection();
04921 
04922     return -1;
04923 }

wxWindow * DialogManager::GetGadget CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Author:
Alex Bligh (alex@alex.org.uk)
Date:
20/12/2005
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier StrID: Resource ID of string

Definition at line 2818 of file dlgmgr.cpp.

02819 {
02820     ERROR2IF(!WindowID || !WindowID->IsKindOf(CLASSINFO(wxWindow)), FALSE, "Bad Window ID passed");
02821     wxWindow * pGadget=WindowID->FindWindow(Gadget);
02822 //  TRACEUSER("amb",_T("pwxDialog=0x%016llx Gadget=%d(%s) pGadget=0x%016llx"), WindowID, Gadget, CamResource::GetObjectName((ResourceID)Gadget), pGadget);
02823     if (!pGadget)
02824     {
02825         // Some dialogs seem to consciously do this, EG galleries
02826 //      ERROR3_PF((_T("Bad Gadget ID %d(%s) passed"), Gadget, CamResource::GetObjectName((ResourceID)Gadget)));
02827         return NULL;
02828     }
02829 #if 0
02830     const TCHAR * pGadgetClassName = (const TCHAR *) pGadget->GetClassInfo()->GetClassName();
02831     TRACEUSER("amb",_T("Gadget is a %s"),pGadgetClassName);
02832 #endif
02833     return pGadget;
02834 }

ResourceID DialogManager::GetGadgetBitmap CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

This function will get the bitmaps associated with a gadget.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
07/05/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Identifier of the gadget
Returns:
The resourse ID of the bitmap

Definition at line 2121 of file dlgmgr.cpp.

02122 {
02123     wxWindow* pGadget = GetGadget(WindowID, Gadget);
02124     if (!pGadget) return 0;
02125 
02126     if ( pGadget->IsKindOf(CLASSINFO(wxCamArtControl))
02127         )
02128     {
02129         return ((wxCamArtControl *)pGadget)->GetBitmapId();
02130     }
02131     return 0;
02132 }

UINT32 DialogManager::GetGadgetImageCount CWindowID  wnd,
CGadgetID  Gadget
[static]
 

To get the number of images set in the trree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier
- [OUTPUTS]
Returns:
Number of images in tree control

Definition at line 9363 of file dlgmgr.cpp.

09364 {
09365     ERROR3("Unimplemented!");
09366     return 0;
09367 }

OpDescriptor * DialogManager::GetGadgetOpDescriptor CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Author:
Alex Bligh (alex@alex.org.uk)
Date:
20/12/2005
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Returns:
pointer to an OpDescriptor, or NULL if not found

Definition at line 2848 of file dlgmgr.cpp.

02849 {
02850     wxWindow * pWindow = GetGadget(WindowID, Gadget);
02851     if (!pWindow) return NULL;
02852 
02853     // If it's not a wxControl, return
02854     if (!pWindow->IsKindOf(CLASSINFO(wxControl)))
02855         return NULL;
02856 
02857     wxControl * pControl = (wxControl *)pWindow;
02858     return ControlList::Get()->Find(pControl);
02859 }

BOOL DialogManager::GetGadgetPosition CWindowID  WindowID,
CGadgetID  Gadget,
RECT pRect
[static]
 

Definition at line 7301 of file dlgmgr.cpp.

07302 {
07303     wxRect Rect;
07304     if (!GetGadgetPosition(WindowID, Gadget, &Rect)) return FALSE;
07305     pRect->bottom=Rect.GetBottom();
07306     pRect->top=Rect.GetTop();
07307     pRect->left=Rect.GetLeft();
07308     pRect->right=Rect.GetRight();
07309     return TRUE;
07310 }

BOOL DialogManager::GetGadgetPosition CWindowID  WindowID,
CGadgetID  Gadget,
wxRect *  pRect
[static]
 

Allows the user to get the current position of the specified gadget or icon.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/97
Parameters:
WindowID Handle of window [INPUTS] Gadget The icon or gadget that we are interested in.
Rect pointer to the rectangle to fill in [OUTPUTS]
Returns:
True if the call was successful, FALSE otherwise.
See also:
DialogOp::GetGadgetPosition; DialogManager::SetGadgetPosition;

Definition at line 7289 of file dlgmgr.cpp.

07290 {
07291     wxWindow * pGadget = GetGadget(WindowID, Gadget);
07292     if (!pGadget) return FALSE;
07293 
07294     // We just need to pass back the normal position of the window
07295     if (pRect)
07296         *pRect = pGadget->GetSize();
07297 
07298     return TRUE;
07299 }

BOOL DialogManager::GetGadgetRange CWindowID  WindowID,
CGadgetID  Gadget,
INT32 *  Min,
INT32 *  Max
[static]
 

For obtaining the range of a gadget.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Min,: Minimum range value [OUTPUTS] Max: Maximum range value
Returns:
TRUE if the gadget's range could be read, FALSE otherwise
For Windows -----------

The function returns a ScrollBar control's Min and Max values.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetGadgetRange

Definition at line 4412 of file dlgmgr.cpp.

04416 {
04417     INT32 min=0;
04418     INT32 max=0;
04419 
04420     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04421     if (!pGadget) return FALSE;
04422 
04423     if ( pGadget->IsKindOf(CLASSINFO(wxScrollBar)) )
04424     {
04425         max = ((wxScrollBar *)pGadget)->GetRange();
04426     }
04427 
04428     if ( pGadget->IsKindOf(CLASSINFO(wxSlider)) )
04429     {
04430         min=((wxSlider *)(pGadget))->GetMin();
04431         max=((wxSlider *)(pGadget))->GetMax();
04432     }
04433 
04434     if ( pGadget->IsKindOf(CLASSINFO(wxSliderCombo)) )
04435     {
04436         min=((wxSliderCombo *)(pGadget))->GetSliderMin();
04437         max=((wxSliderCombo *)(pGadget))->GetSliderMax();
04438     }
04439 
04440     if ( pGadget->IsKindOf(CLASSINFO(wxGauge)) )
04441     {
04442         max = ((wxGauge *)(pGadget))->GetRange();
04443     }
04444 
04445     if (Min) *Min=min;
04446     if (Max) *Max=max;
04447 
04448     return TRUE;
04449 }

BOOL DialogManager::GetKernelRenderedGadgetInfo CWindowID  WindowID,
CGadgetID  Gadget,
ReDrawInfoType Result
[static]
 

Allows the user access to the same information which is passed in to DIM_REDRAW and the kernel-rendered-dialogue mouse-handling messages. This is just for convenience so they can calculate stuff at a time other than handling those two types of dialogue event (e.g. if a document message causes you to have to redraw a small portion of your gadget, you need this information to calculate the invalidation rectangle from).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/1/95
Parameters:
WindowID - The parent window identifier [INPUTS] Gadget - The ID of the gadget that you want info for
Returns:
FALSE if there was a catastrophic error (it will report an ERROR2 if necessary), in which case the returned data is invalid (well, it defaults to 96 Dpi and an area of 72000x72000 millipoints, so is 'safe' to use, but probably wrong) TRUE under normal conditions
Parameters:
Result - will be returned filled in with appropriate kernel-rendered- [OUTPUTS] dialogue information (dx, dy, and Dpi will be filled in with the appropriate values; pMousePOs, pDC, and pClipRect will all be NULL)

Definition at line 5782 of file dlgmgr.cpp.

05784 {
05785     ERROR3IF(WindowID == 0 || Gadget == 0 || Result == NULL,
05786         "DialogManager::GetKernelRenderedGadgetInfo: NULL parameters are illegal!");
05787 
05788     // For the time being, we do this by Hide/Unhide
05789     wxWindow * pTheWindow = GetGadget(WindowID, Gadget);
05790     if (!pTheWindow) return FALSE;
05791 
05792     Result->pDC = NULL;
05793     Result->pClipRect = NULL;
05794     Result->pMousePos = NULL;
05795 
05796     // Install some 'safe' defaults, just in case of serious error
05797     Result->dx = Result->dy = 72000;
05798     Result->Dpi = 96;
05799 
05800     // If a totally rampant call, error (debug) and return failure
05801     ERROR3IF( NULL == pTheWindow,
05802                 "DialogManager::GetKernelRenderedGadgetInfo - Illegal window/gadget");
05803     if( pTheWindow == 0 )
05804         return(FALSE);
05805 
05806     // Get the screen DPI
05807     wxScreenDC          ScreenDC;
05808 PORTNOTE("dialog","Can't handle different DPIs, using X")
05809     Result->Dpi = OSRenderRegion::GetFixedDCPPI(ScreenDC).x; // x;
05810 
05811     // Calculate how big the window is, in MILLIPOINTS
05812     wxSize              WindowSize( pTheWindow->GetClientSize() );
05813 
05814     Result->dx = ( INT32(WindowSize.GetWidth())*72000 ) / Result->Dpi;
05815     Result->dy = ( INT32(WindowSize.GetHeight())*72000) / Result->Dpi;
05816     return(TRUE);
05817 }

INT32 DialogManager::GetLongGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
INT32  StartRange,
INT32  EndRange,
UINT32  IDSInvalidMsg = 0,
BOOL *  Valid = NULL,
Convert::PFNSTRINGTOINT32  pfnParser = Convert::StringToLong
[static]
 

This function will obtain the gadget value and validate it. Validation will check that a correct INT32 value has been entered, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Dialog identifier StartRange: Minimum gadget value EndRange: Maximum gadget value InvalidMsgID: Message displayed to the user when they have entered invalid data (either not the correct type or not in the correct range) This may be 0 if you do not wish an error to be reported pfnParser optional pointer to a function that converts a StringBase to a INT32. The default is:- BOOL StringToLong(StringBase* in, INT32* out) but any function with a similar prototype will work. This function is called for controls that contain text, eg. a combo-box. Ask JustinF about this if you aren't sure.
Valid,: Flag indicating if the value entered was valid or not. [OUTPUTS] If the Valid parameter is NULL, then validity of the result will not be checked, and the actual value of the control will be returned even if it was out of range. If this flag is returned FALSE then the return value will be 0.
Returns:
The value entered by the user. If Valid is FALSE then NULL will be returned.
For Windows -----------

The function can be used to obtain a INT32 value from the string value of the following controls:

Edit ListBox ComboBox Static cc_CheckList Button

For ListBox and ComboBox controls the INT32 value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

You can override the conversion from the string value to the INT32 by providing your own pfnParser parameter. This could, for example, remove percentage signs from the text before conversion.

For Button controls this function returns back the current state of the button

For ScrollBar controls this function returns back the current position of the scroll bars thumb.

For cc_Slider controls this function returns the current position of the bar in the slider.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetLongGadgetValue

Definition at line 3928 of file dlgmgr.cpp.

03935 {
03936     wxWindow * pGadget = GetGadget(WindowID, Gadget);
03937     if (!pGadget) return FALSE;
03938 
03939     if ( pGadget->IsKindOf(CLASSINFO(wxButton)) ||
03940         pGadget->IsKindOf(CLASSINFO(wxBitmapButton)) )
03941     {
03942         // These bitmap buttons are meant to be tristate
03943         PORTNOTETRACE("dialog","DialogManager::GetLongGadgetValue on BitmapButton - do nothing");
03944         return 0;
03945     }
03946 
03947     if ( pGadget->IsKindOf(CLASSINFO(wxCheckBox)) )
03948     {
03949         if (Valid) *Valid=TRUE;
03950         return ((wxCheckBox *)(pGadget))->GetValue() != 0;
03951     }
03952 
03953     if ( pGadget->IsKindOf(CLASSINFO(wxRadioButton)) )
03954     {
03955         if (Valid) *Valid=TRUE;
03956         return ((wxRadioButton *)(pGadget))->GetValue() != 0;
03957     }
03958 
03959     if ( pGadget->IsKindOf(CLASSINFO(wxScrollBar)) )
03960     {
03961         if (Valid) *Valid=TRUE;
03962         return (INT32)(((wxScrollBar *)(pGadget))->GetThumbPosition());
03963     }
03964 
03965     if ( pGadget->IsKindOf(CLASSINFO(wxSlider)) )
03966     {
03967         if (Valid) *Valid=TRUE;
03968         return (INT32)(((wxSlider *)(pGadget))->GetValue());
03969     }
03970 
03971     if ( pGadget->IsKindOf(CLASSINFO(wxSliderCombo)) )
03972     {
03973         if (Valid) *Valid=TRUE;
03974         return (INT32)(((wxSliderCombo *)(pGadget))->GetSliderValue());
03975     }
03976 
03977     if ( pGadget->IsKindOf(CLASSINFO(wxGauge)) )
03978     {
03979         if (Valid) *Valid=TRUE;
03980         return (INT32)(((wxGauge *)(pGadget))->GetValue());
03981     }
03982 
03983     if ( pGadget->IsKindOf(CLASSINFO(wxCamArtControl)) )
03984     {
03985         if (Valid) *Valid=TRUE;
03986         return (INT32)(((wxCamArtControl *)(pGadget))->GetValue());
03987     }
03988 
03989 #if 0
03990     // it seems on an edit box we might be meant to set the garet, but it's difficult to know what's
03991     // going on here
03992     else if (ClassNameStr == String_16(TEXT("cc_CustomEdit")))//?
03993     {
03994         CCustomEdit* pCEdit = (CCustomEdit*)CWnd::FromHandlePermanent(hGadget);
03995         Value = pCEdit->GetPos();
03996         IsValid = ((Value >= StartRange) && (Value <= EndRange));
03997         TRACEUSER( "Marc", _T("dlgmgr.cpp, getting pos %d\n"),Value);
03998     }
03999 #endif
04000 
04001     // Hmmm - no luck so far, let's try a string
04002 
04003     // Obtain the controls text
04004     String_256 StrValue = GetStringGadgetValue(WindowID, Gadget, NULL);
04005 
04006     // Convert the string to an INT32 if it's valid
04007     INT32 Value=0;
04008     BOOL IsValid = (*pfnParser)(StrValue, &Value);
04009     if (IsValid)
04010     {
04011         IsValid = ((Value >= StartRange) && (Value <= EndRange));
04012     }
04013 
04014     if (Valid != NULL)
04015     {
04016         *Valid = IsValid;
04017 
04018         if (!IsValid)   // The value is invalid
04019         {
04020             if (IDSInvalidMsg != 0)
04021                 InformWarning(IDSInvalidMsg); // Scold the user, if a message was supplied
04022             return (0);
04023         }
04024     }
04025 
04026     return Value; // Valid input, or caller did not want validation
04027 }

UINT32 DialogManager::GetMemoryGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
UINT32  StartRange,
UINT32  EndRange,
UINT32  IDSInvalidMsg = 0,
BOOL *  Valid = NULL
[static]
 

This function allows a memory value to be read back from a control. It will cope with the memory being specified in bytes, K, M or G bytes and will also validate it. Validation will check that data has been entered in a correct unit type, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/1/95
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Dialog identifier StartRange: Minimum gadget value EndRange: Maximum gadget value InvalidMsgID: Message displayed to the user when they have entered invalid data (either not the correct type or not in the correct range) This may be 0 if you do not wish an error to be reported
Valid,: Flag indicating if the value entered was valid or not. [OUTPUTS] If the Valid parameter is NULL, then validity of the result will not be checked, and the actual value of the control will be returned even if it was out of range. If this flag is returned FALSE then the return value will be 0.
Returns:
The value entered by the user in bytes. If Valid is FALSE then NULL will be returned.
For Windows -----------

The function can be used to obtain a memory value from the string value of the following controls:

Edit ListBox ComboBox Static

For ListBox and ComboBox controls the unit value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetMemoryGadgetValue; DialogOp::SetMemoryGadgetValue

Definition at line 4619 of file dlgmgr.cpp.

04625 {
04626     BOOL IsValid;
04627 
04628     // Obtain the controls text
04629     String_256 StrValue = GetStringGadgetValue(WindowID, Gadget, NULL);
04630 
04631     // Convert the string to millipoints if it's valid
04632     UINT32 Value = Convert::StringToBytes(StrValue, &IsValid);
04633 
04634     if (Valid == NULL)      // If don't want it validated, return the value now
04635         return(Value);
04636 
04637     if (IsValid)
04638     {
04639         // Check that the value is in the range StartRange..EndRange
04640         if ((Value >= StartRange) && (Value <= EndRange))
04641         {
04642             *Valid = TRUE;
04643             return (Value); // A correct value was entered
04644         }
04645     }
04646 
04647     // The value is invalid
04648     if (IDSInvalidMsg != 0)
04649         InformWarning(IDSInvalidMsg); // Scold the user, if a message was supplied
04650 
04651     return( 0 );
04652 }

CWindowID DialogManager::GetPageWindow CWindowID  Win,
CDlgResID  PageID,
INT32 *  PageIndex = NULL
[static]
 

Returns the Window ID of a page within a property sheet. If the page is NULL then Win is simply returned, It can be called on a non property sheet dialog. Just pretend that they are property sheets without any pages.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/94
Parameters:
Win,: The windowID [INPUTS] PageID: A page resource identifier, If this is not NULL then the WindowID must be that of a Property sheet. We ENSURE that this is true.
Optionally returns the page index [OUTPUTS]
Returns:
Window ID of a page within a property sheet

Errors: -

See also:
-

Definition at line 7117 of file dlgmgr.cpp.

07118 {
07119     if (PageID == 0)
07120     {
07121         return Win; // A page is not required
07122     }
07123 
07124     wxBookCtrlBase* pBookCtrl = GetBookControl(Win);
07125     if (!pBookCtrl)
07126     {
07127         ERROR3("No BookControl found");
07128         return Win;
07129     }
07130 
07131     wxNotebookPage* pCurrentPage;
07132 
07133     // Find the window ID of the page
07134     for (UINT32 i = 0; i < pBookCtrl->GetPageCount(); i++)
07135     {
07136         pCurrentPage =  (wxNotebookPage*)(pBookCtrl->GetPage(i));
07137         if (pCurrentPage->GetId() == INT32(PageID) )
07138         {
07139             if (PageIndex != NULL)
07140             {
07141                 *PageIndex = i;
07142             }
07143             // Found page so return window id
07144             return pCurrentPage;
07145         }
07146     }
07147     ERROR3("The page specified does not exist on this tabbed dialog");
07148     return Win; // Probably safer than NULL
07149 }

wxPropertySheetDialog * DialogManager::GetPropertySheetFromOp DialogTabOp pDialogTabOp  )  [static, private]
 

Author:
Luke_Hart (xara group ltd) <lukeh@xara.com> created: 28/04/06 inputs: pdialogtabop: the operation we wish to find the property sheet for outputs: - returns: The associated Property sheet (or NULL if none) purpose: Find the property sheet associated with the passed DialogTabOp errors: - seealso: -

Definition at line 6977 of file dlgmgr.cpp.

06978 {
06979     wxWindow * pWindow = pDialogTabOp->WindowID;
06980     return pWindow->IsKindOf(CLASSINFO(wxPropertySheetDialog))?(wxPropertySheetDialog*)pWindow:NULL;
06981 }

INT32 DialogManager::GetScreenDpi  )  [static]
 

Allows the user to find out the screen dpi.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/97
Returns:
0 or the dpi of the screen.
See also:
DialogOp::GetScreenDpi;

Definition at line 7384 of file dlgmgr.cpp.

07385 {
07386     // Get the screen DPI
07387     wxScreenDC          ScreenDC;
07388 PORTNOTE("dialog","Can't handle different DPIs, using X")
07389     return OSRenderRegion::GetFixedDCPPI(ScreenDC).x;
07390 }

BOOL DialogManager::GetScreenSize INT32 *  pWidth,
INT32 *  pHeight
[static]
 

Allows the user to find out the screen size.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/97
Parameters:
pWidth the screen width in pixels [OUTPUTS] pHeight the screen height in pixels
Returns:
True if worked ok, False otherwise.
See also:
DialogOp::GetScreenDpi;

Definition at line 7406 of file dlgmgr.cpp.

07407 {
07408     ERROR2IF(pWidth == NULL || pHeight == NULL,FALSE,"GetScreenSize Bad params!");
07409 
07410     // HORZRES  Width, in pixels, of the screen.
07411     // VERTRES  Height, in raster lines, of the screen.
07412     INT32               Width  = wxSystemSettings::GetMetric( wxSYS_SCREEN_X );
07413     INT32               Height = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
07414 
07415     // Tell the caller about the new values
07416     *pWidth = Width;
07417     *pHeight = Height;
07418 
07419     return TRUE;
07420 }

INT32 DialogManager::GetSelectedCount CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Returns the number of selected items in a list-type gadget.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/95
Parameters:
WindowID = ID of window that contains the gadget [INPUTS] Gadget = ID of list-type gadget
Returns:
The number of selected items in the list-type gadget, or -1 if it fails
See also:
-

Definition at line 4858 of file dlgmgr.cpp.

04859 {
04860 //  INT32 Count = -1;
04861     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04862     if (!pGadget) return FALSE;
04863 
04864     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04865         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04866         pGadget->IsKindOf(CLASSINFO(wxChoice))
04867         )
04868     {
04869         // Support listboxes with multiple selections
04870         if (pGadget->IsKindOf(CLASSINFO(wxListBox)))
04871         {
04872             wxArrayInt sels;
04873             return ((wxListBox *)pGadget)->GetSelections(sels);
04874         }
04875 
04876         return (((wxControlWithItems *)pGadget)->GetSelection() == wxNOT_FOUND)?0:1;
04877     }
04878     else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04879         return (((wxOwnerDrawnComboBox *)pGadget)->GetSelection() == wxNOT_FOUND)?0:1;
04880 
04881     return -1;
04882 }

INT32 * DialogManager::GetSelectedItems CWindowID  WindowID,
CGadgetID  Gadget
[static]
 

Returns a ptr to an INT32 array that holds the list of selected indexes. The last array entry contains -1.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/95
Parameters:
WindowID = ID of window that contains the gadget [INPUTS] Gadget = ID of list-type gadget
Returns:
ptr to the INT32 array, or NULL if it fails
NULL is returned if there's no selection, or not enough memory for the required array

The caller is responsible for deleting the array that's returned. e.g INT32* pArray = GetSelectedItems(WindowID,Gadget); if (pArray != NULL) { ..... // Use the array delete [] pArray; }

See also:
-

Definition at line 4951 of file dlgmgr.cpp.

04952 {
04953     INT32* pList = NULL;
04954 
04955     wxArrayInt sels;
04956 
04957     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04958     if (!pGadget) return NULL;
04959 
04960     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04961         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04962         pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) ||
04963         pGadget->IsKindOf(CLASSINFO(wxChoice)) )
04964     {
04965         // Support listboxes with multiple selections
04966         if (pGadget->IsKindOf(CLASSINFO(wxListBox)))
04967         {
04968             ((wxListBox *)pGadget)->GetSelections(sels);
04969         }
04970         else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04971         {
04972             sels[0]=((wxOwnerDrawnComboBox *)pGadget)->GetSelection();
04973         }
04974         else
04975         {
04976             sels[0]=((wxControlWithItems *)pGadget)->GetSelection();
04977         }
04978 
04979         size_t Count = sels.GetCount();
04980 
04981         pList = new INT32[Count+1];
04982 
04983         if (pList)
04984         {
04985             UINT32 i;
04986             for (i=0; i<Count; i++)
04987             {
04988                 pList[i]=sels[i];
04989             }
04990             pList[Count] = -1;  // terminate the list
04991         }
04992 
04993         return pList; // may be NULL if no memory
04994 
04995     }
04996     return NULL;
04997 }

BOOL DialogManager::GetStatusLineText String_256 ptext,
CWindowID  window
[static]
 

Fills in the status line text from the help text if over a control Scope: Public.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
15/05/2006
Parameters:
window - the window ID, or NULL for the current mouse position [INPUTS]
pText - pointer to the text to fill in [OUTPUTS]
Returns:
TRUE on success else FALSE

Errors: -

See also:
-

Definition at line 7824 of file dlgmgr.cpp.

07825 {
07826     if (!ptext)
07827         return FALSE;
07828     if (!window)
07829         window=::wxChildWindowFromPoint(wxGetMousePosition(), FALSE, -1);
07830     if (!window)
07831         return FALSE;
07832 
07833     wxHelpProvider * hp = wxHelpProvider::Get();
07834 
07835     // Now some controls contain other controls, so we look down the heirarch if we can't find one
07836     // immediately
07837     wxString help;
07838     do
07839     {
07840         if (!window->IsKindOf(CLASSINFO(wxControl)))
07841             return FALSE;
07842 
07843         if (hp)
07844             help = hp->GetHelp(window);
07845         else
07846             help = ((wxControl *)window)->GetHelpText();
07847 
07848         if (help.IsEmpty())
07849         {
07850             wxToolTip* pTip = window->GetToolTip();
07851             if (pTip) help=pTip->GetTip();
07852         }
07853 
07854         window=window->GetParent();
07855     } while (window && help.IsEmpty());
07856 
07857     if (help.IsEmpty())
07858         return FALSE;
07859 
07860     *ptext = help;
07861     return TRUE;
07862 }

String_256 DialogManager::GetStringGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
BOOL *  Valid = NULL,
INT32  ListPos = -1
[static]
 

For finding a gadgets string value. This function can only be used for gadgets with a text value.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier ListPos: Index into list if needed (defaults to -1 to mean read the text of the selected item. In the case of a combo this is the text in the editable field - which may be a value which does not exist in the combo's list.
Valid,: Flag indicating if the string could be read or not [OUTPUTS] You may pass NULL if you don't care about the validity (if invalid, the returned string will be a NULL string)
Returns:
The gadgets string value if Valid is TRUE, else a NULL string
For Windows -----------

This function returns the string value for the following controls

Edit ListBox ComboBox Static Button

For ListBox and ComboBox controls the string value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetStringGadgetValue

Definition at line 4294 of file dlgmgr.cpp.

04298 {
04299     if (Valid)
04300         *Valid = TRUE;
04301     String_256 StrVal;
04302 
04303     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04304     wxString String;
04305 
04306     if (!pGadget) goto invalid;
04307 
04308 //  if ( pGadget->IsKindOf(CLASSINFO(wxControlWithItems)) ) // Includes wxListBox - this seems to have false positives
04309     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04310         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04311         pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)) ||
04312         pGadget->IsKindOf(CLASSINFO(wxChoice)) )
04313     {
04314         if (ListPos >=0)
04315         {
04316             if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04317             {
04318                 if (ListPos>=(INT32)((wxOwnerDrawnComboBox *)pGadget)->GetCount()) goto invalid;
04319                 String = ((wxOwnerDrawnComboBox *)pGadget)->GetString(ListPos);
04320             }
04321             else
04322             {
04323                 if (ListPos>=(INT32)((wxControlWithItems *)pGadget)->GetCount()) goto invalid;
04324                 String = ((wxControlWithItems *)pGadget)->GetString(ListPos);
04325             }
04326             goto out;
04327         }
04328 
04329         if (pGadget->IsKindOf(CLASSINFO(wxComboBox)))
04330         {
04331             String = ((wxComboBox *)pGadget)->GetValue();
04332             goto out;
04333         }
04334 
04335         if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04336         {
04337             String = ((wxOwnerDrawnComboBox *)pGadget)->GetValue();
04338             goto out;
04339         }
04340 
04341         INT32 sel;
04342         if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04343             sel = ((wxOwnerDrawnComboBox *)pGadget)->GetSelection();
04344         else
04345             sel = ((wxControlWithItems *)pGadget)->GetSelection();
04346 
04347         if ( (sel == wxNOT_FOUND) || (sel < 0)) goto invalid;
04348 
04349         if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04350             String = ((wxOwnerDrawnComboBox *)pGadget)->GetString(sel);
04351         else
04352             String = ((wxControlWithItems *)pGadget)->GetString(sel);
04353 
04354         goto out;
04355     }
04356 
04357     if ( pGadget->IsKindOf(CLASSINFO(wxTextCtrl)) )
04358     {
04359         String = ((wxTextCtrl *)pGadget)->GetValue();
04360         goto out;
04361     }
04362 
04363     if ( pGadget->IsKindOf(CLASSINFO(wxSliderCombo)) )
04364     {
04365         String = ((wxSliderCombo *)pGadget)->GetValue();
04366         goto out;
04367     }
04368 
04369     String = pGadget->GetLabel();
04370 
04371 out:
04372     StrVal = String.c_str();
04373     return StrVal;
04374 
04375 invalid:
04376     if (Valid)
04377         *Valid=FALSE;
04378     return StrVal;
04379 }

UINT32 DialogManager::GetTreeGadgetChildrenCount CWindowID  wnd,
CGadgetID  Gadget,
CTreeItemID  hItem,
BOOL  bRecursive = FALSE
[static]
 

To get the number of children of an item in a tree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier hItem - ID of item bRecursive - TRUE if should count children recursively
- [OUTPUTS]
Returns:
number of children

Definition at line 9332 of file dlgmgr.cpp.

09333 {
09334     wxWindow* pGadget = GetGadget(wnd, Gadget);
09335     if (!pGadget) return 0;
09336 
09337     if( pGadget->IsKindOf( CLASSINFO(wxTreeCtrl) ) )
09338     {
09339         return UINT32( ((wxTreeCtrl*)pGadget)->GetChildrenCount( hItem, FALSE != bRecursive ) );
09340     }
09341 
09342     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09343     return 0;
09344 }

CTreeItemID DialogManager::GetTreeGadgetFirstChildItem CWindowID  wnd,
CGadgetID  Gadget,
CTreeItemID  hItem
[static]
 

To get the ID of the first child item of the specified in the tree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier hItem - ID of item
- [OUTPUTS]
Returns:
ID of item

Definition at line 9297 of file dlgmgr.cpp.

09298 {
09299     wxWindow* pGadget = GetGadget(wnd, Gadget);
09300     if (!pGadget) return CTreeItemID();
09301 
09302     if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
09303         )
09304     {
09305         wxTreeItemIdValue sessioncookie;
09306         return ((wxTreeCtrl*)pGadget)->GetFirstChild(hItem, sessioncookie);
09307     }
09308 
09309     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09310     return CTreeItemID();
09311 }

CTreeItemID DialogManager::GetTreeGadgetFirstSelectedItem CWindowID  wnd,
CGadgetID  Gadget
[static]
 

To get the ID of the first selected item in the tree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier hItem - ID of item
- [OUTPUTS]
Returns:
ID of item

Definition at line 9195 of file dlgmgr.cpp.

09196 {
09197     wxWindow* pGadget = GetGadget(wnd, Gadget);
09198     if (!pGadget) return CTreeItemID();
09199 
09200     if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
09201         )
09202     {
09203         return ((wxTreeCtrl*)pGadget)->GetSelection();
09204     }
09205 
09206     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09207     return CTreeItemID();
09208 }

CCObject * DialogManager::GetTreeGadgetItemData CWindowID  wnd,
CGadgetID  Gadget,
CTreeItemID  hItem
[static]
 

To insert an item into a tree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
- [OUTPUTS]
Returns:
TRUE if the gadgets value could be set FALSE if it could not

Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.

See also:
DialogOp::SetStringGadgetValue

Definition at line 9087 of file dlgmgr.cpp.

09088 {
09089     wxWindow* pGadget = GetGadget(wnd, Gadget);
09090     if (!pGadget) return NULL;
09091 
09092     if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
09093         )
09094     {
09095         wxTreeItemData* pData = ((wxTreeCtrl*)pGadget)->GetItemData(hItem);
09096         if (pData) // && pData->IsKindOf(CLASSINFO(CamelotTreeItemData)))
09097             return ((CamelotTreeItemData*)pData)->GetObject();
09098 
09099         return NULL;
09100     }
09101 
09102     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09103 
09104     return NULL;
09105 }

CTreeItemID DialogManager::GetTreeGadgetNextVisItem CWindowID  wnd,
CGadgetID  Gadget,
CTreeItemID  hItem
[static]
 

To get the ID of the next visible item in the tree control after a specified item.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier hItem - ID of item
- [OUTPUTS]
Returns:
ID of item

Definition at line 9264 of file dlgmgr.cpp.

09265 {
09266     wxWindow* pGadget = GetGadget(wnd, Gadget);
09267     if (!pGadget) return CTreeItemID();
09268 
09269     if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
09270         )
09271     {
09272         return ((wxTreeCtrl*)pGadget)->GetNextVisible(hItem);
09273     }
09274 
09275     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09276     return CTreeItemID();
09277 }

CTreeItemID DialogManager::GetTreeGadgetRootItem CWindowID  wnd,
CGadgetID  Gadget
[static]
 

To get the ID of the root item in the tree control.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/Feb/2006
Parameters:
WindowID - Dialog box window identifier [INPUTS] Gadget - Gadget identifier
- [OUTPUTS]
Returns:
ID of item

Definition at line 9160 of file dlgmgr.cpp.

09161 {
09162     wxWindow* pGadget = GetGadget(wnd, Gadget);
09163     if (!pGadget) return CTreeItemID();
09164 
09165     if ( pGadget->IsKindOf(CLASSINFO(wxTreeCtrl))
09166         )
09167     {
09168         return ((wxTreeCtrl*)pGadget)->GetRootItem();
09169 
09170         return CTreeItemID();
09171     }
09172 
09173     ERROR3("SetTreeGadgetItem called on non-tree gadget");
09174     return CTreeItemID();
09175 }

MILLIPOINT DialogManager::GetUnitGadgetValue CWindowID  WindowID,
CGadgetID  Gadget,
UnitType  DefaultType,
MILLIPOINT  StartRange,
MILLIPOINT  EndRange,
UINT32  IDSInvalidMsg = 0,
BOOL *  Valid = NULL
[static]
 

This function will obtain the gadget value and validate it. Validation will check that data has been entered in a correct unit type, and that it is in the range StartRange..EndRange. If the user enters an incorrect value the InvalidMsgID string will be displayed to the user in a dialog box, and Valid will have a FALSE value.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Dialog identifier TheType: The type of the gadgets value StartRange: Minimum gadget value EndRange: Maximum gadget value InvalidMsgID: Message displayed to the user when they have entered invalid data (either not the correct type or not in the correct range) This may be 0 if you do not wish an error to be reported
Valid,: Flag indicating if the value entered was valid or not. [OUTPUTS] If the Valid parameter is NULL, then validity of the result will not be checked, and the actual value of the control will be returned even if it was out of range. If this flag is returned FALSE then the return value will be 0.
Returns:
The value entered by the user in MILLIPOINTS. If Valid is FALSE then NULL will be returned.
For Windows -----------

The function can be used to obtain a unit value from the string value of the following controls:

Edit ListBox ComboBox Static

For ListBox and ComboBox controls the unit value of the currently selected listitem is returned. This function would normally be called in response to a DIM_SELECTION_CHANGED or DIM_SELECTION_CHANGED_COMMIT message.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetUnitGadgetValue

Definition at line 3810 of file dlgmgr.cpp.

03817 {
03818     MILLIPOINT          Value = 0;    // The return value
03819 
03820     BOOL IsValid;
03821 
03822     // Obtain the controls text
03823     String_256 StrValue = GetStringGadgetValue(WindowID, Gadget, NULL);
03824 
03825     // Convert the string to millipoints if it's valid
03826     Value = Convert::StringToMillipoints(StrValue, DefaultType, &IsValid);
03827 
03828     if (Valid == NULL)      // If don't want it validated, return the value now
03829         return(Value);
03830 
03831     if (IsValid)
03832     {
03833         // Check that the value is in the range StartRange..EndRange
03834         if ((Value >= StartRange) && (Value <= EndRange))
03835         {
03836             *Valid = TRUE;
03837             return (Value); // A correct value was entered
03838         }
03839     }
03840 
03841     // The value is invalid
03842     if (IDSInvalidMsg != 0)
03843         InformWarning(IDSInvalidMsg); // Scold the user, if a message was supplied
03844 
03845     return( 0 );
03846 }

BOOL DialogManager::GetValueCount CWindowID  WindowID,
CGadgetID  Gadget,
INT32 *  Count
[static]
 

For finding the number of values stored in a gadget.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Count,: The number of items in the gadget [OUTPUTS]
Returns:
FALSE if an error occurred
For Windows -----------

This function can be called on ListBox and ComboBox controls to obtain the number of values in their lists.

Returns:
Errors: If the function is called on an invalid control then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetValueCount

Definition at line 4816 of file dlgmgr.cpp.

04819 {
04820     wxWindow * pGadget = GetGadget(WindowID, Gadget);
04821     if (!pGadget) return FALSE;
04822 
04823     //if ( pGadget->IsKindOf(CLASSINFO(wxControlWithItems)) ) // Includes wxListBox - this seems to have false positives
04824     if ( pGadget->IsKindOf(CLASSINFO(wxListBox)) ||
04825         pGadget->IsKindOf(CLASSINFO(wxComboBox)) ||
04826         pGadget->IsKindOf(CLASSINFO(wxChoice))
04827         )
04828     {
04829         INT32 c = ((wxControlWithItems *)pGadget)->GetCount();
04830         if (Count) *Count=c;
04831         return TRUE;
04832     }
04833     else if (pGadget->IsKindOf(CLASSINFO(wxOwnerDrawnComboBox)))
04834     {
04835         INT32 c = ((wxOwnerDrawnComboBox *)pGadget)->GetCount();
04836         if (Count) *Count=c;
04837         return TRUE;
04838     }
04839 
04840     ERROR3("Invalid control");
04841     return FALSE;
04842 }

BOOL DialogManager::GetValueIndex CWindowID  WindowID,
CGadgetID  Gadget,
WORD Index
[static]
 

For finding the index of the currently selected item in a gadget.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Index,: The index of the currently selected item in the gadget. The [OUTPUTS] index value starts at 0 for the first item in the list.
Returns:
TRUE if the index value could be read, else FALSE.
For Windows -----------

The function can be called for ListBox and ComboBox controls (including our custom combobox cc_1dBitmapComboBoxEdit)

Returns:
Errors: If the function is called on an invalid gadget then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
See also:
DialogOp::GetValueIndex

Definition at line 5079 of file dlgmgr.cpp.

05082 {
05083     if (Index) *Index=GetFirstSelectedItem(WindowID, Gadget);
05084     return TRUE;
05085 }

BOOL DialogManager::GetValueIndex CWindowID  WindowID,
CGadgetID  Gadget,
INT32 *  Index
[static]
 

For finding the index of the currently selected item in a gadget.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com> / Jason (Based on Simon's stuff...)
Date:
11/10/95
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier
Index,: The index of the currently selected item in the gadget. The [OUTPUTS] index value starts at 0 for the first item in the list.
THIS CAN NOW RETURN -1 AS IT SHOULD ALWAYS OF BEEN ABLE TO DO !!!

Returns:
TRUE if the index value could be read, else FALSE.
For Windows -----------

The function can be called for ListBox and ComboBox controls

Returns:
Errors: If the function is called on an invalid gadget then an ENSURE failure will occur in a DEBUG build. In a retail build FALSE is returned.
Notes: ALWAYS USE THIS ONE IN PREFERENCE TO THE WORD ONE, IE ALWAYS PASS A INT32 IN, NOT A WORD !!!

This function now works internally as well, since comparing a INT32 -1 with a word -1 didn't work out too well...

See also:
DialogOp::GetValueIndex

Definition at line 5037 of file dlgmgr.cpp.

05040 {
05041     INT32 index = GetFirstSelectedItem(WindowID, Gadget);
05042     if (Index) *Index=index;
05043     TRACEUSER("amb", _T("Index is %d"),index);
05044     return TRUE;
05045 }

BOOL DialogManager::GetWindowPosition CWindowID  WindowID,
RECT pRect
[static]
 

Definition at line 7263 of file dlgmgr.cpp.

07264 {
07265     wxRect Rect;
07266     if (!GetWindowPosition(WindowID, &Rect)) return FALSE;
07267     pRect->bottom=Rect.GetBottom();
07268     pRect->top=Rect.GetTop();
07269     pRect->left=Rect.GetLeft();
07270     pRect->right=Rect.GetRight();
07271     return TRUE;
07272 }

BOOL DialogManager::GetWindowPosition CWindowID  WindowID,
wxRect *  pRect
[static]
 

Allows the user to get the current window position.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/97
Parameters:
WindowID Handle of window [INPUTS]
Rect pointer to the rectangle to fill in [OUTPUTS]
Returns:
True if the call was successful, FALSE otherwise.
See also:
DialogOp::GetWindowPosition; DialogManager::SetWindowPosition;

Definition at line 7257 of file dlgmgr.cpp.

07258 {
07259     *pRect = wxRect(WindowID->GetPosition(), WindowID->GetSize());
07260     return TRUE;
07261 }

CWindowID DialogManager::GetWindowUnderPointer WinCoord wc = NULL  )  [static]
 

Fills in the status line text from the help text if over a control Scope: Public.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
15/05/2006
Parameters:
- [INPUTS]
wc - if non-NULL, filled in with the pointer coords [OUTPUTS]
Returns:
the window ID under the pointer or NULL for none

Errors: -

See also:
-

Definition at line 7880 of file dlgmgr.cpp.

07881 {
07882     wxPoint pt=wxGetMousePosition();
07883     wxWindow * w=::wxChildWindowFromPoint(pt, FALSE, -1);
07884     if (wc && w)
07885     {
07886         pt = w->ScreenToClient(pt);
07887         wc->x=pt.x;
07888         wc->y=pt.y;
07889     }
07890     return w;
07891 }

static BOOL DialogManager::HandleScrollBarMsg wxWindow *  pScrollWnd,
UINT32  wParam,
INT32  lParam,
WORD  CurrentThumbPos
[static, private]
 

BOOL DialogManager::HideGadget CWindowID  WindowID,
CGadgetID  Gadget,
BOOL  Hide
[static]
 

For hiding/showing gadgets.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/9/93
Parameters:
WindowID,: Dialog box window identifier [INPUTS] Gadget: Gadget identifier Enabled: TRUE if the gadget is to be hidden. FALSE if the gadget is to be shown.
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE
For Windows -----------

This function can be called for all controls

Returns:
Errors: -
See also:
DialogOp::HideGadget

Definition at line 5263 of file dlgmgr.cpp.

05264 {
05265     // For the time being, we do this by Hide/Unhide
05266     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05267     if (!pGadget) return FALSE;
05268     pGadget->Show(!Hide);
05269     return TRUE;
05270 }

BOOL DialogManager::HighlightText CWindowID  WindowID,
CGadgetID  Gadget,
INT32  nStart = 0,
INT32  nEnd = -1
[static]
 

Highlights the given range of text (by default all of it) within a control that holds editable text, eg. an edit field.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/11/94
Parameters:
WindowID Window/dialogue box ID (handle) [INPUTS] Gadget control ID within the window/dialogue box nStart first letter to highlight (by default the very first) nEnd last letter to highlight (by default the very last)
- [OUTPUTS]
Returns:
TRUE if successful

Errors: ERROR3 if you try to highlight text in a control without any, eg. a button or a scroller.

See also:
DialogOp::HighlightText

Definition at line 5472 of file dlgmgr.cpp.

05473 {
05474     // Find out the window class of the control.  Only those with editable text can
05475     // be highlighted.
05476     // For the time being, we do this by Hide/Unhide
05477     wxWindow * pGadget = GetGadget(WindowID, Gadget);
05478     if (!pGadget) return FALSE;
05479 
05480 #ifdef _DEBUG
05481     ERROR3IF( !pGadget->IsKindOf( CLASSINFO(wxListBox) ) &&
05482         !pGadget->IsKindOf( CLASSINFO(wxComboBox) ) &&
05483         !pGadget->IsKindOf( CLASSINFO(wxOwnerDrawnComboBox) ) &&
05484         !pGadget->IsKindOf( CLASSINFO(wxTextCtrl) ),
05485                 "Wrong kind of control in DialogManager::HighlightText");
05486 #endif
05487 
05488     if( pGadget->IsKindOf( CLASSINFO(wxTextCtrl) ) )
05489     {
05490         ( (wxTextCtrl *)pGadget )->SetSelection( -1, -1 );
05491     }
05492     else if( pGadget->IsKindOf( CLASSINFO(wxComboBox) ) )
05493     {
05494         ( (wxComboBox *)pGadget )->SetSelection( -1, -1 );
05495     }
05496     else if( pGadget->IsKindOf( CLASSINFO(wxOwnerDrawnComboBox) ) )
05497     {
05498         ( (wxOwnerDrawnComboBox *)pGadget )->SetSelection( -1 );
05499     }
05500 
05501     return TRUE;
05502 }

void DialogManager::InitPaneInfoHash  )  [static, protected]
 

Initializes the pane info hash if it has not been previously initialized Scope: protected.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
25/07/06
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 773 of file dlgmgr.cpp.

00774 {
00775     if (s_pPaneInfoHash)
00776         return;
00777 
00778     s_pPaneInfoHash = new IdToSerializedPaneInfo;
00779 }

void DialogManager::InvalidateGadget CWindowID  WindowID,
CGadgetID  Gadget,
ReDrawInfoType ExtraInfo,
DocRect InvalidRect
[static]
 

Causes the Dialog Manager to tell the host os to get the cc_DialogDraw gadget to be redrawn, over the specfied rectangle. You should recieve a DIM_REDRAW message in the not too distant future.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/11/94
Parameters:
WindowID - The Window identifier [INPUTS] Gadget - The ID of the gadget that you want to be redrawn
ExtraInfo - The information passed to your DIM_ mouse event handler

InvalidRect - The MILLIPOINT rectangle to invalidate, in the (0,0)->(dx,dy) coordinate space used in ReDrawInfoType structures. (or NULL to invalidate the entire window)

Notes: If you are using a Virtual coordinate space which differs from the (0,0)->(dx,dy) space that this requires, then you'll need to call some conversion methods which do not yet exist!

Definition at line 5594 of file dlgmgr.cpp.

05597 {
05598     if (InvalidRect == NULL)    // No rect - invalidate the entire window
05599     {
05600         InvalidateGadget(WindowID, Gadget);
05601         return;
05602     }
05603 
05604     if (ExtraInfo == NULL || WindowID == 0)
05605     {
05606         ERROR2RAW("DialogManager::InvalidateGadget was passed illegal NULL parameter(s)");
05607         return;
05608     }
05609 
05610     ERROR3IF(ExtraInfo->Dpi == 0, "Screen DPI is zero? I think not! Divide-by-zeros imminent!");
05611     if (!ExtraInfo->Dpi) return;
05612 
05613     INT32 PixelSize = 72000 / ExtraInfo->Dpi;       // Size of a pixel in MILLIPOINTS
05614 
05615     DocRect irect=*InvalidRect;
05616     if (irect.lo.y > irect.hi.y)
05617     {
05618         // not an ERROR3 because this is in rendering code
05619         TRACEALL( _T("Rectangle upside down in InvalidateGadget\n") );
05620         // swap over the rect Y co-ords
05621         INT32 temp=irect.lo.y;
05622         irect.lo.y=irect.hi.y;
05623         irect.lo.y=temp;
05624     }
05625 
05626     wxRect ToRedraw(irect.lo.x / PixelSize, (ExtraInfo->dy-irect.hi.y) / PixelSize,
05627