dialogop.cpp

Go to the documentation of this file.
00001 // $Id: dialogop.cpp 1751 2006-09-13 11:33:14Z luke $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 // Implementation of the following classes 
00100 // 
00101 //  DialogOp           Abstract base class which all dialog classes derive from
00102 //      BlobbyDlg      Dialog demonstrating DialogOp functions
00103 //      MenuPrefDlg    Menu preferences demo (This has a very short life!)
00104 //      DebugTreeDlg   Dialog showing Camelot's debug tree
00105 
00106 /*
00107 */ 
00108 
00109 //-----------------------------------------------------------------------------------------
00110 // Include files
00111                        
00112                      
00113 #include "camtypes.h" 
00114 
00115 //#include "document.h"         // Temp   - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "resource.h"   
00117 //#include "simon.h"
00118 //#include "tim.h"
00119 //#include "phil.h"
00120 //#include "dialogop.h"         // DialogOp header  - in camtypes.h [AUTOMATICALLY REMOVED]
00121 #include "dlgmgr.h"
00122 //#include "ensure.h"   - in camtypes.h [AUTOMATICALLY REMOVED]
00123 //#include "errors.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00124 #include "camelot.h" 
00125 //#include "dlgtypes.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00126 #include "bubbleid.h" 
00127 //#include "msg.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00128 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00129 //#include "colcontx.h"
00130 
00131 #include "ccdc.h"           // For redraw with RenderRegions
00132 #include "grndrgn.h"
00133 #include "grnddib.h"
00134 #include "osrndrgn.h"
00135 #include "dlgview.h"
00136 //#include "docmsgs.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00137 //#include "docvmsg.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00138 
00139 //#include "reshlpid.h"     // for _R(ID_CC_HELP_BUTTON) etc
00140 #include "helpuser.h"
00141 //#include "oilmods.h"
00142 
00143 #include "brushmsg.h"   // for the screen change message
00144 #include "dlgevt.h"
00145 #include "ctrllist.h"
00146 
00147 class Node;
00148 struct ReDrawInfoType;
00149 
00150 #define MAGIC_CREATE  0xa1ec501dUL
00151 #define MAGIC_DESTROY 0xa1ecdeadUL
00152 
00153 #define CheckMagic(f) \
00154     do \
00155     { \
00156         if (MagicWord == MAGIC_DESTROY) \
00157         { \
00158             ERROR3(f ": DialogOp already destroyed"); \
00159         } \
00160         else \
00161         { \
00162             ERROR3IF(MagicWord != MAGIC_CREATE, f ": DialogOp suffered double destroyed or is corrupt"); \
00163         } \
00164     } while(0)
00165 
00166 //-----------------------------------------------------------------------------------------
00167 
00168 DECLARE_SOURCE("$Revision: 1751 $");
00169 
00170 // All dynamic implement macros here before CAM_DEBUG_NEW
00171 
00172 CC_IMPLEMENT_DYNCREATE(DialogOp, Operation)
00173 CC_IMPLEMENT_DYNCREATE(DialogTabOp, DialogOp)
00174 
00175 // Declare smart memory handling in Debug builds
00176 #define new CAM_DEBUG_NEW     
00177 
00178 /********************************************************************************************
00179 
00180 >   DialogOp::DialogOp(CDlgResID DlgResID, CMode Mode, CDlgResID SubDialogID = 0,
00181                        HINSTANCE MainInst = 0, HINSTANCE SubInst = 0)
00182 
00183     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00184     Created:    13/8/93
00185     Inputs:     DialogResID: The resource ID of the dialog
00186                 Mode:        The dialog's mode (modal, medeless)
00187                 SubDialogID: The resource ID of another dialog - this allows you to merge
00188                              two dialogs to create a new one (if this parameter is omitted
00189                              no merging occurs and you get a normal dialog).
00190                 MainInst, SubInst - instance handles of the modules containing the dialog
00191                                     templates (if 0 the main application instance is used).
00192                 OpeningPage:    For tabbed dialogs allows opening tab to be chosen
00193     Purpose:    The Constructor of the DialogOp class simply sets the resource ID of the 
00194                 dialog and its modality.
00195 
00196 ********************************************************************************************/
00197 
00198 
00199 DialogOp::DialogOp(CDlgResID DialogResID, CDlgMode Mode, 
00200                    CDlgResID SubDialogID, 
00201                    /* HINSTANCE MainInst, HINSTANCE SubInst, */
00202                    CCRuntimeClass* Class,
00203                    INT32 OpeningPage, 
00204                    CWindowID ParentWnd) : Operation(Class)
00205 {
00206     MagicWord = MAGIC_CREATE;           // Save this for later
00207 
00208     DlgResID = DialogResID;             // Dialog's resource ID
00209     DlgMode = Mode;                     // Dialog's mode       
00210     SubDlgID = SubDialogID;             // Dialog to merge with (0 => no merging)
00211     WindowID = NULL;                    // We don't know this until we create the dialog 
00212     DlgMgr = CCamApp::GetDlgManager();  // Store a pointer to the Dialog Manager so that 
00213                                         // it's easy to get at
00214 
00215     ReadWritePage = 0;                  // The page within the dialog that we are currently
00216                                         // reading or writing to. This is NULL for all
00217                                         // non tabbed dialogs.
00218     PageToOpen = OpeningPage;           // for tabbed dialogs allows opening tab to be chosen
00219 
00220     pEvtHandler = NULL;
00221 
00222     m_bInteractiveProfiles = TRUE;
00223 
00224 PORTNOTE("dialog","Removed Windows resource'ism")
00225 #ifndef EXCLUDE_FROM_XARALX
00226     // Make the main resource instance the uk.dll one, or whatever, if it exists
00227     if(MainInst == 0)
00228         MainInst = ExtraDLLs[Resources_DLL];
00229 
00230     // Set up instance handle for the main dialog                                       
00231     if (MainInst == 0)
00232         MainDlgInst = AfxGetInstanceHandle();
00233     else
00234         MainDlgInst = MainInst;
00235         
00236     // Make the sub resource instance the uk.dll one, or whatever, if it exists
00237     if(SubDlgInst == 0)
00238         SubDlgInst = ExtraDLLs[Resources_DLL];
00239 
00240     // Set up instance handle for the main dialog                                       
00241     if (SubInst == 0)
00242         SubDlgInst = AfxGetInstanceHandle();
00243     else
00244         SubDlgInst = SubInst;
00245 #endif
00246     
00247     // User is interacting, so shouldn't be waiting!
00248     OpFlags.HasOwnTimeIndicator = TRUE;
00249 
00250     ParentDlgWnd = ParentWnd;
00251 }                    
00252  
00253 // No comment block required
00254  
00255 // Never ever call this it exists cos DYNCREATE demands it. DYNCREATE has no concept 
00256 // of an abstract class. 
00257 DialogOp::DialogOp()
00258 {                                   
00259     ENSURE(FALSE, "Invalid constructor called for DialogOp"); 
00260 }
00261   
00262   
00263 /********************************************************************************************
00264 
00265 >   BOOL DialogOp::Create() 
00266 
00267     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00268     Created:    13/8/93
00269     Inputs:     -
00270     Outputs:    -
00271     Returns:    TRUE if all resources to create the dialog can be successfully allocated. 
00272                 FALSE otherwise
00273     Purpose:    The create method reserves everything needed to guarantee that the dialog will 
00274                 appear. It returns FALSE if it fails.
00275                 If any dialog merging was specified (by providing a non-zero value for
00276                 SubDialogID in the call to the DialogOp constructor) then it will be carried
00277                 out when this function is called.
00278     Errors:     If the resources cannot be allocated then ERRORIF is called with a
00279                 Dialog creation failed error message.  
00280     SeeAlso:    -
00281 
00282 ********************************************************************************************/
00283 
00284 
00285 // The Create fn should only need to take a DialogOp param when the Bar system is complete
00286 // and the current infobar merging stuff removed 
00287 BOOL DialogOp::Create() 
00288 {                                      
00289     // Create an instance of the dialog by calling the dialog managers Create method. The 
00290 
00291     // The WindowID will be set by this call
00292     BOOL Created = DlgMgr->Create(this, /*MainDlgInst,*/ DlgResID, /*SubDlgInst,*/ SubDlgID, DlgMode, 
00293                                                                     PageToOpen, ParentDlgWnd);
00294     
00295     ERRORIF(!Created, _R(IDT_DIALOG_CREATEFAIL), FALSE);
00296 
00297     // It all worked
00298     return TRUE;
00299 }
00300 
00301 /********************************************************************************************
00302 
00303 >   void DialogOp::Open() 
00304 
00305     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00306     Created:    13/8/93
00307     Inputs:     -
00308     Outputs:    -
00309     Returns:    -
00310     Purpose:    The open dialog method displays the dialog box. If Create was successful 
00311                 then this function cannot fail
00312     Errors:     -
00313     SeeAlso:    -
00314 
00315 ********************************************************************************************/
00316 
00317 void DialogOp::Open() 
00318 {                            
00319     ENSURE(WindowID != NULL, "Trying to open a dialog box which has not been created !"); 
00320     
00321     // we may wish to subclass some of our controls, do so here
00322     AddControlsToHelper();
00323 
00324     // open the dialog
00325     DlgMgr->Open(WindowID,this); 
00326 }
00327 
00328 /********************************************************************************************
00329 
00330 >   void DialogOp::Close() 
00331 
00332     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00333     Created:    13/8/93
00334     Inputs:     -
00335     Outputs:    -
00336     Returns:    -
00337     Purpose:    The close method removes the dialog from the display but keeps all system       
00338                 resources associated with it. It hides the dialog.  
00339     Errors:     -
00340     SeeAlso:    -
00341 
00342 ********************************************************************************************/
00343 
00344 void DialogOp::Close() 
00345 {                               
00346     CheckMagic("DialogOp:Close()");
00347     ENSURE(WindowID != NULL, "Trying to close a window with a NULL window ID !");        
00348     
00349     DlgMgr->Close(WindowID, this); 
00350 
00351     // remove any subclassed controls from the control helper
00352     RemoveControlsFromHelper();
00353 
00354     // we have changed the appearance of the screen so broadcast a message
00355     if (Document::GetCurrent() != NULL) // only if we have a current document
00356         BROADCAST_TO_ALL(ScreenChangeMsg());
00357 }
00358 
00359 /********************************************************************************************
00360 
00361 >   BOOL DialogOp::IsOpen()
00362 
00363     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00364     Created:    9/11/93
00365     Returns:    !!!!!!!!!!!!!!!!!!!! Bodge
00366     Purpose:    Don't use this function any more. It's ambiguous and marked for destruction.
00367                 Call IsWindowVisible or HasWindow instead. This has been a public service announcement !!!!
00368                 (Simon)
00369                 
00370 
00371 ********************************************************************************************/
00372 
00373 BOOL DialogOp::IsOpen()
00374 {
00375     if( WindowID != NULL )
00376     {
00377         return ( (wxWindow *)WindowID )->IsShown(); //      <<< --------------  BODGE, BODGE, BODGE
00378     }
00379     else return FALSE; 
00380 }
00381 
00382 
00383 /********************************************************************************************
00384 
00385 >   BOOL DialogOp::HasWindow()
00386 
00387     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00388     Created:    30/11/93
00389     Returns:    TRUE if this DialogOp has an associated window. 
00390                  
00391     SeeAlso     DialogOp::IsWindowVisible
00392     Purpose:    To find out if DialogOp has a window associated with it. 
00393     
00394 ********************************************************************************************/
00395 
00396 BOOL DialogOp::HasWindow()
00397 {
00398     return (WindowID != NULL); 
00399 }
00400 
00401 /********************************************************************************************
00402 
00403 >   BOOL DialogOp::BringToTop()
00404 
00405 
00406     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00407     Created:    27/6/95
00408     Inputs:     -
00409     Outputs:    -
00410     Returns:    FALSE if the function failed.
00411     Purpose:    This function brings an open dialog to the top of the z-order
00412     Errors:     -
00413     SeeAlso:    -
00414 
00415 ********************************************************************************************/
00416 BOOL DialogOp::BringToTop()
00417 {
00418     ERROR2IF(!WindowID, FALSE, "BringToTop called on a dialog without a window"); 
00419     return (DlgMgr->BringToTop(WindowID, this)); 
00420 }
00421 
00422 
00423 /********************************************************************************************
00424 
00425 >   BOOL DialogOp::AddControlsToHelper()
00426 
00427 
00428     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00429     Created:    14/7/2000
00430     Inputs:     -
00431     Outputs:    -
00432     Returns:    always TRUE
00433     Purpose:    If you want to subclass some or all of the controls on your dialog then
00434                 override this function.
00435     Errors:     -
00436     SeeAlso:    First implementation in BrushDlg.h/cpp, DialogControlHelper class (DlgCtHlp.h/.cpp)
00437 
00438 ********************************************************************************************/
00439 
00440 BOOL DialogOp::AddControlsToHelper()
00441 {
00442     return TRUE;
00443 }
00444 
00445 
00446 /********************************************************************************************
00447 
00448 >   BOOL DialogOp::RemoveControlsFromHelper()
00449 
00450 
00451     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00452     Created:    14/7/2000
00453     Inputs:     -
00454     Outputs:    -
00455     Returns:    -
00456     Purpose:    If you added some controls in AddControlsToHelper then you must remove them here
00457     Errors:     -
00458     SeeAlso:    First implementation in BrushDlg.h/cpp, DialogControlHelper class (DlgCtHlp.h/.cpp)
00459 
00460 ********************************************************************************************/
00461 
00462 void DialogOp::RemoveControlsFromHelper()
00463 {
00464     return;
00465 }
00466 
00467 /********************************************************************************************
00468 
00469 >   BOOL DialogOp::IsGadgetTickable(CGadgetID Gadget) 
00470 
00471 
00472     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00473     Created:    28/6/95
00474     Inputs:     Gadget: The Gadget to test
00475     Outputs:    -
00476     Returns:    -
00477     Purpose:    To determine if Gadget is of a particular type that can be ticked. 
00478                 eg. if the gadget is a button
00479     Errors:     -
00480     SeeAlso:    -
00481 
00482 ********************************************************************************************/
00483 
00484 BOOL DialogOp::IsGadgetTickable(CGadgetID Gadget) 
00485 {
00486     return (DlgMgr->IsGadgetTickable(GetReadWriteWindowID(), Gadget)); 
00487 }
00488 
00489 /********************************************************************************************
00490 
00491 >   BOOL DialogOp::ColourPickerAbort(CGadgetID Gadget) 
00492 
00493 
00494     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
00495     Created:    27/1/2000
00496     Inputs:     Gadget: The Gadget to call this routine on
00497     Outputs:    -
00498     Returns:    -
00499     Purpose:    Used to abort the dragging of the custom colour picker control from within
00500                 the colour editor
00501     Errors:     -
00502     SeeAlso:    -
00503 
00504 ********************************************************************************************/
00505 
00506 BOOL DialogOp::ColourPickerAbort(CGadgetID Gadget, WPARAM wParam) 
00507 {
00508     return (DlgMgr->ColourPickerAbort(GetReadWriteWindowID(), Gadget, wParam));
00509 }
00510 
00511 
00512 /********************************************************************************************
00513 
00514 >   BOOL DialogOp::IsWindowVisible()
00515 
00516     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>, function name changed by Simon
00517     Created:    9/11/93
00518     Returns:    TRUE if the window associated with this Op is visible. FALSE if not.
00519                 Note the Window must exist to do this check. A call to HasWindow will verify this
00520                  
00521     SeeAlso     DialogOp::HasWindow
00522     Purpose:    Find out if a dialog is shown or hidden
00523 
00524 ********************************************************************************************/
00525 
00526 BOOL DialogOp::IsWindowVisible()
00527 {
00528     ERROR2IF (WindowID != NULL, FALSE, "The window does not exist, Should have called HasWindow"); 
00529     return (DlgMgr->IsWindowVisible(WindowID));
00530 }
00531 
00532 
00533 /********************************************************************************************
00534 
00535 >   BOOL DialogOp::IsCustomComboDropdownVisible(CGadgetID Gadget)
00536 
00537 
00538     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
00539     Created:    21/2/2000
00540     Inputs:     Gadget: The Gadget to call this routine on
00541     Outputs:    -
00542     Returns:    -
00543     Purpose:    Used to determin whether the custom controls dropdown is visible.
00544     Errors:     -
00545     SeeAlso:    -
00546 
00547 ********************************************************************************************/
00548 
00549 BOOL DialogOp::IsCustomComboDropdownVisible(CGadgetID Gadget)
00550 {
00551     return (DlgMgr->IsCustomComboDropdownVisible(GetReadWriteWindowID(), Gadget));
00552 }
00553 
00554 
00555 /********************************************************************************************
00556 
00557 >   BOOL DialogOp::CloseDropdown (CGadgetID Gadget, BOOL CloseVal)
00558 
00559 
00560     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
00561     Created:    21/2/2000
00562     Inputs:     Gadget: The Gadget to call this routine on
00563     Outputs:    -
00564     Returns:    -
00565     Purpose:    Used to close the controls dropdown.  This routine was written because of
00566                 the amount of trouble that I was experiencing with my custom controls
00567                 down to escape key processing (which is viewed as a hotkey within camelot).
00568     Errors:     -
00569     SeeAlso:    -
00570 
00571 ********************************************************************************************/
00572 
00573 BOOL DialogOp::CloseDropdown (CGadgetID Gadget, BOOL CloseVal)
00574 {
00575     return (DlgMgr->CloseDropdown(GetReadWriteWindowID(), Gadget, CloseVal));
00576 }
00577 
00578 
00579 /********************************************************************************************
00580 
00581 >   DialogOp::~DialogOp() 
00582 
00583     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00584     Created:    13/8/93
00585     Inputs:     -
00586     Outputs:    -
00587     Returns:    -
00588     Purpose:    The DialogOp destructor destroys the instance of the DialogOp and all   
00589                 associated resources. If the dialog was open then it is closed. 
00590                 
00591                 Note that a dialog box can be destroyed even if it was never created. In this 
00592                 case no message is sent to the dialog manager. 
00593     Errors:     -
00594     SeeAlso:    -
00595 
00596 ********************************************************************************************/
00597 
00598 DialogOp::~DialogOp() 
00599 {
00600     CheckMagic("DialogOp destructor");
00601     if (WindowID != NULL)
00602         DlgMgr->Delete(WindowID, this); 
00603 
00604     WindowID = NULL; // ensure we get a NULL pointer if this is used again
00605     DlgMgr = NULL;  // Again, ensure this is a NULL pointer
00606     pEvtHandler=NULL;
00607 
00608     MagicWord = MAGIC_DESTROY;
00609 }    
00610 
00611 // -----------------------------------------------------------------------------------------
00612 // Methods to set gadget values                                                             
00613 
00614 /********************************************************************************************
00615 
00616 >   void DialogOp::SetComboListLength( CGadgetID Gadget )
00617 
00618     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
00619     Created:    15/9/93
00620     Inputs:     -
00621     Outputs:    -
00622     Returns:    -
00623     Purpose:    See DialogManager for a description of this function 
00624     Errors:     -
00625     SeeAlso:    DialogManager::SetUnitGadgetValue
00626 
00627 ********************************************************************************************/
00628 
00629 void DialogOp::SetComboListLength( CGadgetID Gadget)
00630 {
00631     DlgMgr->SetComboListLength(GetReadWriteWindowID(),Gadget);
00632 }  
00633 
00634 /********************************************************************************************
00635 
00636 >   BOOL DialogOp::SetUnitGadgetValue( CGadgetID Gadget, 
00637                                        UnitType Unit, 
00638                                        MILLIPOINT Value,
00639                                        BOOL EndOfList, 
00640                                        INT32 ListPos 
00641                                      )
00642 
00643     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00644     Created:    15/9/93
00645     Inputs:     -
00646     Outputs:    -
00647     Returns:    -
00648     Purpose:    See DialogManager for a description of this function 
00649     Errors:     -
00650     SeeAlso:    DialogManager::SetUnitGadgetValue
00651 
00652 ********************************************************************************************/
00653 
00654 BOOL DialogOp::SetUnitGadgetValue( CGadgetID Gadget, 
00655                                    UnitType Unit, 
00656                                    MILLIPOINT Value,
00657                                    BOOL EndOfList, 
00658                                    INT32 ListPos 
00659                                  )
00660 {
00661     return(DlgMgr->SetUnitGadgetValue(GetReadWriteWindowID(), Gadget, Unit, Value, EndOfList, ListPos)); 
00662 }  
00663 
00664 /********************************************************************************************
00665 >   BOOL DialogOp::SetDimensionUnitGadgetValue( CGadgetID Gadget, 
00666                                                 UnitType  units,
00667                                                 double    Value,
00668                                                 Node*     pNode,
00669                                                 BOOL      IncludeUnitSpecifier = TRUE,
00670                                                 BOOL      EndOfList = FALSE, 
00671                                                 INT32       ListPos   = -1
00672                                                 )
00673 
00674     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00675     Created:    13/10/95
00676     Purpose:    See DialogManager for a description of this function 
00677 ********************************************************************************************/
00678 
00679 BOOL DialogOp::SetDimensionUnitGadgetValue( CGadgetID Gadget, 
00680                                             UnitType  units, 
00681                                             double    Value,
00682                                             Node*     pNode,
00683                                             BOOL      IncludeUnitSpecifier,
00684                                             BOOL      EndOfList, 
00685                                             INT32       ListPos 
00686                                             )
00687 {
00688     return DlgMgr->SetDimensionUnitGadgetValue(GetReadWriteWindowID(), Gadget, units, Value, pNode,
00689                                                IncludeUnitSpecifier, EndOfList, ListPos); 
00690 }  
00691 
00692 
00693 /********************************************************************************************
00694 
00695 >   BOOL DialogOp::SetLongGadgetValue(CGadgetID Gadget, 
00696                                       INT32 value, 
00697                                       BOOL EndOfList, 
00698                                       INT32 ListPos) 
00699 
00700     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00701     Created:    15/9/93
00702     Inputs:     -
00703     Outputs:    -
00704     Returns:    -
00705     Purpose:    See DialogManager for a description of this function
00706     Errors:     -
00707     SeeAlso:    DialogManager::SetLongGadgetValue
00708 
00709 ********************************************************************************************/
00710 
00711 BOOL DialogOp::SetLongGadgetValue(CGadgetID Gadget, 
00712                                   INT32 value, 
00713                                   BOOL EndOfList, 
00714                                   INT32 ListPos) 
00715 {                                                
00716     return(DlgMgr->SetLongGadgetValue(GetReadWriteWindowID(), Gadget, value, EndOfList, ListPos));  
00717 }    
00718 
00719 /********************************************************************************************
00720 
00721 >   BOOL DialogOp::SetDoubleGadgetValue(CGadgetID Gadget, 
00722                                       double value, 
00723                                       BOOL EndOfList, 
00724                                       INT32 ListPos) 
00725 
00726     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00727     Created:    15/9/93
00728     Inputs:     -
00729     Outputs:    -
00730     Returns:    -
00731     Purpose:    See DialogManager for a description of this function
00732     Errors:     -
00733     SeeAlso:    DialogManager::SetLongGadgetValue
00734 
00735 ********************************************************************************************/
00736 
00737 BOOL DialogOp::SetDoubleGadgetValue(CGadgetID Gadget, 
00738                                   double value, 
00739                                   BOOL EndOfList, 
00740                                   INT32 ListPos) 
00741 {                                                
00742     return(DlgMgr->SetDoubleGadgetValue(GetReadWriteWindowID(), Gadget, value, EndOfList, ListPos));  
00743 }    
00744 
00745 /********************************************************************************************
00746 
00747 >   BOOL DialogOp::SetBoolGadgetSelected(CGadgetID Gadget,
00748                                           BOOL IsSelected,
00749                                           INT32 ListPos = 0)
00750 
00751     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00752     Created:    29/7/94
00753     Inputs:     Gadget - The Gadget to be set
00754                 IsSelected - TRUE to select, FALSE to deselect the gadget
00755                 ListPos - The item (in list fields) to be affected
00756     Outputs:    -
00757     Returns:    TRUE if it succeeded
00758     Purpose:    An interface for turning option/radio buttons and list item selection states
00759                 on or off. See DialogManager::SetBoolGadgetValue for details.
00760     Errors:     -
00761     SeeAlso:    DialogManager::SetBoolGadgetValue
00762 
00763 ********************************************************************************************/
00764 
00765 BOOL DialogOp::SetBoolGadgetSelected(CGadgetID Gadget, BOOL IsSelected, INT32 ListPos) 
00766 {                                                
00767     return(DlgMgr->SetBoolGadgetSelected(GetReadWriteWindowID(), Gadget, IsSelected, ListPos));
00768 
00769 //  return(DlgMgr->SetLongGadgetValue(WindowID, Gadget,
00770 //                                  (IsSelected) ? TRUE : FALSE, EndOfList, ListPos));
00771 }    
00772 
00773 
00774 
00775 /********************************************************************************************
00776 
00777 >   BOOL DialogOp::SetRadioGroupSelected(CGadgetID *GroupGadgets, CGadgetID SelectedGadget)
00778 
00779     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00780     Created:    13/10/94
00781     Inputs:     GroupGadgets - A NULL-terminated list of gadgets in the radio group
00782                 SelectedGadget - The gadget from this list which you wish to be selected
00783     Outputs:    -
00784     Returns:    TRUE if it succeeded
00785     Purpose:    Allows you to select one of a group of gadgets, while ensuring that all
00786                 other gadgets are disabled. Each item in the NULL_terminated list will
00787                 be deselected, except the item 'SelectedGadget', which will be selected
00788 
00789     Errors:     ERROR3 will occur if the list is empty, or if the SelectedGadget does not
00790                 appear in the list.
00791 
00792     SeeAlso:    DialogManager::SetBoolGadgetValue;
00793                 DialogOp::GetRadioGroupSelected
00794 
00795 ********************************************************************************************/
00796 
00797 BOOL DialogOp::SetRadioGroupSelected(CGadgetID *GroupGadgets, CGadgetID SelectedGadget)
00798 {
00799     INT32 i = 0;
00800     INT32 returnval = 0;        // Accumulator for BOOL return values
00801 #ifdef _DEBUG
00802     BOOL WasInList = FALSE;
00803 #endif
00804 
00805     while (GroupGadgets[i] != 0)
00806     {
00807 #ifdef _DEBUG
00808         if (GroupGadgets[i] == SelectedGadget)
00809             WasInList = TRUE;
00810 #endif
00811         returnval |= (INT32) SetBoolGadgetSelected(GroupGadgets[i], (GroupGadgets[i] == SelectedGadget));
00812         i++;
00813     }
00814 
00815 #ifdef _DEBUG
00816     if (!WasInList)
00817         ERROR3("DialogOp::SetRadioGroupSelected - SelectedGadget is not in the list of radio gadgets");
00818 #endif
00819 
00820     return(returnval != 0);
00821 }
00822 
00823 
00824 /********************************************************************************************
00825 
00826 >   BOOL DialogOp::SetStringGadgetValue(CGadgetID Gadget, 
00827                                         UINT32 IDStr,  
00828                                         BOOL EndOfList, 
00829                                         INT32 ListPos 
00830                                         )          
00831     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00832     Created:    15/9/93
00833     Inputs:     -
00834     Outputs:    -
00835     Returns:    -
00836     Purpose:    See DialogManager for a description of this function
00837     Errors:     -
00838     SeeAlso:    DialogManager::SetStringGadgetValue
00839 
00840 ********************************************************************************************/
00841 
00842 BOOL DialogOp::SetStringGadgetValue(CGadgetID Gadget, 
00843                                     UINT32 IDStr,  
00844                                     BOOL EndOfList, 
00845                                     INT32 ListPos 
00846                                     )           
00847 {       
00848     return(DlgMgr->SetStringGadgetValue(GetReadWriteWindowID(), Gadget, IDStr, EndOfList, ListPos));  
00849 }
00850     
00851 /********************************************************************************************
00852 
00853 >   BOOL DialogOp::SetStringGadgetValue(CGadgetID Gadget, 
00854                                     StringBase* StrValue, 
00855                                     BOOL EndOfList, 
00856                                     INT32 ListPos)
00857 
00858     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00859     Created:    15/9/93
00860     Inputs:     -
00861     Outputs:    -
00862     Returns:    -
00863     Purpose:    See DialogManager for a description of this function
00864     Errors:     -
00865     SeeAlso:    DialogManager::SetStringGadgetValue
00866 
00867 ********************************************************************************************/
00868     
00869 BOOL DialogOp::SetStringGadgetValue(CGadgetID Gadget, 
00870                                     const StringBase& StrValue, 
00871                                     BOOL EndOfList, 
00872                                     INT32 ListPos)
00873 {      
00874     return (DlgMgr->SetStringGadgetValue(GetReadWriteWindowID(), Gadget, StrValue, EndOfList, ListPos)); 
00875 }
00876 
00877 /********************************************************************************************
00878 
00879 >   BOOL DialogOp::SetCustomComboGadgetValue (CGadgetID Gadget, 
00880                               CustomComboBoxControlDataItem* TheItem,   
00881                               BOOL EndOfList = TRUE, 
00882                               INT32 ListPos = 0)
00883 
00884     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> S
00885     Created:    12/8/99
00886     Inputs:     -
00887     Outputs:    -
00888     Returns:    -
00889     Purpose:    See DialogManager for a description of this function
00890     Errors:     -
00891     SeeAlso:    DialogManager::SetCustomComboGadgetValue
00892 
00893 ********************************************************************************************/
00894 
00895 BOOL DialogOp::SetCustomComboGadgetValue( CGadgetID Gadget, 
00896                                           CustomComboBoxControlDataItem* TheItem,
00897                                           BOOL EndOfList, 
00898                                           INT32 ListPos )
00899 {
00900 #ifndef EXCLUDE_FROM_XARALX
00901     return( DlgMgr->SetCustomComboGadgetValue( GetReadWriteWindowID(), Gadget, TheItem, EndOfList, ListPos ) ); 
00902 #else
00903     return FALSE;
00904 #endif
00905 }
00906 
00907 /********************************************************************************************
00908 
00909 >   BOOL DialogOp::SelectCustomComboGadgetValueOnString (CGadgetID Gadget, StringBase* StrVal)
00910 
00911     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> S
00912     Created:    9/9/99
00913     Inputs:     -
00914     Outputs:    -
00915     Returns:    -
00916     Purpose:    See DialogManager for a description of this function
00917     Errors:     -
00918     SeeAlso:    DialogManager::SelectCustomComboGadgetValueOnString
00919 
00920 ********************************************************************************************/
00921 
00922 BOOL DialogOp::SelectCustomComboGadgetValueOnString (CGadgetID Gadget, StringBase* StrVal)
00923 {
00924     return (DlgMgr->SelectCustomComboGadgetValueOnString (GetReadWriteWindowID(), Gadget, StrVal));
00925 }
00926 
00927 
00928 
00929 
00930 /******************************************************************************
00931 >   void        DialogOp::BuildResDropList( const CGadgetID DropListID,
00932                                                 const BOOL      bIncludeAuto = TRUE,
00933                                                 const BOOL      bVerbose = FALSE,
00934                                                 const INT32         Default=0
00935                                                 )
00936 
00937     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00938     Created:    10-06-2005
00939     Purpose:    Builds a drop down list for a combo box 
00940 ******************************************************************************/
00941 
00942 void DialogOp::BuildResDropList(const CGadgetID DropListID,
00943                                     const BOOL      bIncludeAuto,
00944                                     const BOOL      bVerbose,
00945                                     const INT32         Default
00946                                     )
00947 {
00948     DeleteAllValues(DropListID);
00949     SetComboListLength(DropListID);
00950 
00951     // TODO:
00952     // Get XML document from alongside exe
00953     // For each resolution
00954     //  Add item to dropdown
00955     // Next
00956     if (bVerbose)
00957     {
00958         if (bIncludeAuto)
00959             SetStringGadgetValue(DropListID, _R(IDS_RES_AUTOVARIABLE),  TRUE);
00960 
00961 //      SetStringGadgetValue(DropListID, _R(IDS_RES_72),    TRUE);
00962         SetStringGadgetValue(DropListID, _R(IDS_RES_SCREEN),    TRUE);
00963         SetStringGadgetValue(DropListID, _R(IDS_RES_INTERMEDIATE),  TRUE);
00964         SetStringGadgetValue(DropListID, _R(IDS_RES_PRINT), TRUE);
00965         SetStringGadgetValue(DropListID, _R(IDS_RES_PRINT300),  TRUE);
00966     }
00967     else
00968     {
00969         if (bIncludeAuto)
00970             SetStringGadgetValue(DropListID, _R(IDS_RES_AUTO),  TRUE);
00971 
00972 //      SetStringGadgetValue(DropListID, _R(IDS_RES_72),    TRUE);
00973         SetStringGadgetValue(DropListID, _R(IDS_RES_96),    TRUE);
00974         SetStringGadgetValue(DropListID, _R(IDS_RES_150),   TRUE);
00975         SetStringGadgetValue(DropListID, _R(IDS_RES_200),   TRUE);
00976         SetStringGadgetValue(DropListID, _R(IDS_RES_300),   TRUE);
00977     }
00978 
00979     SetComboListLength(DropListID);
00980     SetSelectedValueIndex(DropListID, Default);
00981 }
00982 
00983 
00984 
00985 
00986 /******************************************************************************
00987 >   void        DialogOp::SetResDropListValue(  const CGadgetID DropListID,
00988                                                 const BOOL      bIncludeAuto = TRUE,
00989                                                 const INT32         iValue = 0
00990                                                 )
00991 
00992     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00993     Created:    10-06-2005
00994     Purpose:    Builds a drop down list for a combo box 
00995 ******************************************************************************/
00996 
00997 void DialogOp::SetResDropListValue(const CGadgetID DropListID,
00998                                     const BOOL      bIncludeAuto,
00999                                     const INT32         iValue
01000                                     )
01001 {
01002     // TODO:
01003     // Get XML document from alongside exe
01004     // Discover index by comparing value against values in XML
01005     INT32 iAutoAdjust = bIncludeAuto ? 1 : 0;
01006 
01007     switch (iValue)
01008     {
01009     case 0:
01010         if (bIncludeAuto)
01011         {
01012             SetSelectedValueIndex(DropListID, 0);
01013         }
01014         break;
01015 //  case 72:
01016 //      SetSelectedValueIndex(DropListID, iAutoAdjust + 0);
01017 //      break;
01018     case 96:
01019         SetSelectedValueIndex(DropListID, iAutoAdjust + 0);
01020         break;
01021     case 150:
01022         SetSelectedValueIndex(DropListID, iAutoAdjust + 1);
01023         break;
01024     case 200:
01025         SetSelectedValueIndex(DropListID, iAutoAdjust + 2);
01026         break;
01027     case 300:
01028         SetSelectedValueIndex(DropListID, iAutoAdjust + 3);
01029         break;
01030     default:
01031         {
01032             // Remove selected item from list first
01033             // otherwise is screws up the value we are about to put into the field
01034             SetSelectedValueIndex(DropListID, -1);
01035 
01036             TCHAR str[32];
01037             String_32 strTemp(_R(IDS_RES_PPI_FORMAT));
01038             camSnprintf( str, 32, strTemp, iValue );
01039             String_32 strPPI(str);
01040             SetStringGadgetValue(DropListID, strPPI, FALSE, -1);
01041         }
01042         break;
01043     }
01044 }
01045 
01046             
01047             
01048             
01049 /******************************************************************************
01050 >   INT32       DialogOp::GetResDropListValue(  const CGadgetID DropListID,
01051                                             const BOOL      bIncludeAuto = TRUE,
01052                                             BOOL*           bValid = NULL
01053                                             )
01054 
01055     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01056     Created:    10-06-2005
01057     Purpose:    Gets value from Resolution dropdown list
01058 ******************************************************************************/
01059 
01060 INT32   DialogOp::GetResDropListValue(  const CGadgetID DropListID,
01061                                     const BOOL      bIncludeAuto,
01062                                     BOOL*           pbValid
01063                                     )
01064 {
01065     BOOL Valid;
01066     INT32 iValue = 0;
01067     if (pbValid) *pbValid = FALSE;
01068 
01069     // First check whether it's "none" or not
01070     String_256 str;
01071     str = GetStringGadgetValue(DropListID, &Valid, -1);
01072 
01073 //  if (str.IsIdentical(String_32(_R(IDS_LE_NONE))) ||
01074 //      str.IsIdentical(String_32(_R(IDS_LE_MANY))) ||
01075 //      !Valid)
01076 //  {
01077 //      return;
01078 //  }
01079 //
01080     if (bIncludeAuto && str.IsIdentical(String_32(_R(IDS_RES_AUTO))))
01081     {
01082         iValue = 0;
01083         Valid = TRUE;
01084     }
01085     else if (str.IsIdentical(String_32(_R(IDS_RES_AUTOVARIABLE))))
01086     {
01087         iValue = 0;
01088         Valid = TRUE;
01089     }
01090     else if (str.IsIdentical(String_32(_R(IDS_RES_SCREEN))))
01091     {
01092         iValue = 96;
01093         Valid = TRUE;
01094     }
01095     else if (str.IsIdentical(String_32(_R(IDS_RES_INTERMEDIATE))))
01096     {
01097         iValue = 150;
01098         Valid = TRUE;
01099     }
01100     else if (str.IsIdentical(String_32(_R(IDS_RES_PRINT))))
01101     {
01102         iValue = 200;
01103         Valid = TRUE;
01104     }
01105     else if (str.IsIdentical(String_32(_R(IDS_RES_PRINT300))))
01106     {
01107         iValue = 300;
01108         Valid = TRUE;
01109     }
01110     else
01111         iValue = GetLongGadgetValue(DropListID, 1, 1000, 0, &Valid);
01112 
01113     if (pbValid) *pbValid = Valid;
01114     return iValue;
01115 }
01116 
01117             
01118             
01119             
01120 /********************************************************************************************
01121 
01122 >   BOOL DialogOp::SetGadgetRange(CGadgetID GadgetID, INT32 Min, INT32 Max, INT32 PageInc)
01123 
01124     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01125     Created:    15/9/93
01126     Inputs:     -
01127     Outputs:    -
01128     Returns:    -
01129     Purpose:    See DialogManager for a description of this function
01130     Errors:     -
01131     SeeAlso:    DialogManager::SetGadgetValue
01132 
01133 ********************************************************************************************/
01134 
01135 BOOL DialogOp::SetGadgetRange(CGadgetID GadgetID, INT32 Min, INT32 Max, INT32 PageInc)
01136 {                                                       
01137     return (DlgMgr->SetGadgetRange(GetReadWriteWindowID(), GadgetID, Min, Max, PageInc));   
01138 } 
01139 
01140 /********************************************************************************************
01141 
01142 >   BOOL DialogOp::SetSelectedValueIndex(CGadgetID Gadget, 
01143                                           INT32 Index)     
01144 
01145     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01146     Created:    20/9/93
01147     Inputs:     -
01148     Outputs:    -
01149     Returns:    -
01150     Purpose:    See DialogManager for a description of this function
01151     Errors:     -
01152     SeeAlso:    DialogManager::SetSelectedValueIndex
01153 
01154 ********************************************************************************************/
01155 
01156 BOOL DialogOp::SetSelectedValueIndex(CGadgetID Gadget, 
01157                                       INT32 Index)     
01158 { 
01159     return (DlgMgr->SetSelectedValueIndex(GetReadWriteWindowID(), Gadget, Index));  
01160 }                                              
01161 
01162 /********************************************************************************************
01163 
01164 >   BOOL DialogOp::SetSelectedValueRange(CGadgetID Gadget, 
01165                                           WORD StartIndex,
01166                                           WORD EndIndex,
01167                                           BOOL Select)     
01168 
01169     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01170     Created:    29/04/94
01171     Inputs:     -
01172     Outputs:    -
01173     Returns:    -
01174     Purpose:    See DialogManager for a description of this function
01175     Errors:     -
01176     SeeAlso:    DialogManager::SetSelectedValueIndex
01177 
01178 ********************************************************************************************/
01179 
01180 BOOL DialogOp::SetSelectedValueRange(CGadgetID Gadget,
01181                                       WORD StartIndex,
01182                                       WORD EndIndex,
01183                                       BOOL Select)
01184 {
01185     return (DlgMgr->SetSelectedValueRange(GetReadWriteWindowID(), Gadget, StartIndex, EndIndex, Select));   
01186 }
01187 
01188 /********************************************************************************************
01189 
01190 >   BOOL DialogOp::SetDimensionGadgetValue( CGadgetID Gadget, 
01191                                             MILLIPOINT Value,
01192                                             Node* pNode,
01193                                             BOOL IncludeUnitSpecifier = TRUE,
01194                                             BOOL EndOfList = FALSE, 
01195                                             INT32 ListPos = -1
01196                                             )
01197 
01198     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01199     Created:    15/6/94
01200     Inputs:     -
01201     Outputs:    -
01202     Returns:    -
01203     Purpose:    See DialogManager for a description of this function 
01204     Errors:     -
01205     SeeAlso:    DialogManager::SetDimensionGadgetValue
01206 
01207 ********************************************************************************************/
01208 
01209 BOOL DialogOp::SetDimensionGadgetValue( CGadgetID Gadget, 
01210                                         MILLIPOINT Value,
01211                                         Node* pNode,
01212                                         BOOL IncludeUnitSpecifier,
01213                                         BOOL EndOfList, 
01214                                         INT32 ListPos 
01215                                     )
01216 {
01217     return(DlgMgr->SetDimensionGadgetValue(GetReadWriteWindowID(), Gadget, Value, pNode, IncludeUnitSpecifier, EndOfList, ListPos)); 
01218 }  
01219 
01220 /********************************************************************************************
01221 
01222 >   BOOL DialogOp::SetMemoryGadgetValue( CGadgetID Gadget, 
01223                                           UINT32 Value,
01224                                           BOOL EndOfList, 
01225                                           INT32 ListPos 
01226                                         )
01227 
01228     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01229     Created:    30/1/95
01230     Inputs:     -
01231     Outputs:    -
01232     Returns:    -
01233     Purpose:    See DialogManager for a description of this function 
01234     Errors:     -
01235     SeeAlso:    DialogManager::SetMemoryGadgetValue; DialogManager::SetMemoryGadgetValue;
01236 
01237 ********************************************************************************************/
01238 
01239 BOOL DialogOp::SetMemoryGadgetValue( CGadgetID Gadget, 
01240                                      UINT32 Value,
01241                                      BOOL EndOfList, 
01242                                      INT32 ListPos 
01243                                     )
01244 {
01245     return(DlgMgr->SetMemoryGadgetValue(GetReadWriteWindowID(), Gadget, Value, EndOfList, ListPos)); 
01246 }  
01247 
01248 /********************************************************************************************
01249 
01250 >   BOOL DialogOp::SetGadgetHelp( CGadgetID Gadget, 
01251                                   UINT32 BubbleID, 
01252                                   UINT32 StatusID, 
01253                                   UINT32 ModuleID = 0)
01254 
01255     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01256     Created:    21/4/95
01257     Inputs:     -
01258     Outputs:    -
01259     Returns:    -
01260     Purpose:    See DialogManager for a description of this function 
01261     Errors:     -
01262     SeeAlso:    DialogManager::SetGadgetHelp
01263 
01264 ********************************************************************************************/
01265 
01266 BOOL DialogOp::SetGadgetHelp( CGadgetID Gadget, 
01267                               UINT32 BubbleID, 
01268                               UINT32 StatusID, 
01269                               UINT32 ModuleID)
01270 {
01271     return(DlgMgr->SetGadgetHelp(GetReadWriteWindowID(), Gadget, BubbleID, StatusID, ModuleID));  
01272 }   
01273 
01274 
01275 // -----------------------------------------------------------------------------------------
01276 // Methods to get gadget values
01277 
01278 /********************************************************************************************
01279 
01280 >   MILLIPOINT DialogOp::GetUnitGadgetValue(CGadgetID Gadget,  
01281                                   UnitType DefaultType,
01282                                   MILLIPOINT StartRange, 
01283                                   MILLIPOINT EndRange,
01284                                   UINT32 IDSInvalidMsg,  
01285                                   BOOL* Valid)        
01286 
01287     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01288     Created:    15/9/93
01289     Inputs:     -
01290     Outputs:    -
01291     Returns:    -
01292     Purpose:    See DialogManager for a description of this function
01293     Errors:     -
01294     SeeAlso:    DialogManager::GetUnitGadgetValue
01295 
01296 ********************************************************************************************/
01297     
01298 MILLIPOINT DialogOp::GetUnitGadgetValue(CGadgetID Gadget,  
01299                                   UnitType DefaultType,
01300                                   MILLIPOINT StartRange, 
01301                                   MILLIPOINT EndRange,
01302                                   UINT32 IDSInvalidMsg,  
01303                                   BOOL* Valid)        
01304 {    
01305     return(DlgMgr->GetUnitGadgetValue(GetReadWriteWindowID(), Gadget, DefaultType, StartRange, EndRange,
01306                                   IDSInvalidMsg, Valid));         
01307 }   
01308 
01309 /********************************************************************************************
01310 
01311 >   INT32 DialogOp::GetLongGadgetValue(CGadgetID Gadget, 
01312                                       INT32 StartRange, 
01313                                       INT32 EndRange, 
01314                                       UINT32 IDSInvalidMsg, 
01315                                       BOOL* Valid,
01316                                       DialogManager::PFNSTRINGTOINT32 = ::StringToLong)
01317 
01318     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01319     Created:    15/9/93
01320     Inputs:     -
01321     Outputs:    -
01322     Returns:    -
01323     Purpose:    See DialogManager for a description of this function
01324     Errors:     -
01325     SeeAlso:    DialogManager::GetLongGadgetValue
01326 
01327 ********************************************************************************************/
01328 
01329 INT32 DialogOp::GetLongGadgetValue(CGadgetID Gadget, 
01330                                   INT32 StartRange, 
01331                                   INT32 EndRange, 
01332                                   UINT32 IDSInvalidMsg, 
01333                                   BOOL* Valid,
01334                                   Convert::PFNSTRINGTOINT32 pfnParser)
01335 {  
01336     return DlgMgr->GetLongGadgetValue(GetReadWriteWindowID(),
01337                                       Gadget,
01338                                       StartRange,
01339                                       EndRange,
01340                                       IDSInvalidMsg, 
01341                                       Valid,
01342                                       pfnParser);
01343 }  
01344 
01345 /********************************************************************************************
01346 
01347 >   double DialogOp::GetDoubleGadgetValue(CGadgetID Gadget, 
01348                                       double StartRange, 
01349                                       double EndRange, 
01350                                       UINT32 IDSInvalidMsg, 
01351                                       BOOL* Valid,
01352                                       DialogManager::PFNSTRINGTODOUBLE = ::StringToDouble)
01353 
01354     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01355     Created:    16/12/94
01356     Inputs:     -
01357     Outputs:    -
01358     Returns:    -
01359     Purpose:    See DialogManager for a description of this function
01360     Errors:     -
01361     SeeAlso:    DialogManager::GetDoubleGadgetValue
01362 
01363 ********************************************************************************************/
01364 
01365 double DialogOp::GetDoubleGadgetValue(CGadgetID Gadget, 
01366                                   double StartRange, 
01367                                   double EndRange, 
01368                                   UINT32 IDSInvalidMsg, 
01369                                   BOOL* Valid,
01370                                   Convert::PFNSTRINGTODOUBLE pfnParser)
01371 {  
01372     return DlgMgr->GetDoubleGadgetValue(GetReadWriteWindowID(),
01373                                       Gadget,
01374                                       StartRange,
01375                                       EndRange,
01376                                       IDSInvalidMsg, 
01377                                       Valid,
01378                                       pfnParser);
01379 }  
01380 
01381 
01382 /********************************************************************************************
01383 BOOL DialogOp::GetDoubleAndUnitGadgetValue( double*   pMPValue,
01384                                             double*   pUnitValue,
01385                                             UnitType* pUnitType,
01386                                             CGadgetID GadgetID,
01387                                             Node*     pNode)
01388     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
01389     Created:    13/9/95
01390     Inputs:     GadgetID   -
01391                 pNode      - node from which to determine default units (ie page units)
01392     Outputs:    pMPValue   - value of gadget converted to millipoints (accounting for scaling)
01393                 pUnitValue - value of gadget in terms of units output in pUnitType
01394                 pUnitType  - type of unit the value was specified in (or page units if none)
01395     Returns:    FALSE if fails
01396     Purpose:    Read the value from a gadget as a double millipont values accounting for unit scaling
01397                 ALSO read the type of unit specified and the gadget value in terms of these units
01398                 ie 0.5m would return 36000.0, 0.5 and METERS (assuming scaling 1m->1in)
01399 ********************************************************************************************/
01400 
01401 BOOL DialogOp::GetDoubleAndUnitGadgetValue( double*   pMPValue,
01402                                             double*   pUnitValue,
01403                                             UnitType* pUnitType,
01404                                             CGadgetID GadgetID,
01405                                             Node*     pNode)
01406 {
01407     return DlgMgr->GetDoubleAndUnitGadgetValue( pMPValue, pUnitValue, pUnitType,
01408                                                 GetReadWriteWindowID(), GadgetID, pNode);
01409 }
01410 
01411 
01412 /********************************************************************************************
01413 
01414 >   BOOL DialogOp::GetBoolGadgetSelected(CGadgetID Gadget,
01415                                         UINT32 IDSInvalidMsg = 0,
01416                                         BOOL* Valid = NULL,
01417                                         INT32 ListPos = -1)
01418 
01419     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01420     Created:    10/4/94
01421     Inputs:     -
01422     Outputs:    -
01423     Returns:    -
01424     Purpose:    See DialogManager for a description of this function
01425     Errors:     -
01426     SeeAlso:    DialogManager::GetLongGadgetValue;
01427                 DialogOp::GetRadioGroupSelected
01428 
01429 ********************************************************************************************/
01430 
01431 BOOL DialogOp::GetBoolGadgetSelected(CGadgetID Gadget,
01432                                     UINT32 IDSInvalidMsg,
01433                                     BOOL* Valid,
01434                                     INT32 ListPos)
01435 {  
01436     return (DlgMgr->GetBoolGadgetSelected(GetReadWriteWindowID(),
01437                                         Gadget,
01438                                         IDSInvalidMsg,
01439                                         Valid,
01440                                         ListPos));
01441 }  
01442 
01443 
01444 
01445 /********************************************************************************************
01446 
01447 >   CGadgetID DialogOp::GetRadioGroupSelected(CGadgetID *GroupGadgets)
01448 
01449     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01450     Created:    13/10/94
01451     Inputs:     GroupGadgets - Points to a NULL-terminated list of Gadget IDs
01452     Outputs:    -
01453     Returns:    The gadget ID of the gadget in the input list which was selected
01454                 or NULL if the list was empty or no items in it were selected
01455 
01456     Purpose:    To determine which control in a group is selected.
01457                 Returns the first control found to be selected, or if no controls were
01458                 found to be selected, returns NULL.
01459 
01460     Errors:     ERROR3 occurs in debug builds if the list was empty
01461 
01462     SeelAlso:   DialogOp::SetRadioGroupSelected;
01463                 DialogOp::SetBoolGadgetSelected
01464 
01465 ********************************************************************************************/
01466 
01467 CGadgetID DialogOp::GetRadioGroupSelected(CGadgetID *GroupGadgets)
01468 {
01469     INT32  i = 0;
01470 
01471     ERROR3IF(GroupGadgets[0] == 0,
01472                 "DialogOp::GetRadioGroupSelected called with blank ID list");
01473 
01474     while (GroupGadgets[i] != 0)
01475     {
01476         if (GetBoolGadgetSelected(GroupGadgets[i]))
01477             return(GroupGadgets[i]);
01478 
01479         i++;
01480     }
01481 
01482     return( 0 );
01483 }
01484 
01485 
01486 
01487 /********************************************************************************************
01488 
01489 >   String_256 DialogOp::GetStringGadgetValue(CGadgetID Gadget, BOOL* Valid, INT32 ListPos=1)
01490 
01491     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01492     Created:    15/9/93
01493     Inputs:     -
01494     Outputs:    -
01495     Returns:    -
01496     Purpose:    See DialogManager for a description of this function
01497     Errors:     -
01498     SeeAlso:    DialogManager::GetStringGadgetValue
01499 
01500 ********************************************************************************************/
01501 
01502 String_256 DialogOp::GetStringGadgetValue(CGadgetID Gadget, BOOL* Valid, INT32 ListPos)
01503 {   
01504     return (DlgMgr->GetStringGadgetValue(GetReadWriteWindowID(), Gadget, Valid, ListPos));
01505 }
01506 
01507 /********************************************************************************************
01508 
01509 >   BOOL DialogOp::GetGadgetRange(CGadgetID GadgetID, INT32* Min, INT32* Max) 
01510 
01511     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01512     Created:    15/9/93
01513     Inputs:     -
01514     Outputs:    -
01515     Returns:    -
01516     Purpose:    See DialogManager for a description of this function
01517     Errors:     -
01518     SeeAlso:    DialogManager::GetGadgetRange
01519 
01520 ********************************************************************************************/
01521 
01522 BOOL DialogOp::GetGadgetRange(CGadgetID GadgetID, INT32* Min, INT32* Max) 
01523 {                                                       
01524     return (DlgMgr->GetGadgetRange(GetReadWriteWindowID(), GadgetID, Min, Max));    
01525 }    
01526 
01527 
01528 
01529 /********************************************************************************************
01530 
01531 >   MILLIPOINT DialogOp::GetDimensionGadgetValue(CGadgetID Gadget, Node* pNode,BOOL* Valid,INT32 ListPos=-1)
01532 
01533     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01534     Created:    15/6/94
01535     Inputs:     -
01536     Outputs:    -
01537     Returns:    -
01538     Purpose:    See DialogManager for a description of this function
01539     Errors:     -
01540     SeeAlso:    DialogManager::GetDimensionGadgetValue
01541 
01542 ********************************************************************************************/
01543 
01544 MILLIPOINT DialogOp::GetDimensionGadgetValue(CGadgetID Gadget, Node* pNode, BOOL* Valid,INT32 ListPos)
01545 {   
01546     return (DlgMgr->GetDimensionGadgetValue(GetReadWriteWindowID(), Gadget, pNode, Valid, ListPos));
01547 }
01548 
01549 /********************************************************************************************
01550 
01551 >   UINT32 DialogOp::GetMemoryGadgetValue(CGadgetID Gadget,  
01552                                          UINT32 StartRange, 
01553                                          UINT32 EndRange,
01554                                          UINT32 IDSInvalidMsg,  
01555                                          BOOL* Valid)        
01556 
01557     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
01558     Created:    30/1/95
01559     Inputs:     -
01560     Outputs:    -
01561     Returns:    -
01562     Purpose:    See DialogManager for a description of this function
01563     Errors:     -
01564     SeeAlso:    DialogManager::GetMemoryGadgetValue;    DialogManager::SetMemoryGadgetValue;
01565 
01566 ********************************************************************************************/
01567     
01568 UINT32 DialogOp::GetMemoryGadgetValue(CGadgetID Gadget,  
01569                                      UINT32 StartRange, 
01570                                      UINT32 EndRange,
01571                                      UINT32 IDSInvalidMsg,  
01572                                      BOOL* Valid)        
01573 {    
01574     return(DlgMgr->GetMemoryGadgetValue(GetReadWriteWindowID(), Gadget, StartRange, EndRange,
01575                                         IDSInvalidMsg, Valid));         
01576 }   
01577 
01578 
01579 
01580 /********************************************************************************************
01581 
01582 >   BOOL DialogOp::DeleteAllValues(CGadgetID GadgetID)
01583 
01584     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01585     Created:    13/5/94
01586     Inputs:     -
01587     Outputs:    -
01588     Returns:    -
01589     Purpose:    Deletes ALL values in list-gadgets
01590                 See DialogManager for a description of this function
01591     Errors:     -
01592     SeeAlso:    DialogManager::DeleteAllValues
01593 
01594 ********************************************************************************************/
01595 
01596 BOOL DialogOp::DeleteAllValues(CGadgetID GadgetID)
01597 {
01598     return(DlgMgr->DeleteAllValues(GetReadWriteWindowID(), GadgetID));
01599 }
01600 
01601 
01602 
01603 /********************************************************************************************
01604 
01605 >   BOOL DialogOp::DeleteValue(CGadgetID GadgetID, 
01606                  BOOL EndOfList, 
01607                  INT32 ListPos)
01608 
01609     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01610     Created:    15/9/93
01611     Inputs:     -
01612     Outputs:    -
01613     Returns:    -
01614     Purpose:    See DialogManager for a description of this function
01615     Errors:     -
01616     SeeAlso:    DialogManager::DeleteValue
01617 
01618 ********************************************************************************************/
01619   
01620 BOOL DialogOp::DeleteValue(CGadgetID GadgetID, 
01621                  BOOL EndOfList, 
01622                  INT32 ListPos)
01623 {    
01624     return (DlgMgr->DeleteValue(GetReadWriteWindowID(), GadgetID, EndOfList, ListPos)); 
01625 }      
01626 
01627 /********************************************************************************************
01628 
01629 >   BOOL DialogOp::GetValueCount(CGadgetID GadgetID, INT32* Count)            
01630 
01631     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01632     Created:    15/9/93
01633     Inputs:     -
01634     Outputs:    -
01635     Returns:    -
01636     Purpose:    See DialogManager for a description of this function
01637     Errors:     -
01638     SeeAlso:    DialogManager::GetValueCount
01639 
01640 ********************************************************************************************/
01641 
01642 BOOL DialogOp::GetValueCount(CGadgetID GadgetID, INT32* Count)            
01643 {                                                            
01644     return (DlgMgr->GetValueCount(GetReadWriteWindowID(), GadgetID, Count)); 
01645 }         
01646 
01647 
01648 /********************************************************************************************
01649 
01650 >   INT32 DialogOp::GetSelectedValueIndex(CGadgetID GadgetID)
01651 
01652     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01653     Created:    21/10/94
01654     Inputs:     GadgetID - the 'listy' gadget you wish to interrogate
01655     Returns:    -1 if no items are selected in the gadget
01656                 Otherwise, the index of the selected item [0 .. numitems-1]
01657 
01658     Purpose:    A *SENSIBLE* interface to read which item of a combo/list box type of
01659                 gadget is selected.
01660 
01661     SeeAlso:    DialogOp::GetValueIndex; DialogOp::SetSelectedValueIndex
01662 
01663 ********************************************************************************************/
01664 
01665 INT32 DialogOp::GetSelectedValueIndex(CGadgetID GadgetID)
01666 {
01667     INT32 Index;
01668 
01669     BOOL Valid = DlgMgr->GetValueIndex(GetReadWriteWindowID(), GadgetID, &Index);
01670 
01671     if (Valid)
01672         return(Index);
01673 
01674     return(-1);     // No selection, or some error
01675 }
01676 
01677 
01678 /********************************************************************************************
01679 
01680 >   INT32 DialogOp::GetSelectedCount(CGadgetID GadgetID)
01681 
01682     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01683     Created:    4/10/95
01684     Inputs:     GadgetID = ID of list-type gadget
01685     Returns:    The number of selected items in the list-type gadget, or -1 if it fails
01686     Purpose:    Returns the number of selected items in a list-type gadget
01687     SeeAlso:    -
01688 
01689 ********************************************************************************************/
01690 
01691 INT32 DialogOp::GetSelectedCount(CGadgetID GadgetID)
01692 {
01693     return (DlgMgr->GetSelectedCount(GetReadWriteWindowID(), GadgetID));
01694 }
01695 
01696 /********************************************************************************************
01697 
01698 >   INT32 DialogOp::GetFirstSelectedItem(CGadgetID GadgetID)
01699 
01700     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01701     Created:    4/10/95
01702     Inputs:     GadgetID = ID of list-type gadget
01703     Returns:    The index of the firsted selected items in the list-type gadget, or -1 if it fails
01704     Purpose:    Returns the index of the first selected item in a list-type gadget
01705     SeeAlso:    -
01706 
01707 ********************************************************************************************/
01708 
01709 INT32 DialogOp::GetFirstSelectedItem(CGadgetID GadgetID)
01710 {
01711     return (DlgMgr->GetFirstSelectedItem(GetReadWriteWindowID(),GadgetID));
01712 }
01713 
01714 /********************************************************************************************
01715 
01716 >   INT32* DialogOp::GetSelectedItems(CGadgetID GadgetID)
01717 
01718     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
01719     Created:    4/10/95
01720     Inputs:     GadgetID = ID of list-type gadget
01721     Returns:    ptr to the INT32 array, or NULL if it fails
01722     Purpose:    Returns a ptr to an INT32 array that holds the list of selected indexes.
01723                 The last array entry contains -1.
01724 
01725                 The caller is responsible for deleting the array that's returned.
01726                 e.g
01727                     INT32* pArray = GetSelectedItems(WindowID,GadgetID);
01728                     if (pArray != NULL)
01729                     {
01730                         ..... // Use the array
01731                         delete [] pArray;
01732                     }
01733     SeeAlso:    -
01734 
01735 ********************************************************************************************/
01736 
01737 INT32* DialogOp::GetSelectedItems(CGadgetID GadgetID)
01738 {
01739     return (DlgMgr->GetSelectedItems(GetReadWriteWindowID(),GadgetID));
01740 }
01741 
01742 
01743 /********************************************************************************************
01744 
01745 >   BOOL DialogOp::GetValueIndex(CGadgetID GadgetID, WORD* Index)    
01746 
01747     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01748     Created:    15/9/93
01749     Inputs:     -
01750     Outputs:    -
01751     Returns:    -
01752     Purpose:    See DialogManager for a description of this function
01753     Errors:     -
01754     SeeAlso:    DialogManager::GetValueIndex
01755 
01756 ********************************************************************************************/
01757 
01758 BOOL DialogOp::GetValueIndex(CGadgetID GadgetID, WORD* Index)    
01759 {
01760     return (DlgMgr->GetValueIndex(GetReadWriteWindowID(), GadgetID, Index));
01761 }   
01762 
01763 /********************************************************************************************
01764 
01765 >   BOOL DialogOp::GetValueIndex(CGadgetID GadgetID, INT32* Index)    
01766 
01767     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01768     Created:    15/9/93
01769     Inputs:     -
01770     Outputs:    -
01771     Returns:    -
01772     Purpose:    See DialogManager for a description of this function
01773     Errors:     -
01774     SeeAlso:    DialogManager::GetValueIndex
01775 
01776 ********************************************************************************************/
01777 
01778 BOOL DialogOp::GetValueIndex(CGadgetID GadgetID, INT32* Index)    
01779 {
01780     return (DlgMgr->GetValueIndex(GetReadWriteWindowID(), GadgetID, Index));
01781 }   
01782 
01783 /********************************************************************************************
01784 
01785 >   BOOL DialogOp::EnableGadget(CGadgetID Gadget, BOOL Enabled) 
01786 
01787     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01788     Created:    15/9/93
01789     Inputs:     -
01790     Outputs:    -
01791     Returns:    -
01792     Purpose:    See DialogManager for a description of this function
01793     Errors:     -
01794     SeeAlso:    DialogManager::EnableGadget
01795 
01796 ********************************************************************************************/
01797 
01798 BOOL DialogOp::EnableGadget(CGadgetID Gadget, BOOL Enabled) 
01799 {   
01800     return (DlgMgr->EnableGadget(GetReadWriteWindowID(), Gadget, Enabled));     
01801 } 
01802 
01803 
01804 /********************************************************************************************
01805 
01806 >   BOOL DialogOp::IsGadgetEnabled( CGadgetID Gadget );
01807 
01808     Author:     Luke_Hart (Xara Group Ltd) <lukeh@xara.com>
01809     Created:    07/09/06
01810     Inputs:     WindowID:       Dialog box window identifier
01811                 Gadget:         Gadget identifier
01812     Outputs:
01813     Returns:    TRUE if enabled, else FALSE
01814     Purpose:    For checking if a gadget is enabled/disabled.
01815 
01816     Errors:     -
01817     SeeAlso:    DialogOp::IsGadgetEnabled
01818 
01819 ********************************************************************************************/
01820 
01821 BOOL DialogOp::IsGadgetEnabled( CGadgetID Gadget )
01822 {
01823     return DlgMgr->IsGadgetEnabled( GetReadWriteWindowID(), Gadget );
01824 }
01825 
01826 /********************************************************************************************
01827 
01828 >   BOOL DialogOp::HideGadget(CGadgetID GadgetID, BOOL Hide) 
01829 
01830     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01831     Created:    15/9/93
01832     Inputs:     -
01833     Outputs:    -
01834     Returns:    -
01835     Purpose:    See DialogManager for a description of this function
01836     Errors:     -
01837     SeeAlso:    DialogManager::HideGadget
01838 
01839 ********************************************************************************************/
01840 
01841 BOOL DialogOp::HideGadget(CGadgetID GadgetID, BOOL Hide) 
01842 {                                                                                
01843     return (DlgMgr->HideGadget(GetReadWriteWindowID(), GadgetID, Hide));        
01844 }
01845 
01846 /********************************************************************************************
01847 
01848 >   void DialogManager::SetGadgetWritable(CWindowID id, BOOL enable)
01849 
01850     Author:     DMC
01851     Created:    15/11/94
01852     Inputs:     id, the 'IDC_?' of the control.
01853                 enable, TRUE to allow the control to be typed into. FALSE to make it
01854                         read only.
01855     Purpose:    Sets the state of the 'Read Only' flag of an edit field or combo box.
01856 
01857 ********************************************************************************************/
01858 
01859 BOOL DialogOp::SetGadgetWritable(CGadgetID GadgetID, BOOL enable)
01860 {
01861     return( DlgMgr->SetGadgetWritable( GetReadWriteWindowID(), GadgetID, enable ) );
01862 }
01863 
01864 /********************************************************************************************
01865 
01866 >   void DialogOp::Layout(BOOL CanYield = FALSE)
01867 
01868     Author:     Alex Bligh <alex@alex.org.uk>
01869     Created:    10/05/2006
01870     Inputs:     -
01871     Outputs:    -
01872     Returns:    -
01873     Purpose:    Relayout dialog - for sizer changes
01874     Errors:     -
01875     SeeAlso:    -
01876 
01877 ********************************************************************************************/
01878 
01879 void DialogOp::Layout(BOOL CanYield /*=FALSE*/)
01880 {
01881     DlgMgr->Layout(GetReadWriteWindowID(), CanYield);
01882 }
01883     
01884 /********************************************************************************************
01885 
01886 >   BOOL DialogOp::GadgetRedraw(CGadgetID GadgetID, BOOL Redraw) 
01887 
01888     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
01889     Created:    15/9/93
01890     Inputs:     -
01891     Outputs:    -
01892     Returns:    -
01893     Purpose:    See DialogManager for a description of this function
01894     Errors:     -
01895     SeeAlso:    DialogManager::GadgetRedraw
01896 
01897 ********************************************************************************************/
01898     
01899 BOOL DialogOp::GadgetRedraw(CGadgetID GadgetID, BOOL Redraw) 
01900 {                                                           
01901     return (DlgMgr->GadgetRedraw(GetReadWriteWindowID(), GadgetID, Redraw)); 
01902 }
01903 
01904 
01905 
01906 /********************************************************************************************
01907 >   BOOL DialogOp::SetKeyboardFocus(CGadgetID gadD)
01908 
01909     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
01910     Created:    10/11/94
01911     Inputs:     gadID           ID of the "gadget" (control) which is to receive the
01912                                 input focus
01913     Outputs:    -
01914     Returns:    TRUE if successful.
01915     Purpose:    Sets the keyboard input focus to the given control.
01916     Errors:     -
01917     SeeAlso:    DialogManager::SetKeyboardFocus; DialogManager::DefaultKeyboardFocus
01918 ********************************************************************************************/
01919 
01920 BOOL DialogOp::SetKeyboardFocus(CGadgetID gadID)
01921 {
01922     return DialogManager::SetKeyboardFocus(GetReadWriteWindowID(), gadID);
01923 }
01924 
01925 
01926 /********************************************************************************************
01927 >   BOOL DialogOp::CaptureMouse(CGadgetID gadD)
01928 
01929     Author:     Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
01930     Created:    28/04/97
01931     Inputs:     gadID           ID of the "gadget" (control) which is to receive the
01932                                 input focus
01933     Outputs:    -
01934     Returns:    TRUE if successful.
01935     Purpose:    Allows the given control to Capture the mouse.
01936     Errors:     -
01937     SeeAlso:    DialogManager::CaptureMouse; DialogManager::ReleaseMouse
01938 ********************************************************************************************/
01939 
01940 BOOL DialogOp::CaptureMouse(CGadgetID gadID)
01941 {
01942     return DialogManager::CaptureMouse(GetReadWriteWindowID(), gadID);
01943 }
01944 
01945 
01946 
01947 /********************************************************************************************
01948 >   BOOL DialogOp::ReleaseMouse(CGadgetID gadD)
01949 
01950     Author:     Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
01951     Created:    28/04/97
01952     Inputs:     gadID           ID of the "gadget" (control) which is to receive the
01953                                 input focus
01954     Outputs:    -
01955     Returns:    TRUE if successful.
01956     Purpose:    Releases the mouse captured by the given control.
01957     Errors:     -
01958     SeeAlso:    DialogManager::CaptureMouse; DialogManager::ReleaseMouse
01959 ********************************************************************************************/
01960 
01961 BOOL DialogOp::ReleaseMouse(CGadgetID gadID)
01962 {
01963     return DialogManager::ReleaseMouse(GetReadWriteWindowID(), gadID);
01964 }
01965 
01966 
01967 
01968 /********************************************************************************************
01969 >   BOOL DialogOp::HighlightText(CGadgetID gadID, INT32 nStart = 0, INT32 nEnd = -1)
01970 
01971     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
01972     Created:    10/11/94
01973     Inputs:     gadID           control ID within the window/dialogue box
01974                 nStart          first letter to highlight (by default the very first)
01975                 nEnd            last letter to highlight (by default the very last)
01976     Outputs:    -
01977     Returns:    TRUE if successful
01978     Purpose:    Highlights the given range of text (by default all of it) within a
01979                 control that holds editable text, eg. an edit field.
01980     Errors:     ERROR3 if you try to highlight text in a control without any, eg. a
01981                 button or a scroller.
01982     SeeAlso:    DialogManager::HighlightText
01983 ********************************************************************************************/
01984 
01985 BOOL DialogOp::HighlightText(CGadgetID gadID, INT32 nStart, INT32 nEnd)
01986 {
01987     return DialogManager::HighlightText(GetReadWriteWindowID(), gadID, nStart, nEnd);
01988 }
01989 
01990 
01991 
01992 /********************************************************************************************
01993 >   void DialogOp::PaintGadgetNow(CGadgetID gid)
01994 
01995     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
01996     Created:    1/9/94
01997     Inputs:     gid             the gadget ID of a control
01998     Outputs:    -
01999     Returns:    -
02000     Purpose:    Immediately paints any invalid areas the control may have (like the 
02001                 "UpdateWindow" function in Windows, really).
02002     Errors:     -
02003     SeeAlso:    -
02004 ********************************************************************************************/
02005 
02006 void DialogOp::PaintGadgetNow(CGadgetID gid)
02007 {
02008     DialogManager::PaintGadgetNow(GetReadWriteWindowID(), gid);
02009 }
02010 
02011 
02012 
02013 /********************************************************************************************
02014 
02015 >   void DialogOp::InvalidateGadget(CGadgetID Gadget, BOOL EraseBackground=TRUE)
02016 
02017     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
02018     Created:    20/10/94
02019     Inputs:     Gadget - The ID of the gadget that you want to be redrawn
02020                 EraseBackground TRUE if the background should be erased
02021     Purpose:    Causes the Dialog Manager to tell the host os to get the gadget to be
02022                 redrawn. Calling this on a cc_DialogDraw gadget will cause you to receive
02023                 a DIM_REDRAW message in the not too distant future.
02024 
02025     SeeAlso:    DialogManager::InvalidateGadget
02026 
02027 ********************************************************************************************/
02028 
02029 void DialogOp::InvalidateGadget(CGadgetID Gadget, BOOL EraseBackground/*=TRUE*/)
02030 {
02031     // Call the Dialog Manager
02032     DialogManager::InvalidateGadget(GetReadWriteWindowID(), Gadget, EraseBackground);
02033 }
02034 
02035 
02036 
02037 /********************************************************************************************
02038 
02039 >   void DialogOp::InvalidateGadget(CGadgetID Gadget,
02040                                     RedrawInfoType *ExtraInfo,
02041                                     DocRect *InvalidRect);
02042 
02043     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02044     Created:    28/11/94
02045     Inputs:     Gadget - The ID of the gadget that you want to be redrawn
02046                 ExtraInfo - The information passed to your DIM_ mouse event handler
02047                 InvalidRect - The MILLIPOINT rectangle to invalidate, in the 
02048                 (0,0)->(dx,dy) coordinate space used in ReDrawInfoType.
02049 
02050     Purpose:    Causes the Dialog Manager to tell the host os to get the cc_DialogDraw
02051                 gadget to be redrawn, over the specfied rectangle. You should recieve
02052                 a DIM_REDRAW message in the not too distant future.
02053 
02054     SeeAlso:    DialogManager::InvalidateGadget
02055 
02056 ********************************************************************************************/
02057 
02058 void DialogOp::InvalidateGadget(CGadgetID Gadget,
02059                                 ReDrawInfoType *ExtraInfo,
02060                                 DocRect *InvalidRect)
02061 {
02062     // Call the Dialog Manager
02063     DialogManager::InvalidateGadget(GetReadWriteWindowID(), Gadget, ExtraInfo, InvalidRect);
02064 }
02065 
02066 /********************************************************************************************
02067 
02068 >   void DialogOp::ScrollKernelRenderedGadget(CGadgetID Gadget,
02069                                         DocRect *RectToScroll, DocCoord *ScrollBy);
02070 
02071     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02072     Created:    21/1/95
02073     Inputs:     wid - The Window identifier
02074                 Gadget - The ID of the gadget that you want to be redrawn
02075 
02076                 RectToScroll - The MILLIPOINT rectangle to scroll, in the (0,0)->(dx,dy)
02077                 coordinate space used in ReDrawInfoType structures. Think of this rectangle
02078                 as the visible portion of the window which will be copied (some of which
02079                 will be scrolled out of view), and let this method worry about invalidating
02080                 the 'hole' left behind to finish off the display.
02081                 This parameter may be NULL, in which case the entire gadget will be scrolled
02082 
02083                 ScrollBy - Gives the X and Y amounts in millipoints to scroll the given
02084                 rectangle. I don't know what will happen if neither of these values is zero!
02085 
02086     Purpose:    Causes the Dialog Manager to tell the host os to get the cc_DialogDraw
02087                 gadget to be scrolled, over the specfied rectangle. You should recieve
02088                 a DIM_REDRAW message in the not too distant future, to update any portions
02089                 that 'scroll into view'.
02090                 
02091     Notes:      If you are using a Virtual coordinate space which differs from the
02092                 (0,0)->(dx,dy) space that this requires, then you'll need to call
02093                 some conversion methods which do not yet exist!
02094 
02095                 See the dlgmgr version for fuller details
02096 
02097     SeeAlso:    DialogManager::ScrollKernelRenderedGadget
02098 
02099 ********************************************************************************************/
02100 
02101 void DialogOp::ScrollKernelRenderedGadget(CGadgetID Gadget,
02102                                         DocRect *RectToScroll, DocCoord *ScrollBy)
02103 {
02104     // Call the Dialog Manager
02105     DialogManager::ScrollKernelRenderedGadget(GetReadWriteWindowID(), Gadget, RectToScroll, ScrollBy);
02106 }
02107 
02108 
02109 
02110 /********************************************************************************************
02111 
02112 >   BOOL DialogOp::GetKernelRenderedGadgetInfo(CGadgetID Gadget, ReDrawInfoType *Result)
02113 
02114     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02115     Created:    19/1/95
02116 
02117     Inputs:     Gadget - The ID of the gadget that you want info for
02118     
02119     Returns:    FALSE if there was a catastrophic error (it will report an ERROR2), in
02120                 which case the returned data is invalid (well, it defaults to 96 Dpi and
02121                 an area of 72000x72000 millipoints, so is 'safe' to use, but probably wrong)
02122                 TRUE under normal conditions
02123 
02124     Outputs:    Result - will be returned filled in with appropriate kernel-rendered-
02125                 dialogue information (dx, dy, and Dpi will be filled in with the appropriate
02126                 values; pMousePOs, pDC, and pClipRect will all be NULL)
02127 
02128     Purpose:    Allows the user access to the same information which is passed in to
02129                 DIM_REDRAW and the kernel-rendered-dialogue mouse-handling messages. This
02130                 is just for convenience so they can calculate stuff at a time other than
02131                 handling those two types of dialogue event (e.g. if a document message
02132                 causes you to have to redraw a small portion of your gadget, you need this
02133                 information to calculate the invalidation rectangle from)
02134 
02135     SeeAlso:    DialogManager::GetKernelRenderedGadgetInfo
02136 
02137 ********************************************************************************************/
02138 
02139 BOOL DialogOp::GetKernelRenderedGadgetInfo(CGadgetID Gadget, ReDrawInfoType *Result)
02140 {
02141     // Call the Dialog Manager
02142     return(DialogManager::GetKernelRenderedGadgetInfo(GetReadWriteWindowID(), Gadget, Result));
02143 }
02144 
02145 
02146 
02147 /********************************************************************************************
02148 
02149 >   void DialogOp::SetGadgetBitmaps(GadgetID GadgetID, UINT32 Bitmap1, UINT32 Bitmap2)
02150 
02151     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
02152     Created:    26/10/94
02153     Inputs:     GadgetID - The gadget to set the bitmaps of
02154                 Bitmap1 - The first Bitmaps ID
02155                 Bitmap2 - The Second bitmaps ID
02156     Purpose:    Calls the dialog manager to set the bitmaps of the gadget (only for
02157                 cc_Slider controls at the moment)
02158 
02159 ********************************************************************************************/
02160 
02161 void DialogOp::SetGadgetBitmaps(CGadgetID GadgetID, UINT32 Bitmap1, UINT32 Bitmap2)
02162 {
02163     // Call the dialog Manager
02164     DialogManager::SetGadgetBitmaps(GetReadWriteWindowID(), GadgetID, Bitmap1, Bitmap2);
02165 }
02166 
02167 
02168 /********************************************************************************************
02169 
02170 >   void DialogOp::SetGadgetBitmaps(GadgetID GadgetID, const CGadgetImageList& imagelist)
02171 
02172     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
02173     Created:    08/Feb/2006
02174     Inputs:     GadgetID - The gadget to set the bitmaps of
02175                 imagelist - list of images for this gadget
02176     Purpose:    Calls the dialog manager to set the bitmaps of the gadget
02177 
02178 ********************************************************************************************/
02179 
02180 void DialogOp::SetGadgetBitmaps(CGadgetID GadgetID, const CGadgetImageList& imagelist)
02181 {
02182     // Call the dialog Manager
02183     DialogManager::SetGadgetBitmaps(GetReadWriteWindowID(), GadgetID, imagelist);
02184 }
02185 
02186 /********************************************************************************************
02187 
02188 >   void DialogOp::SetGadgetBitmap(CGadgetID Gadget, ResourceID Bitmap)
02189 
02190     Author:     Alex Bligh <alex@alex.org.uk>
02191     Created:    07/05/2006
02192     Inputs:     GadgetID - The gadget to set the bitmaps of
02193                 Bitmap - The ID of the bitmap
02194     Purpose:    Calls the dialog manager to set the bitmaps of the gadget
02195 
02196 ********************************************************************************************/
02197 
02198 void DialogOp::SetGadgetBitmap(CGadgetID Gadget, ResourceID Bitmap)
02199 {
02200     // Call the dialog Manager
02201     DialogManager::SetGadgetBitmap(GetReadWriteWindowID(), Gadget, Bitmap);
02202 }
02203 
02204 /********************************************************************************************
02205 
02206 >   ResourceID DialogOp::GetGadgetBitmap(CGadgetID Gadget)
02207 
02208     Author:     Alex Bligh <alex@alex.org.uk>
02209     Created:    07/05/2006
02210     Inputs:     GadgetID - The gadget to set the bitmaps of
02211                 Bitmap - The ID of the bitmap
02212     Purpose:    Calls the dialog manager to set the bitmaps of the gadget
02213 
02214 ********************************************************************************************/
02215 
02216 ResourceID DialogOp::GetGadgetBitmap(CGadgetID Gadget)
02217 {
02218     // Call the dialog Manager
02219     return DialogManager::GetGadgetBitmap(GetReadWriteWindowID(), Gadget);
02220 }
02221 
02222 
02223 /********************************************************************************************
02224 
02225 >   UINT32 DialogOp::GetGadgetImageCount(CGadgetID GadgetID)
02226 
02227     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
02228     Created:    08/Feb/2006
02229     Inputs:     GadgetID - The gadget to set the bitmaps of
02230                 imagelist - list of images for this gadget
02231     Purpose:    Calls the dialog manager to set the bitmaps of the gadget
02232 
02233 ********************************************************************************************/
02234 
02235 UINT32 DialogOp::GetGadgetImageCount(CGadgetID GadgetID)
02236 {
02237     // Call the dialog Manager
02238     return DialogManager::GetGadgetImageCount(GetReadWriteWindowID(), GadgetID);
02239 }
02240 
02241 
02242 /********************************************************************************************
02243 
02244 >   void DialogOp::SetBitmapButtonIndexes(GadgetID GadgetID, UINT32 SelectedIndex, UINT32 UnselectedIndex)
02245 
02246     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
02247     Created:    23/9/99
02248     Inputs:     GadgetID - The gadget to set the bitmaps of
02249                 SelectedIndex - index for the selected state glyph
02250                 UnselectedIndex - index for the unselected state glyph
02251     Purpose:    Calls the dialog manager to set the bitmaps of the cc_bitmapbutton control
02252 
02253 ********************************************************************************************/
02254 void DialogOp::SetBitmapButtonIndexes(CGadgetID GadgetID, UINT32 UnselectedIndex, UINT32 SelectedIndex)
02255 {
02256     // call the dialog manager function
02257     DialogManager::SetBitmapButtonIndexes(GetReadWriteWindowID(), GadgetID, SelectedIndex, UnselectedIndex);
02258 }
02259 
02260 
02261 /********************************************************************************************
02262 
02263 >   BOOL DialogOp::AddDialogControlToHelper(CGadgetID GadgetID)
02264 
02265     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
02266     Created:    23/9/99
02267     Inputs:     GadgetID
02268     Purpose:    Calls the dialog manager add this control to the dialog control helper
02269 
02270 ********************************************************************************************/
02271 
02272 BOOL DialogOp::AddDialogControlToHelper(CGadgetID GadgetID)
02273 {
02274     return DialogManager::AddDialogControlToHelper(GetReadWriteWindowID(), GadgetID);
02275 }
02276 
02277 
02278 /********************************************************************************************
02279 
02280 >   BOOL DialogOp::AddDialogControlToHelper(CGadgetID GadgetID, CDlgResID PageID)
02281 
02282     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
02283     Created:    23/9/99
02284     Inputs:     GadgetID
02285                 PageID - the ID of the tabbed dialog page that this control belongs to 
02286     Purpose:    Overridden version of above for use with tabbed dialogs, allows you to 
02287                 add controls that are not on the currently active page.
02288 
02289 ********************************************************************************************/
02290 
02291 BOOL DialogOp::AddDialogControlToHelper(CGadgetID GadgetID, CDlgResID PageID)
02292 {
02293     // get the handle of the page first
02294     CWindowID PageWindow = DialogManager::GetPageWindow(WindowID, PageID);
02295 
02296     if (PageWindow == NULL)
02297         return FALSE;
02298 
02299     return DialogManager::AddDialogControlToHelper(PageWindow, GadgetID);
02300 }
02301 
02302 /********************************************************************************************
02303 
02304 >   BOOL DialogOp::RemoveDialogControlFromHelper(CGadgetID GadgetID)
02305 
02306     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
02307     Created:    23/9/99
02308     Inputs:     GadgetID
02309     Purpose:    Calls the dialog manager remove this control from the dialog control helper
02310 
02311 ********************************************************************************************/
02312 
02313 BOOL DialogOp::RemoveDialogControlFromHelper(CGadgetID GadgetID)
02314 {
02315     return DialogManager::RemoveDialogControlFromHelper(GetReadWriteWindowID(), GadgetID);
02316 }
02317 
02318 
02319 /********************************************************************************************
02320 
02321 >   BOOL DialogOp::RemoveDialogControlFromHelper(CGadgetID GadgetID, CDlgResID PageID)
02322 
02323     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
02324     Created:    23/9/99
02325     Inputs:     GadgetID
02326                 PageID - ID of the tabbed dialog page this control is on
02327     Purpose:    Calls the dialog manager remove this control from the dialog control helper
02328                 Overridden version.
02329 ********************************************************************************************/
02330 
02331 BOOL DialogOp::RemoveDialogControlFromHelper(CGadgetID GadgetID, CDlgResID PageID)
02332 {
02333     // get the handle of the page first
02334     CWindowID PageWindow = DialogManager::GetPageWindow(WindowID, PageID);
02335 
02336     if (PageWindow == NULL)
02337         return FALSE;
02338 
02339     return DialogManager::RemoveDialogControlFromHelper(PageWindow, GadgetID);
02340 
02341 }
02342 
02343 /********************************************************************************************
02344 
02345 >   void SetEditGadgetType(CGadgetID Gadget, EditGadgetType Type)
02346 
02347     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02348     Created:    24/8/93
02349     Inputs:     -
02350     Outputs:    -
02351     Returns:    -
02352     Purpose:    See DialogManager for a description of this function
02353     Errors:     - 
02354     SeeAlso:    DialogManager::SetEditGadgetType
02355 
02356 ********************************************************************************************/
02357 
02358 void DialogOp::SetEditGadgetType(CGadgetID Gadget, EditGadgetType Type)
02359 {
02360     DlgMgr->SetEditGadgetType(GetReadWriteWindowID(), Gadget, Type);
02361 }                                                     
02362 
02363 /********************************************************************************************
02364 
02365 >   void SetEditGadgetType(CGadgetID Gadget, UINT32 IDSValidChar) 
02366 
02367     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02368     Created:    24/8/93
02369     Inputs:     -
02370     Outputs:    -
02371     Returns:    -
02372     Purpose:    See DialogManager for a description of this function
02373     Errors:     -
02374     SeeAlso:    DialogManager::SetEditGadgetType
02375 
02376 ********************************************************************************************/
02377 
02378 void DialogOp::SetEditGadgetType(CGadgetID Gadget, UINT32 IDSValidChar) 
02379 {                                                          
02380     DlgMgr->SetEditGadgetType(GetReadWriteWindowID(), Gadget, IDSValidChar); 
02381 }  
02382 
02383 /********************************************************************************************
02384 
02385 >   void DialogOp::DualFunctionButton(CGadgetID ButtonGadget)
02386 
02387     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02388     Created:    7/9/93
02389     Inputs:     - 
02390     Outputs:    -
02391     Returns:    -
02392     Purpose:    See DialogManager for a description of this function
02393     Errors:     -
02394     SeeAlso:    DialogManager::DualFunctionButton
02395 
02396 ********************************************************************************************/
02397 
02398 void DialogOp::DualFunctionButton(CGadgetID ButtonGadget)
02399 {
02400     DlgMgr->DualFunctionButton(GetReadWriteWindowID(), ButtonGadget); 
02401 }    
02402 
02403 /********************************************************************************************
02404 
02405 >   BOOL DialogOp::MakeListBoxDragable(CGadgetID ListGadget)
02406 
02407     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02408     Created:    16/12/93
02409     Inputs:     -
02410     Outputs:    -
02411     Returns:    -
02412     Purpose:    See DialogManager for a description of this function
02413     Errors:     -
02414     SeeAlso:    DialogManager::MakeListBoxDragable
02415 
02416 ********************************************************************************************/
02417 
02418 
02419 BOOL DialogOp::MakeListBoxDragable(CGadgetID ListGadget)
02420 {
02421     return (DlgMgr->MakeListBoxDragable(GetReadWriteWindowID(), ListGadget)); 
02422 }
02423 
02424 
02425 
02426 /********************************************************************************************
02427 
02428 >   virtual MsgResult DialogOp::Message( Msg* Message )
02429     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02430     Created:    13/8/93
02431     Inputs:     Message: The message
02432     Outputs:    -
02433     Returns:    -
02434     Purpose:    The Message function for a DialogOp should look something like this 
02435 
02436                 if (IS_OUR_DIALOG_MSG(Message))
02437                 {
02438                     DialogMsg* Msg = (DialogMsg*)Message; 
02439                     // Handle Msg here
02440                 }
02441                 
02442                 // Pass message on to base class for rest of handling.
02443                 return <BaseClass>::Message(Message);
02444 
02445                 This Pure virtual function will ENSURE 
02446 
02447 
02448     Errors:     -
02449     SeeAlso:    MessageHandler
02450     SeeAlso:    IS_OUR_DIALOG_MSG
02451 
02452 ********************************************************************************************/
02453 
02454 MsgResult DialogOp::Message( Msg* Message )       
02455 {
02456     CheckMagic("DialogOp::Message");;
02457 
02458     if (MESSAGE_IS_A(Message, DocChangingMsg))
02459     {
02460         // Get a pointer the correct type of message.
02461         DocChangingMsg *pDocMsg = (DocChangingMsg *) Message;
02462 
02463         if ( static_cast<OpMsg*> ( Message )->MsgType  == (OpMsg::OpMsgType)DocViewMsg::SELCHANGED )
02464         {
02465             // Selected document has changed:
02466 
02467             // Make sure we were actually up to date before..
02468             if (pDocMsg->pOldDoc)
02469             {
02470                 ERROR3IF(pOurDoc != pDocMsg->pOldDoc,
02471                          "pOurDoc ptr is out of date in DialogOp::Message()");
02472             }
02473 
02474             // Update our document pointer (might be NULL).
02475             pOurDoc = pDocMsg->pNewDoc;
02476         }
02477     }
02478     else if (MESSAGE_IS_A(Message, DocViewMsg))
02479     {
02480         // Get a pointer the correct type of message.
02481         DocViewMsg *pDocViewMsg = (DocViewMsg *) Message;
02482 
02483         if ( static_cast<OpMsg*> ( Message )->MsgType  == (OpMsg::OpMsgType)DocViewMsg::SELCHANGED )
02484         {
02485             // Selected document has changed:
02486             // Make sure we were actually up to date before..
02487             ERROR3IF(pOurView != (View *) pDocViewMsg->pOldDocView,
02488                      "pOurView ptr is out of date in DialogOp::Message()");
02489 
02490             // Update our view pointer.
02491             pOurView = (View *) pDocViewMsg->pNewDocView;
02492         }
02493     }
02494     else if (IS_OUR_DIALOG_MSG(Message))
02495     {
02496         // We have an unhandled dialog message.  If it is for a button with the appropriate
02497         // "help" resource/gadget ID then run some help for this dialog.
02498         DialogMsg* pDlgMsg = (DialogMsg*) Message;
02499 
02500         // Messages for individial controls with OpDescriptors need to be sent to that control
02501         if (pDlgMsg->GadgetID)
02502         {
02503             OpDescriptor *OpDesc = GetGadgetOpDescriptor(pDlgMsg->GadgetID);
02504             if (OpDesc)
02505             {
02506                 // These tend to change bar state
02507                 ControlList::Get()->Changed();
02508                 // Its a message for the current OpDescriptor
02509                 // Convert the dialog message into a OpDescriptor control message
02510                 BROADCAST_TO_CLASS(
02511                     OpDescControlMsg(OpDesc, 
02512                                         pDlgMsg->DlgMsg, 
02513                                         OpDesc->GetBarControlInfo()->ControlID,
02514                                         OpDesc->GetBarControlInfo()->ResourceID,
02515                                         this), OpDescriptor);
02516             }
02517         }
02518 
02519         switch (pDlgMsg->DlgMsg)
02520         {
02521             case DIM_LFT_BN_CLICKED:
02522 
02523             case DIM_RGT_BN_CLICKED:
02524                 // If they clicked on a "help" button then invoke the help system for this dialog.
02525                 if (pDlgMsg->GadgetID == _R(ID_CC_HELP_BUTTON))
02526                 {
02527                     // Invoke the help system and mark this message as completely processed.  If we
02528                     // don't and instead fall through to the base-class handler, the base class might
02529                     // conceivably fail the message (as it doesn't know anything about it).
02530                     HelpUser(*this);
02531                     return DLG_EAT_IF_HUNGRY(pDlgMsg);
02532                 }
02533                 break;
02534             
02535             case DIM_TITLEFOCUSWARN:
02536                 {
02537                     // this indicates that the dialog has been moved, we need to send a message saying that the
02538                     // screen has changed
02539                     BROADCAST_TO_ALL(ScreenChangeMsg());
02540                 }
02541                 break;
02542 
02543             case DIM_DLG_MOVED:
02544                 {
02545                     BROADCAST_TO_ALL(ScreenChangeMsg());
02546                 }
02547                 break;
02548 
02549             case DIM_COMMIT:
02550             case DIM_CANCEL:
02551             case DIM_CREATE:
02552             case DIM_BAR_DEATH:
02553                 {
02554                     // These messages need to be propagated to all controls
02555                     BOOL Destroy = ControlList::Get()->SendMessageToAllControls(this, pDlgMsg); 
02556 
02557                     // These messages need to be broadcast to all controls within the dialog
02558                     // temporarily ALWAYS destroy if we get as far as here on a DIM_CANCEL
02559                     if ((pDlgMsg->DlgMsg==DIM_CANCEL) || (pDlgMsg->DlgMsg==DIM_COMMIT) ||Destroy )
02560                     {
02561                         Close();
02562                         End();
02563                         // the Op has now been deleted. Exit fast!
02564                         return OK;
02565                         //DlgMgr->Delete(WindowID, this);
02566                         //WindowID = NULL;
02567                     }
02568                     break;
02569                 }
02570 
02571             default:
02572                 break;
02573         }
02574 
02575         // Pass to the base class for possibly more handling.  If there isn't any then we
02576         // eat the message, as we know it's for this dialogue.
02577         MsgResult msgrslt = Operation::Message(Message);
02578         return (msgrslt == OK) ? DLG_EAT_IF_HUNGRY(pDlgMsg) : msgrslt;
02579     } 
02580 
02581     // Not interested or possibly more to do - pass to base class.
02582     return Operation::Message(Message);
02583 }      
02584 
02585 
02586 /********************************************************************************************
02587 
02588 >   static BOOL DialogOp::IsADialogWindow(CWindowID WndID)
02589 
02590     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02591     Created:    17/3/94
02592     Inputs:     WndID:  The CWindowID to try and find
02593     Outputs:    -
02594     Returns:    TRUE if WndID is the window id of a dialog
02595     Purpose:    To find out if WndID is the window ID of a dialog 
02596     Errors:     -
02597     SeeAlso:    -
02598 
02599 ********************************************************************************************/
02600 
02601 
02602 BOOL DialogOp::IsADialogWindow(CWindowID WndID)
02603 {
02604     // Traverse the dialog list to see if WndID is a dialog window
02605     
02606     // Obtain the first live dialogOp 
02607     List* DlgList = GetClassList(CC_RUNTIME_CLASS(DialogOp)); 
02608     ListItem* CurrentOp = DlgList->GetHead(); 
02609     
02610 
02611     while (CurrentOp != NULL)    
02612     {        
02613                 
02614         if (((DialogOp*)CurrentOp)->WindowID == WndID)    
02615                                                               
02616         {   
02617             return TRUE;
02618         }       
02619         CurrentOp = DlgList->GetNext(CurrentOp); // Get next operation in the live list
02620     }        
02621     return FALSE; 
02622 }
02623 
02624 /********************************************************************************************
02625 
02626 >   BOOL DialogOp::SetTitlebarName(String_256* Name)
02627 
02628     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02629     Created:    1/12/94
02630     Inputs:     The title bar name
02631     Outputs:    -
02632     Returns:    FALSE if the function fails, otherwise TRUE
02633     Purpose:    Sets the titlebar text
02634     Errors:     -
02635     SeeAlso:    -
02636 
02637 ********************************************************************************************/
02638 
02639 BOOL DialogOp::SetTitlebarName(String_256* Name)
02640 {                                                                
02641     return(DlgMgr->SetTitlebarName(GetReadWriteWindowID(), Name)); 
02642 }
02643 
02644 /********************************************************************************************
02645 
02646 >   RenderRegion* DialogOp::CreateGRenderRegion(DocRect* pRequiredSize,
02647                                                 ReDrawInfoType* ExtraInfo,
02648                                                 BOOL UseSelViewColContext = FALSE)
02649 
02650     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
02651     Created:    17/10/94
02652     Inputs:     pRequiredSize - The size that you want the effective area of the window to
02653                 be. Measured in Millipoints. eg. If you want your control to appear to be
02654                 1 inch square (whatever the actual size of it is), pass in a DocRect that
02655                 looks a bit like this ... DocRect(0,0,72000,72000)
02656                 ExtraInfo - The info about the region, as supplied by the dialog manager
02657     Returns:    Render Region. This returns a pointer to a render region, or NULL if it
02658                 failed to create one.
02659     Purpose:    Simplifies the creation of a render region as used in a dialog box. It
02660                 will create a render region, scaled to the correct size etc and deal with
02661                 all the Creation, initialisation etc of the region. StartRender is also
02662                 called, so if this function does not return NULL you are able to start
02663                 drawing into it. You MUST call DestroyGRenderRegion when you have draw
02664                 everything that you need to as this calls StopRender (which does the blit
02665                 to the screen) as well as deleting the render region for you
02666 
02667     Notes:      Use GRenderRegions when you want fast redraw, grad fills, and transparency.
02668                 If only simple rendering is required, think about perhaps using an
02669                 OSRenderRegion instead.
02670 
02671     SeeAlso:    DialogOp::DestroyGRenderRegion
02672     SeeAlso:    DialogOp::CreateOSRenderRegion
02673 
02674 ********************************************************************************************/
02675 
02676 RenderRegion* DialogOp::CreateGRenderRegion(DocRect* pRequiredSize, ReDrawInfoType* ExtraInfo,
02677                                                 BOOL UseSelViewColContext)
02678 {
02679     // Make a new dialog view
02680     DialogView *pDialogView = new DialogView;
02681     if (pDialogView == NULL)
02682         // Error - return failure.
02683         return NULL;
02684 
02685     // Initialise the DialogView
02686     if (!pDialogView->Init())
02687     {
02688         // Error - return failure.
02689         delete pDialogView;
02690         return NULL;
02691     }
02692 
02693     // Pixelise the rectangle
02694     pRequiredSize->lo.Pixelise(pDialogView);
02695     pRequiredSize->hi.Pixelise(pDialogView);
02696     DocRect ClipRect = *pRequiredSize;
02697 
02698     // Get some default params for the render region
02699     FIXED16 Scale(1);
02700 
02701     // Ok, go and scale things
02702     INT32 ReqDx = ClipRect.Width();
02703     INT32 ReqDy = ClipRect.Height();
02704 
02705     // Work out the scale factors
02706     FIXED16 XScale = FIXED16(double(ExtraInfo->dx) / double(ReqDx));
02707     FIXED16 YScale = FIXED16(double(ExtraInfo->dy) / double(ReqDy));
02708 
02709     // Build the matricies
02710     // One to shift everything to the correct side of the X axis
02711     Matrix Translate(0, -ExtraInfo->dy);
02712 
02713     // One to scale everything into the window
02714     Matrix ScaleIt(XScale, YScale);
02715 
02716     // One to translate everything to the origin
02717     Matrix ToOrigin(-ClipRect.lo.x, -ClipRect.lo.y);
02718 
02719     // Combine them all
02720     ToOrigin *= ScaleIt;
02721     ToOrigin *= Translate;
02722 
02723     // If the caller wants to use the same colour separation options (ColourPlate) as the
02724     // currently selected view, then copy the ColourPlate across to the new DialogView
02725     if (UseSelViewColContext && DocView::GetSelected() != NULL)
02726         pDialogView->SetColourPlate(DocView::GetSelected()->GetColourPlate());
02727 
02728     // make a render region
02729     GRenderRegion* pRender = new GRenderDIB(ClipRect, ToOrigin, Scale, 32, (double)ExtraInfo->Dpi);
02730     if (pRender!=NULL)
02731     {
02732         // Try and create the bitmap etc
02733         if (pRender->AttachDevice(pDialogView, ExtraInfo->pDC->GetDC(), NULL))
02734         {
02735             // Try and start the render region
02736             if (pRender->StartRender())
02737             {
02738                 return pRender;
02739             }
02740         }
02741 
02742         // Failed to attach and start the render region so free up the region
02743         delete pRender;
02744     }
02745 
02746     // Something went wrong, fail
02747     delete pDialogView;
02748     return NULL;
02749 }
02750 
02751 
02752 
02753 
02754 /********************************************************************************************
02755 
02756 >   BOOL DialogOp::DestroyGRenderRegion()
02757 
02758     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
02759     Created:    17/10/94
02760     Inputs:     A pointer to a render region return by CreateGRenderRegion
02761     Returns:    TRUE if it worked, FALSE if the render region passed in was bad
02762     Purpose:    Deinitialises the render region and deletes it.
02763     Errors:     ERROR2 error if pRender is NULL
02764     SeeAlso:    DialogOp::CreateGRenderRegion
02765 
02766 ********************************************************************************************/
02767 
02768 BOOL DialogOp::DestroyGRenderRegion(RenderRegion* pRender)
02769 {
02770     // Test for preconditions
02771     ERROR2IF(pRender==NULL, FALSE, "DestroyGRenderRegion was passed a NULL render region");
02772 
02773     // Blit to the screen
02774     pRender->StopRender();
02775 
02776     // and delete the render region and its (dialog) view
02777     // these are deleted in this order because the RenderRegion destructor may
02778     // call functions on its RenderView
02779     View* pView = pRender->GetRenderView();
02780     delete pRender;
02781     delete pView;
02782 
02783     // It worked
02784     return TRUE;
02785 }
02786 
02787 
02788 /********************************************************************************************
02789 
02790 >   RenderRegion* DialogOp::CreateOSRenderRegion(DocRect* pRequiredSize,
02791                                                  ReDrawInfoType* ExtraInfo,
02792                                                  BOOL UseSelViewColContext = FALSE)
02793 
02794     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com> (Jason copied CreateGRenderRegion)
02795     Created:    17/10/94 (11/1/95)
02796     
02797     Inputs:     pRequiredSize - The size that you want the effective area of the window to
02798                 be. Measured in Millipoints. eg. If you want your control to appear to be
02799                 1 inch square (whatever the actual size of it is), pass in a DocRect that
02800                 looks a bit like this ... DocRect(0,0,72000,72000)
02801                 ExtraInfo - The info about the region, as supplied by the dialog manager
02802     Returns:    Render Region. This returns a pointer to a render region, or NULL if it
02803                 failed to create one.
02804 
02805     Purpose:    Simplifies the creation of a render region as used in a dialog box. It
02806                 will create a render region, scaled to the correct size etc and deal with
02807                 all the Creation, initialisation etc of the region. StartRender is also
02808                 called, so if this function does not return NULL you are able to start
02809                 drawing into it. You MUST call DestroyOSRenderRegion when you have draw
02810                 everything that you need to as this calls StopRender (which does the blit
02811                 to the screen) as well as deleting the render region for you
02812 
02813     Notes:      Use GRenderRegions when you want fast redraw, grad fills, and transparency.
02814                 If only simple rendering is required, think about perhaps using an
02815                 OSRenderRegion instead.
02816 
02817     SeeAlso:    DialogOp::DestroyOSRenderRegion
02818     SeeAlso:    DialogOp::CreateGRenderRegion
02819 
02820 ********************************************************************************************/
02821 
02822 RenderRegion* DialogOp::CreateOSRenderRegion(DocRect* pRequiredSize, ReDrawInfoType* ExtraInfo,
02823                                                 BOOL UseSelViewColContext)
02824 {
02825     // Make a new dialog view
02826     DialogView *pDialogView = new DialogView;
02827     if (pDialogView == NULL)
02828         // Error - return failure.
02829         return NULL;
02830 
02831     // Initialise the DialogView
02832     if (!pDialogView->Init())
02833     {
02834         // Error - return failure.
02835         delete pDialogView;
02836         return NULL;
02837     }
02838 
02839     // Pixelise the rectangle
02840     pRequiredSize->lo.Pixelise(pDialogView);
02841     pRequiredSize->hi.Pixelise(pDialogView);
02842     DocRect ClipRect = *pRequiredSize;
02843 
02844     // Get some default params for the render region
02845     FIXED16 Scale(1);
02846 
02847     // Ok, go and scale things
02848     INT32 ReqDx = ClipRect.Width();
02849     INT32 ReqDy = ClipRect.Height();
02850 
02851     // Work out the scale factors
02852     FIXED16 XScale = FIXED16(double(ExtraInfo->dx) / double(ReqDx));
02853     FIXED16 YScale = FIXED16(double(ExtraInfo->dy) / double(ReqDy));
02854 
02855     // Build the matricies
02856     // One to shift everything to the correct side of the X axis
02857     Matrix Translate(0, -ExtraInfo->dy);
02858 
02859     // One to scale everything into the window
02860     Matrix ScaleIt(XScale, YScale);
02861 
02862     // One to translate everything to the origin
02863     Matrix ToOrigin(-ClipRect.lo.x, -ClipRect.lo.y);
02864 
02865     // Combine them all
02866     ToOrigin *= ScaleIt;
02867     ToOrigin *= Translate;
02868 
02869     // If the caller wants to use the same colour separation options (ColourPlate) as the
02870     // currently selected view, then copy the ColourPlate across to the new DialogView
02871     if (UseSelViewColContext && DocView::GetSelected() != NULL)
02872         pDialogView->SetColourPlate(DocView::GetSelected()->GetColourPlate());
02873 
02874     // Make a render region for the screen, asking specifically for an OSRenderRegion,
02875     // and none of this sneaky & cunning diverting it back into being a GRenderRegion!
02876     RenderRegion* pRender = OSRenderRegion::Create(ClipRect, ToOrigin, Scale,
02877                                                     RENDERTYPE_SCREEN, NULL, TRUE);
02878 
02879     if (pRender!=NULL)
02880     {
02881         // Try and create the bitmap etc
02882         if (pRender->AttachDevice(pDialogView, ExtraInfo->pDC, NULL))
02883         {
02884             // Try and start the render region
02885             if (pRender->StartRender())
02886             {
02887                 return pRender;
02888             }
02889         }
02890 
02891         // Failed to attach and start the render region so free up the region
02892         delete pRender;
02893     }
02894 
02895     // Something went wrong, fail
02896     delete pDialogView;
02897     return NULL;
02898 }
02899 
02900 
02901 
02902 
02903 /********************************************************************************************
02904 
02905 >   BOOL DialogOp::DestroyOSRenderRegion(RenderRegion* pRender)
02906 
02907     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com> (Jason copied CreateGRenderRegion)
02908     Created:    17/10/94 (11/1/95)
02909 
02910     Inputs:     A pointer to a render region return by CreateOSRenderRegion
02911     Returns:    TRUE if it worked, FALSE if the render region passed in was bad
02912 
02913     Purpose:    Deinitialises the render region and deletes it.
02914 
02915     Errors:     ERROR2 error if pRender is NULL
02916 
02917     SeeAlso:    DialogOp::CreateGRenderRegion
02918     SeeAlso:    DialogOp::CreateOSRenderRegion
02919 
02920 ********************************************************************************************/
02921 
02922 BOOL DialogOp::DestroyOSRenderRegion(RenderRegion* pRender)
02923 {
02924     // Test for preconditions
02925     ERROR2IF(pRender==NULL, FALSE, "DestroyOSRenderRegion was passed a NULL render region");
02926 
02927     // Blit to the screen
02928     pRender->StopRender();
02929 
02930     // and delete the render region and its (dialog) view
02931     // these are deleted in this order because the RenderRegion destructor may
02932     // call functions on its RenderView
02933     View* pView = pRender->GetRenderView();
02934     delete pRender;
02935     delete pView;
02936 
02937     // It worked
02938     return TRUE;
02939 }
02940 
02941 
02942 /********************************************************************************************
02943 
02944 >   CWindowID DialogOp::GetReadWriteWindowID()
02945 
02946 
02947     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
02948     Created:    29/11/94
02949     Inputs:     -
02950     Outputs:    -
02951     Returns:    the WindowID of the window that we are currently reading or writing
02952                 to. NULL if the window does not exist.
02953 
02954     Purpose:    For a non tabbed dialog this function simply returns the DialogOp's WindowID.
02955                 For a tabbed dialog the WindowID of the dialog page specified by the last call
02956                 to TalkToPage is returned.
02957     Errors:     -
02958     Scope:      protected
02959     SeeAlso:    DialogTabOp::TalkToPage
02960 
02961 ********************************************************************************************/
02962 
02963 
02964 CWindowID DialogOp::GetReadWriteWindowID()
02965 {
02966     CheckMagic("DialogOp::GetReadWriteWindowID");
02967     return (DlgMgr->GetPageWindow(WindowID, ReadWritePage));        
02968 }
02969 
02970 /********************************************************************************************
02971 
02972 >   CDlgResID DialogOp::GetCurrentPageID()
02973 
02974 
02975     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
02976     Created:    15/12/94
02977     Inputs:     -
02978     Outputs:    -
02979     Returns:    the PageID of the tab currently being used. NULL if its the main page.
02980 
02981     Purpose:    For a non tabbed dialog this function simply returns NULL.
02982                 For a tabbed dialog it returns the PageID of the dialog page specified by
02983                 the last call to TalkToPage.
02984     Errors:     -
02985     Scope:      public
02986     SeeAlso:    DialogTabOp::TalkToPage; DialogOp::GetReadWriteWindowID();
02987 
02988 ********************************************************************************************/
02989 
02990 CDlgResID DialogOp::GetCurrentPageID()
02991 {
02992     // Just return the current id of the tab page in use.
02993     return ReadWritePage;
02994 }
02995 
02996 /********************************************************************************************
02997 
02998 >   static DialogOp* DialogOp::FindDialogOp(CDlgResID ResID)
02999 
03000     Author:     Alex Bligh <alex@alex.org.uk>
03001     Created:    17/4/2006
03002     Inputs:     ResID - The resource ID of the dialog to find
03003     Outputs:    -
03004     Returns:    ptr to DialogOp
03005                 NULL is returned if not found
03006     Purpose:    Looks for a given DialogOp by using its ResourceID
03007     Errors:     -
03008     SeeAlso:    -
03009 
03010 ********************************************************************************************/
03011 
03012 DialogOp* DialogOp::FindDialogOp(CDlgResID ResID)
03013 {
03014     List*       pList = MessageHandler::GetClassList(CC_RUNTIME_CLASS(DialogOp));
03015     DialogOp*   pDialogOp = (DialogOp*)pList->GetHead();
03016     
03017     while (pDialogOp != NULL)
03018     {
03019         if (pDialogOp->DlgResID == ResID)
03020             return (pDialogOp);
03021 
03022         pDialogOp = (DialogOp*)pList->GetNext(pDialogOp);
03023     }
03024 
03025     return NULL;
03026 }
03027 
03028 /********************************************************************************************
03029 
03030 >   BOOL DialogOp::IsVisible()
03031 
03032     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03033     Created:    29/4/94
03034     Inputs:     -
03035     Outputs:    -
03036     Returns:    TRUE if this DialogOp is on screen
03037     Purpose:    Used by the tool bar customize system to find out if a tool bar is
03038                 visible or not. 
03039     Errors:     -
03040     SeeAlso:    -
03041 
03042 This function is a hangover from old bar days. You probably don't want to use it.
03043 Use Show() etc. which are orthogonal to this. This merely tells you whether there
03044 is a window ID there... FOR COMPATIBILITY ONLY
03045 
03046 ********************************************************************************************/
03047 
03048 BOOL DialogOp::IsVisible()
03049 {
03050     return (WindowID != NULL);
03051 }
03052 
03053 /********************************************************************************************
03054 
03055 >   virtual void DialogOp::SetVisibility(BOOL Visible)
03056 
03057     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
03058     Created:    29/4/94
03059     Inputs:     Open -  if TRUE then open DialogOp in its last pos if it is
03060                         currently closed.
03061                         if FALSE, it is closed
03062     Outputs:    -
03063     Returns:    -
03064     Purpose:    Used by the tool bar customize system to open and close a tool bar.
03065     Errors:     -
03066     SeeAlso:    -
03067 
03068 ********************************************************************************************/
03069 
03070 void DialogOp::SetVisibility(BOOL Visible)
03071 {
03072     if (Visible)
03073     {
03074         if (!WindowID)
03075         {
03076             Create();
03077         }
03078         Open();
03079     }
03080     else
03081     {
03082         Close();
03083     }
03084 }
03085 
03086 
03087 // -----------------------------------------------------------------------------------------
03088 // DialogTabOp functions 
03089  
03090 /********************************************************************************************
03091 >           DialogTabOp(CDlgResID DialogResID, CDlgMode Mode
03092                         CCRuntimeClass* Class = CC_RUNTIME_CLASS(DialogOp));
03093 
03094 
03095     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03096     Created:    13/8/93
03097                 DummyDialogResID:   An ID which is unique to this dialog. Even though 
03098                                     a Dialog resource is not specified for the tab dialog
03099                                     itself (only it's pages) we need to uniquly identify it.
03100                                     (so we can record it's position, etc.)  
03101                 Mode:               The dialog's mode (modal, medeless)
03102     Purpose:    The Constructor of the DialogTabOp class simply sets the resource ID of the 
03103                 dialog and its modality.
03104 
03105 ********************************************************************************************/
03106 
03107 
03108 
03109 // distinguish a tab dialog message from a message for any other type of dialog
03110 DialogTabOp::DialogTabOp(CDlgResID DummyDialogResID,  
03111                          CDlgMode Mode,
03112                          CCRuntimeClass* Class,
03113                          INT32 OpeningPage):DialogOp(DummyDialogResID, Mode, 0, /*NULL, NULL,*/
03114                                                    Class, OpeningPage)
03115 {
03116     // The base class does most of the work as you can see
03117 };
03118 
03119 /********************************************************************************************
03120 
03121 >   BOOL DialogTabOp::AddAPage(CDlgResID DialogResID, CGadgetID Gadget=0)
03122 
03123     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03124     Created:    16/11/94
03125     Inputs:     DialogResID: Dialog resource ID of the page you want to add to the Tabbed 
03126                              dialog. 
03127                 GadgetID:    The gadget ID of the book control to add it to, or zero
03128                              for the default one (either specified using GetDefaultBookGadget
03129                              or just the first one it finds). You only need specify this if
03130                              the dialog contains multiple book controls (if there are
03131                              multiple book controls and only one is kernel managed, the
03132                              best thing to do is to override GetDefaultBookGadget)
03133     Outputs:    -
03134     Returns:    -
03135     Purpose:    This function adds a dialog page to the tabbed dialog. 
03136     
03137                 Note: 
03138                 
03139                 This function can be called many times before the dialog is made 
03140                 visible. For a modal dialog this function should be called in response to a 
03141                 dialog DIM_CREATE message.
03142 
03143                 To keep things simple all Dialog pages should be the same size please.
03144 
03145     Errors:     -
03146     SeeAlso:    -
03147 
03148 ********************************************************************************************/
03149 
03150 BOOL DialogTabOp::AddAPage(CDlgResID DialogResID, CGadgetID Gadget/*=0*/)
03151 {     
03152     // Ask the Dialog Manager to add the page 
03153     return (DlgMgr->AddAPage(this, DialogResID, Gadget)); 
03154 }; 
03155 
03156 /********************************************************************************************
03157 
03158 >   virtual BOOL DialogTabOp::RegisterYourPagesInOrderPlease()
03159 
03160 
03161     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03162     Created:    21/11/94
03163     Inputs:     -
03164     Outputs:    -
03165     Returns:    return TRUE if all calls to AddAPage returned TRUE
03166     Purpose:    This virtual function will get called to give you a chance to add pages to your
03167                 DialogTabOp. This function will usually make multiple calls to AddAPage to 
03168                 register the initial set of pages to be contained in the tab dialog. The pages
03169                 should all be the same size and be registered in the left to right order in which
03170                 you wish them to appear. 
03171 
03172                 This function get's called directly from the Create method, Don't call it 
03173                 explicitly yourself. If you return FALSE from this method then the Create 
03174                 method will fail. 
03175 
03176     Errors:     -
03177     SeeAlso:    DialogTabOp::AddPage
03178     SeeAlso:    DialogOp::Create
03179 
03180 ********************************************************************************************/
03181 
03182 BOOL DialogTabOp::RegisterYourPagesInOrderPlease()
03183 {
03184     ERROR2(FALSE, "The DialogTabOp has not had any pages added during creation"); 
03185 } 
03186 
03187 
03188 /********************************************************************************************
03189 
03190 >   void DialogTabOp::SetName(String_256* pName) 
03191 
03192     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03193     Created:    23/11/94
03194     Inputs:     pName: The Dialogs name
03195     Outputs:    -
03196     Returns:    -
03197     Purpose:    This function should be called BEFORE calling create. It sets the title bar
03198                 name of the dialog
03199     Errors:     -
03200     SeeAlso:    -
03201 
03202 ********************************************************************************************/
03203 
03204 void DialogTabOp::SetName(String_256* pName)
03205 {
03206     MyName = *pName; 
03207     return; // done
03208 } 
03209 
03210 
03211 /********************************************************************************************
03212 
03213 >   String_256 DialogTabOp::GetName(void) 
03214 
03215     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03216     Created:    23/11/94
03217     Inputs:     -
03218     Outputs:    -
03219     Returns:    The dialog's name
03220     Purpose:    Returns the name of the dialog
03221     Errors:     -
03222     SeeAlso:    -
03223 
03224 ********************************************************************************************/
03225 
03226 String_256* DialogTabOp::GetName(void)
03227 {
03228     return &MyName;
03229 } 
03230 
03231 
03232 
03233 /********************************************************************************************
03234 
03235 >   void DialogTabOp::SetPropertyPageModified(BOOL Modified)
03236 
03237 
03238     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
03239     Created:    23/3/2000
03240     Inputs:     the modified value to set
03241     Returns:    -
03242     Purpose:    Sets the modified property of the currently active property page of the current 
03243                 tabbed dialog (if it exists)
03244 
03245 ********************************************************************************************/
03246 
03247 void DialogTabOp::SetPropertyPageModified(BOOL Modified)
03248 {
03249     if (DlgMgr != NULL)
03250         DlgMgr->SetPropertyPageModified(Modified);
03251     else
03252         ERROR3("Dialog Manager is NULL in DialogTabOp::SetPropertyPageModified");
03253 }
03254 
03255 /********************************************************************************************
03256 
03257 >   DialogTabOp::~DialogTabOp()           
03258 
03259     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03260     Created:    16/11/94
03261     Inputs:     -
03262     Outputs:    -
03263     Returns:    -
03264     Purpose:    The DialogTabOp destructor destroys the instance of the DialogTabOp and all  
03265                 associated resources. If the dialog was open then it is closed. 
03266 
03267     Errors:     -
03268     SeeAlso:    -
03269 
03270 ********************************************************************************************/
03271 
03272 DialogTabOp::~DialogTabOp()
03273 {
03274     // We must do this before we become a DialogOp (due changes to vtable as
03275     // destructors are called)
03276     if (WindowID != NULL)
03277     {
03278         DlgMgr->Delete(WindowID, this);
03279         WindowID = NULL;
03280     }
03281 
03282     //  Let's get the base class destructor to do all the work shall we
03283 
03284 };         
03285 
03286 
03287 
03288 /********************************************************************************************
03289 
03290 >   BOOL DialogTabOp::TalkToPage(CDlgResID PageID)
03291 
03292 
03293     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03294     Created:    29/11/94
03295     Inputs:     PageID: Resource ID of the page you wish to communicate with
03296     Outputs:    -
03297     Returns:    FALSE if the page has not yet been created. 
03298                 This function is guaranteed to return TRUE if it is called in responce to
03299                 a message from the page.  
03300 
03301     Purpose:    Set's the Page that you wish to communicate with. Initially this page
03302                 is set to NULL which means that all communication will be directed at the
03303                 tabbed dialog itself. After this call all subsequent Get and Set functions will 
03304                 be directed at the specified page within the dialog.
03305                 
03306                 eg. To set the string value of a gadget _R(IDC_BUTTON1) on page _R(IDD_PAGE1)
03307                 
03308                 TalkToPage(_R(IDD_PAGE1));
03309                 SetStringGadgetValue(_R(IDC_BUTTON1), 
03310                                      &Wibble);  
03311     Errors:     -
03312     SeeAlso:    -
03313 
03314 ********************************************************************************************/
03315 
03316 BOOL DialogTabOp::TalkToPage(CDlgResID PageID)
03317 {
03318     ReadWritePage = PageID;
03319 
03320     // Determine if the page we are trying to talk to exists
03321     return (GetReadWriteWindowID() != NULL);
03322 }
03323 
03324 /********************************************************************************************
03325 
03326 >   virtual MsgResult DialogOp::Message( Msg* Message )
03327     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
03328     Created:    25/01/96
03329     Inputs:     Message: The message to be processed
03330     Purpose:    Performs message handling specific to DialogTabOps
03331 
03332 ********************************************************************************************/
03333 
03334 MsgResult DialogTabOp::Message( Msg* Message )       
03335 {
03336     if (IS_OUR_DIALOG_MSG(Message))
03337     {
03338         DialogMsg* pDlgMsg = (DialogMsg*) Message;
03339         if (pDlgMsg->PageID == 0)
03340         {
03341             // It's a message from the Property sheet itself
03342             if (pDlgMsg->GadgetID == _R(ID_HELP))
03343             {
03344                 // Map to our standard help ID. This is no longer equal to _R(ID_HELP)
03345                pDlgMsg->GadgetID = _R(ID_CC_HELP_BUTTON);
03346             }
03347         }
03348     } 
03349     return DialogOp::Message(Message); // Let the base class do the rest
03350 }
03351 
03352 
03353 // Never ever call this it exists cos DYNCREATE demands it. DYNCREATE has no concept 
03354 // of an abstract class. 
03355 DialogTabOp::DialogTabOp()
03356 {                                   
03357     ENSURE(FALSE, "Invalid constructor called for DialogTabOp"); 
03358 }
03359   
03360 /********************************************************************************************
03361 
03362 >   UINT32 DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse,
03363                             void (* lpfnTimer)(void *) = NULL,
03364                             void * param = NULL,
03365                             BOOL OneShot = FALSE)
03366 
03367     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03368     Created:    15/4/97
03369     Inputs:     nIDEvent    Specifies a nonzero timer identifier.
03370                 nElapse     Specifies the time-out value, in milliseconds.
03371                 param       An opaque parameter sent to the timer function (along with nIDEvent)
03372     Returns:    The timer identifier of the new timer if Nonzero, Zero means a problem.
03373     Purpose:    Allows the user access to setting a timer caller back or event for a dialog box.
03374                 The caller can either specify a call back procedure to be called when the timer
03375                 goes off or if null is specified, a DIM_TIMER message will be sent.
03376                 The return value is effectively the handle onto the timer system. It must be
03377                 passed to the KillTimer member function to kill the timer. A Nonzero value
03378                 indicates successful allocation of the timer; non-zero implies a problem.
03379 
03380     SeeAlso:    DialogOp::KillTimer; DialogManager::SetTimer;
03381 
03382 ********************************************************************************************/
03383 
03384 UINT32 DialogOp::SetTimer(UINT32 nIDEvent, UINT32 nElapse, void (* lpfnTimer)(void *)/* = NULL*/, void * param/*=NULL*/, BOOL OneShot /*=FALSE*/)
03385 {
03386     // Call the Dialog Manager
03387     return DialogManager::SetTimer( this, GetReadWriteWindowID(), nIDEvent, nElapse, lpfnTimer, param, OneShot );
03388 }
03389 
03390 /********************************************************************************************
03391 
03392 >   BOOL DialogOp::KillTimer( INT32 nIDEvent )
03393 
03394     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03395     Created:    15/4/97
03396     Inputs:     nIDEvent    Specifies a nonzero timer identifier.
03397     Returns:    True if the event was killed, FALSE if the specified timer event could not be found.
03398     Purpose:    Allows the user access to killing a timer caller back or event that has been
03399                 set up for a dialog box.
03400                 Kills the timer event identified by nIDEvent from the earlier call to SetTimer.
03401                 Any pending WM_TIMER messages associated with the timer are removed from the
03402                 message queue.
03403     SeeAlso:    DialogOp::SetTimer; DialogManager::SetTimer;
03404 
03405 ********************************************************************************************/
03406 
03407 BOOL DialogOp::KillTimer(INT32 nIDEvent)
03408 {
03409     // Call the Dialog Manager
03410     return DialogManager::KillTimer( this, GetReadWriteWindowID(), nIDEvent );
03411 }
03412 
03413 /********************************************************************************************
03414 
03415 >   BOOL DialogOp::GetWindowPosition(RECT * pRect)
03416 
03417     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03418     Created:    12/6/97
03419     Outputs:    Rect        pointer to the rectangle to fill in
03420     Returns:    True if the call was successful, FALSE otherwise.
03421     Purpose:    Allows the user to get the current window position.
03422     SeeAlso:    DialogOp::SetWindowPosition; DialogManager::GetWindowPosition;
03423 
03424 ********************************************************************************************/
03425 // Technical Note:
03426 // Don't even think of using GetWindowRect or GetClientRect as there are not set equivalents.
03427 // MoveWindow is completely spappy and does not use the same coordinates on client items!!!!
03428 // GetWindowPlacement at least has a SetWindowPlacement form which
03429 // uses the same coordinate system.
03430 
03431 BOOL DialogOp::GetWindowPosition( wxRect *pRect )
03432 {
03433     // Call the Dialog Manager
03434     return DialogManager::GetWindowPosition(GetReadWriteWindowID(), pRect);
03435 }
03436 
03437 BOOL DialogOp::GetWindowPosition( RECT *pRect )
03438 {
03439     // Call the Dialog Manager
03440     return DialogManager::GetWindowPosition(GetReadWriteWindowID(), pRect);
03441 }
03442 
03443 /********************************************************************************************
03444 
03445 >   BOOL DialogOp::GetGadgetPosition(CGadgetID Gadget, RECT * pRect)
03446 
03447     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03448     Created:    12/6/97
03449     Outputs:    Rect        pointer to the rectangle to fill in
03450     Returns:    True if the call was successful, FALSE otherwise.
03451     Purpose:    Allows the user to get the current position of the specified icon or control.
03452     SeeAlso:    DialogOp::SetGadgetPosition; DialogManager::GetGadgetPosition;
03453 
03454 ********************************************************************************************/
03455 
03456 BOOL DialogOp::GetGadgetPosition( CGadgetID Gadget, wxRect *pRect )
03457 {
03458     // Call the Dialog Manager
03459     return DialogManager::GetGadgetPosition(GetReadWriteWindowID(), Gadget, pRect);
03460 }
03461 
03462 BOOL DialogOp::GetGadgetPosition( CGadgetID Gadget, RECT *pRect )
03463 {
03464     // Call the Dialog Manager
03465     return DialogManager::GetGadgetPosition(GetReadWriteWindowID(), Gadget, pRect);
03466 }
03467 
03468 /********************************************************************************************
03469 
03470 >   BOOL DialogOp::SetWindowPosition(const RECT& Rect)
03471 
03472     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03473     Created:    12/6/97
03474     Inputs:     Rect        pointer to the rectangle to fill in
03475     Returns:    True if the call was successful, FALSE otherwise.
03476     Purpose:    Allows the user to set the current window position.
03477     SeeAlso:    DialogOp::SetWindowPosition; DialogManager::GetWindowPosition;
03478 
03479 ********************************************************************************************/
03480 
03481 BOOL DialogOp::SetWindowPosition( const wxRect &Rect )
03482 {
03483     // Call the Dialog Manager
03484     return DialogManager::SetWindowPosition(GetReadWriteWindowID(), Rect);
03485 }
03486 
03487 BOOL DialogOp::SetWindowPosition( const RECT &Rect )
03488 {
03489     // Call the Dialog Manager
03490     return DialogManager::SetWindowPosition(GetReadWriteWindowID(), Rect);
03491 }
03492 
03493 /********************************************************************************************
03494 
03495 >   BOOL DialogOp::SetGadgetPosition(CGadgetID Gadget, const RECT& Rect)
03496 
03497     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03498     Created:    12/6/97
03499     Inputs:     Rect        pointer to the rectangle to fill in
03500     Returns:    True if the call was successful, FALSE otherwise.
03501     Purpose:    Allows the user to set the current position of the specified icon or control.
03502     SeeAlso:    DialogOp::SetGadgetPosition; DialogManager::GetGadgetPosition;
03503 
03504 ********************************************************************************************/
03505 
03506 BOOL DialogOp::SetGadgetPosition( CGadgetID Gadget, const wxRect &Rect )
03507 {
03508     // Call the Dialog Manager
03509     return DialogManager::SetGadgetPosition(GetReadWriteWindowID(), Gadget, Rect);
03510 }
03511 
03512 BOOL DialogOp::SetGadgetPosition( CGadgetID Gadget, const RECT &Rect )
03513 {
03514     // Call the Dialog Manager
03515     return DialogManager::SetGadgetPosition(GetReadWriteWindowID(), Gadget, Rect);
03516 }
03517 
03518 /********************************************************************************************
03519 
03520 >   INT32 DialogOp::GetScreenDpi()
03521 
03522     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03523     Created:    12/6/97
03524     Returns:    0 or the dpi of the screen.
03525     Purpose:    Allows the user to find out the screen dpi.
03526     SeeAlso:    DialogManager::GetScreenDpi;
03527 
03528 ********************************************************************************************/
03529 
03530 INT32 DialogOp::GetScreenDpi()
03531 {
03532     return DialogManager::GetScreenDpi();
03533 }
03534 
03535 /********************************************************************************************
03536 
03537 >   BOOL DialogOp::GetScreenSize(INT32 * pWidth, INT32 * pHeight)
03538 
03539     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
03540     Created:    12/6/97
03541     Outputs:    pWidth  the screen width in pixels
03542                 pHeight the screen height in pixels
03543     Returns:    True if worked ok, False otherwise.
03544     Purpose:    Allows the user to find out the screen size.
03545     SeeAlso:    DialogManager::GetScreenSize;
03546 
03547 ********************************************************************************************/
03548 
03549 BOOL DialogOp::GetScreenSize(INT32 * pWidth, INT32 * pHeight)
03550 {
03551     ERROR2IF(pWidth == NULL || pHeight == NULL,FALSE,"GetScreenSize Bad params!");
03552     return DialogManager::GetScreenSize(pWidth, pHeight);
03553 }
03554 
03555 /*******************************************************************************************
03556 >   BOOL UpdateStringGadgetValue(CGadgetID Gadget, StringBase* NewString);  
03557     
03558     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
03559     Created:    14/09/94
03560     Inputs:     Dialog - pointer to the DialogOp containing the gadget.
03561                 Gadget - the gadget ID to update.
03562                 NewString - the new contents of the gadget.
03563     Returns:    TRUE if the dialogue was updated.
03564                 FALSE if it wasn't.
03565     Purpose:    Similar to SetStringGadgetValue but compares the contents of the gadget in
03566                 the dialogue before the update and dosen't bother if the new value is the
03567                 same as the current one.  This reduces dialogue flicker.
03568     See also:   DialogOp::SetStringGadgetValue
03569 
03570 
03571 *******************************************************************************************/
03572 BOOL DialogOp::UpdateStringGadgetValue(CGadgetID Gadget, StringBase* NewString)
03573 {
03574     String_256 OldString = GetStringGadgetValue(Gadget, NULL, -1);
03575 
03576     if (OldString != *NewString)
03577     {
03578         SetStringGadgetValue(Gadget, *NewString);
03579         return TRUE;
03580     }
03581     else
03582     {               
03583         return FALSE;
03584     }
03585 }
03586 
03587 
03588 /*******************************************************************************************
03589 >   BOOL UpdateStringGadgetValue(DialogOp* Dialog, UINT32 Gadget, StringBase* NewString);   
03590     
03591     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
03592     Created:    14/09/94
03593     Inputs:     Dialog - pointer to the DialogOp containing the gadget.
03594                 Gadget - the gadget ID to update.
03595                 NewString - the new contents of the gadget.
03596     Returns:    TRUE if the dialogue was updated.
03597                 FALSE if it wasn't.
03598     Purpose:    Similar to SetStringGadgetValue but compares the contents of the gadget in
03599                 the dialogue before the update and dosen't bother if the new value is the
03600                 same as the current one.  This reduces dialogue flicker.
03601     See also:   DialogOp::SetStringGadgetValue
03602 
03603 This is a complete bodge and should be made part of the DialogOp class - here for
03604 compatibility.
03605 
03606 *******************************************************************************************/
03607 BOOL UpdateStringGadgetValue(DialogOp* Dialog, UINT32 Gadget, StringBase* NewString)
03608 {
03609     return Dialog->UpdateStringGadgetValue(Gadget, NewString);
03610 }
03611 
03612 
03613 
03614 
03615 CTreeItemID DialogOp::SetTreeGadgetItem(CGadgetID Gadget, CTreeItemID hParent, const StringBase& str, CTreeItemID hInsAfter, INT32 iImage, CCObject* pObj)
03616 {
03617     return (DlgMgr->SetTreeGadgetItem(GetReadWriteWindowID(), Gadget, hParent, str, hInsAfter, iImage, pObj));
03618 }
03619 
03620 CCObject* DialogOp::GetTreeGadgetItemData(CGadgetID Gadget, CTreeItemID hItem)
03621 {
03622     return (DlgMgr->GetTreeGadgetItemData(GetReadWriteWindowID(), Gadget, hItem));
03623 }
03624 
03625 BOOL DialogOp::SelectTreeGadgetItem(CGadgetID Gadget, CTreeItemID hItem, BOOL bNewState)
03626 {
03627     return (DlgMgr->SelectTreeGadgetItem(GetReadWriteWindowID(), Gadget, hItem, bNewState));
03628 }
03629 
03630 CTreeItemID DialogOp::GetTreeGadgetRootItem(CGadgetID Gadget)
03631 {
03632     return (DlgMgr->GetTreeGadgetRootItem(GetReadWriteWindowID(), Gadget));
03633 }
03634 
03635 CTreeItemID DialogOp::GetTreeGadgetFirstSelectedItem(CGadgetID Gadget)
03636 {
03637     return (DlgMgr->GetTreeGadgetFirstSelectedItem(GetReadWriteWindowID(), Gadget));
03638 }
03639 
03640 BOOL DialogOp::TreeGadgetExpandItem(CGadgetID Gadget, CTreeItemID hItem)
03641 {
03642     return (DlgMgr->TreeGadgetExpandItem(GetReadWriteWindowID(), Gadget, hItem));
03643 }
03644 
03645 CTreeItemID DialogOp::GetTreeGadgetNextVisItem(CGadgetID Gadget, CTreeItemID hItem)
03646 {
03647     return (DlgMgr->GetTreeGadgetNextVisItem(GetReadWriteWindowID(), Gadget, hItem));
03648 }
03649 
03650 CTreeItemID DialogOp::GetTreeGadgetFirstChildItem(CGadgetID Gadget, CTreeItemID hItem)
03651 {
03652     return (DlgMgr->GetTreeGadgetFirstChildItem(GetReadWriteWindowID(), Gadget, hItem));
03653 }
03654 
03655 size_t DialogOp::GetTreeGadgetChildrenCount(CGadgetID Gadget, CTreeItemID hItem, BOOL bRecursive)
03656 {
03657     return (DlgMgr->GetTreeGadgetChildrenCount(GetReadWriteWindowID(), Gadget, hItem));
03658 }
03659 
03660 /********************************************************************************************
03661 
03662 >   OpDescriptor * DialogOp::GetGadgetOpDescriptor(CGadgetID Gadget)
03663 
03664     Author:     Alex Bligh
03665     Created:    03-Mar-2005
03666     Inputs:     Gadget - the Gadget to get the OpDescriptor for
03667     Outputs:    -                  
03668     Returns:    Pointer the gadget's associated OpDescriptor
03669     Purpose:    Finds the OpDescriptor associated with a gadget
03670     Errors:     -
03671     SeeAlso:    -
03672 
03673 ********************************************************************************************/
03674 
03675 OpDescriptor * DialogOp::GetGadgetOpDescriptor(CGadgetID Gadget)
03676 {
03677     return (DlgMgr->GetGadgetOpDescriptor(GetReadWriteWindowID(), Gadget));
03678 }
03679 
03680 
03681 /********************************************************************************************
03682 
03683 >   BOOL DialogOp::SendMessageToControl(OpDescriptor * OpDesc, DialogMsg* Msg, BOOL Processed=FALSE)
03684 
03685     Author:     Alex Bligh
03686     Created:    03-Mar-2005
03687     Inputs:     Msg: The message to handle
03688     Outputs:    -                  
03689     Returns:    TRUE to destroy the window, else FALSE
03690     Purpose:    Conditionally sends a message to a particular control pointed to by an opdescriptor,
03691     Errors:     -
03692     SeeAlso:    -
03693 
03694 The message is only sent if it is destined for that OpDescriptor - that's a broadcast,
03695 or if the dialog message has a gadget ID equal to that of the opdescriptor
03696 
03697 ********************************************************************************************/
03698 
03699 BOOL DialogOp::SendMessageToControl(OpDescriptor * OpDesc, DialogMsg* DlgMsg, BOOL Processed)
03700 {
03701     BOOL DestroyWindow = FALSE;
03702     if (OpDesc)
03703     {
03704         // If the message is DIM_CANCEL then we must inform all OpDescriptors on the 
03705         // bar that their controls are about to be destroyed. 
03706         if (DlgMsg->DlgMsg == DIM_CANCEL||DlgMsg->DlgMsg == DIM_BAR_DEATH)
03707         {
03708             // Tell the OpDescriptor its controls are about to be destroyed
03709             OpDescControlDestroyMsg op(OpDesc, OpDesc->GetBarControlInfo()->ControlID, OpDesc->GetBarControlInfo()->ResourceID, this);
03710             OpDesc->Message(&op);
03711             DestroyWindow = TRUE; // Cos we are cancelling
03712         }
03713         else if  (DlgMsg->DlgMsg == DIM_CREATE)
03714         {
03715             // Tell the OpDescriptor its controls have been created 
03716             OpDescControlCreateMsg op(OpDesc, OpDesc->GetBarControlInfo()->ControlID, OpDesc->GetBarControlInfo()->ResourceID, this);
03717             OpDesc->Message(&op);
03718         }       
03719     }
03720     return DestroyWindow;
03721 }
03722 
03723 
03724 
03725 /********************************************************************************************
03726 
03727 >   void ProfileSelectionChange (DialogMsg* Message, CGadgetID GadgetID)
03728 
03729     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
03730     Created:    19/1/2000
03731     Inputs:     CBiasGainGadget& and its GadgetID (for added safety)
03732     Outputs:    -
03733     Returns:    -
03734     Purpose:    Responds to CGadgetID's corresponding profile dialog messages.  Profile
03735                 changes are applied (internally) through ChangeProfile ()
03736     Errors:     -
03737     SeeAlso:    InformationBarOp::ChangeProfile ()
03738 
03739 ********************************************************************************************/
03740 void DialogOp::ProfileSelectionChange (DialogMsg* Message, CGadgetID GadgetID)
03741 {
03742     CProfileBiasGain* pBiasGainValue = NULL;
03743     switch (Message->DlgMsg)
03744     {
03745     case DIM_PROFILE_CHANGED:
03746         pBiasGainValue  =  reinterpret_cast<CProfileBiasGain* /*const**/>( Message->DlgMsgParam );
03747         ChangeProfile( pBiasGainValue, GadgetID );
03748         break;
03749             
03750     case DIM_PROFILE_CHANGING:
03751         if (m_bInteractiveProfiles == TRUE)
03752         {
03753             pBiasGainValue  =  reinterpret_cast<CProfileBiasGain* /*const**/>( Message->DlgMsgParam );
03754             ChangeProfile( pBiasGainValue, GadgetID );
03755         }
03756         break;
03757 
03758     case DIM_PROFILE_CHANGEIDLE:
03759         pBiasGainValue  =  reinterpret_cast<CProfileBiasGain* /*const**/>( Message->DlgMsgParam );
03760         ChangeProfileOnIdle( pBiasGainValue, GadgetID );
03761         break;
03762 
03763     default:
03764         break;
03765     } // end switch (message)
03766 }
03767 
03768 
03769 /********************************************************************************************
03770 
03771 >   void ChangeProfile (CProfileBiasGain& Profile, CGadgetID GadgetID)
03772 
03773     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
03774     Created:    19/1/2000
03775     Inputs:     CBiasGainGadget& and its GadgetID (for added safety)
03776     Outputs:    -
03777     Returns:    -
03778     Purpose:    Actually applies the profile to the selection.  This base class function
03779                 does nothing.  It MUST be overidden within InformationBarOp derived classes.
03780 
03781                 Take a look at tools\blendtool.cpp for an example of this.
03782     Errors:     -
03783     SeeAlso:    InformationBarOp::ProfileSelectionChange ()
03784 
03785 ********************************************************************************************/
03786 
03787 void DialogOp::ChangeProfile (CProfileBiasGain* Profile, CGadgetID GadgetID)
03788 {
03789     return;
03790 }
03791 
03792 /********************************************************************************************
03793 
03794 >   void ChangeProfileOnIdle (CProfileBiasGain& Profile, CGadgetID GadgetID)
03795 
03796     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
03797     Created:    9/8/2000
03798     Inputs:     CBiasGainGadget& and its GadgetID (for added safety)
03799     Outputs:    -
03800     Returns:    -
03801     Purpose:    This is a special version of the ChangeProfile () function.  It is only called
03802                 when the user has stopped moving the mouse whilst dragging a profile slider.  In
03803                 this way, camelot now possess TRUE idle slider processing.
03804     
03805                 Actually applies the profile to the selection (which should be non-undoable).
03806                 This base class function does nothing.
03807                 It MUST be overidden within InformationBarOp derived classes.
03808 
03809                 Take a look at tools\blendtool.cpp for an example of this.
03810     Errors:     -
03811     SeeAlso:    InformationBarOp::ProfileSelectionChange (), InformationBarOp::ChangeProfile ()
03812 
03813 ********************************************************************************************/
03814 
03815 void DialogOp::ChangeProfileOnIdle (CProfileBiasGain* Profile, CGadgetID GadgetID)
03816 {
03817     return;
03818 }

Generated on Sat Nov 10 03:45:01 2007 for Camelot by  doxygen 1.4.4