[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1019
Date : Fri May 12 10:41:24 BST 2006
Changed paths:
M /Trunk/XaraLX/Kernel/dialogop.cpp
M /Trunk/XaraLX/Kernel/dialogop.h
M /Trunk/XaraLX/wxOil/dlgmgr.cpp
M /Trunk/XaraLX/wxOil/dlgmgr.h
Improve support where there are multiple book controls in one dialog
Diff:
Index: Trunk/XaraLX/Kernel/dialogop.cpp
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.cpp (revision 1018)
+++ Trunk/XaraLX/Kernel/dialogop.cpp (revision 1019)
@@ -3075,14 +3075,18 @@
/********************************************************************************************
-> BOOL DialogTabOp::AddAPage(CDlgResID DialogResID)
+> BOOL DialogTabOp::AddAPage(CDlgResID DialogResID, CGadgetID Gadget=0)
Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
Created: 16/11/94
Inputs: DialogResID: Dialog resource ID of the page you want to add to the Tabbed
dialog.
-
-
+ GadgetID: The gadget ID of the book control to add it to, or zero
+ for the default one (either specified using GetDefaultBookGadget
+ or just the first one it finds). You only need specify this if
+ the dialog contains multiple book controls (if there are
+ multiple book controls and only one is kernel managed, the
+ best thing to do is to override GetDefaultBookGadget)
Outputs: -
Returns: -
Purpose: This function adds a dialog page to the tabbed dialog.
@@ -3100,10 +3104,10 @@
********************************************************************************************/
-BOOL DialogTabOp::AddAPage(CDlgResID DialogResID)
+BOOL DialogTabOp::AddAPage(CDlgResID DialogResID, CGadgetID Gadget/*=0*/)
{
// Ask the Dialog Manager to add the page
- return (DlgMgr->AddAPage(this, DialogResID));
+ return (DlgMgr->AddAPage(this, DialogResID, Gadget));
};
/********************************************************************************************
Index: Trunk/XaraLX/Kernel/dialogop.h
===================================================================
--- Trunk/XaraLX/Kernel/dialogop.h (revision 1018)
+++ Trunk/XaraLX/Kernel/dialogop.h (revision 1019)
@@ -568,7 +568,7 @@
// A function to add a dialog page to the tabbed dialog. Note that this function can be
// called many times before the dialog is made visible.
- BOOL AddAPage(CDlgResID DialogResID);
+ BOOL AddAPage(CDlgResID DialogResID, CGadgetID Gadget=0);
// Call this function before calling create. It sets the name displayed in the dialog's
// title bar window
@@ -593,6 +593,7 @@
virtual BOOL HasImages() {return FALSE;}
virtual TabType GetTabType() {return TABTYPE_TABS;}
+ virtual CGadgetID GetDefaultBookGadget() {return (CGadgetID)0;}
// The DialogOP destructor destroys the instance of the DialogTabOp and all
// associated resources. If the dialog was open then it is closed.
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h (revision 1018)
+++ Trunk/XaraLX/wxOil/dlgmgr.h (revision 1019)
@@ -683,7 +683,7 @@
// --------------------------------------------------------------------------------------
// Functions which are specific to Tabbed dialogs
// This function adds a page to a tabbed dialog
- static BOOL AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID);
+ static BOOL AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID, CGadgetID Gadget=0);
// This function maps a property sheet window ID, and a PageID to a Page window ID
static CWindowID GetPageWindow(CWindowID Win, CDlgResID PageID, INT32* PageIndex = NULL);
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1018)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp (revision 1019)
@@ -1338,6 +1338,11 @@
If the window is of type wxPropertySheetDialog then it Gadget is not
required
+Note that the intelligence to use the default gadget won't be there until the window
+has been created properly and the event handler added. So if this is being called
+from a window creation function (like AddAPage) it is worth specifying the gadget
+explicitly.
+
********************************************************************************************/
wxBookCtrlBase * DialogManager::GetBookControl(CWindowID WindowID, CGadgetID Gadget /* =0 */)
@@ -1349,6 +1354,19 @@
if (WindowID->IsKindOf(CLASSINFO(wxPropertySheetDialog)))
return ((wxPropertySheetDialog*)WindowID)->GetBookCtrl();
+ // Let's see if there is a default gadget to use in the DialogOp
+ if (!Gadget)
+ {
+ if ((WindowID->GetEventHandler())->IsKindOf(CLASSINFO(DialogEventHandler)))
+ {
+ DialogOp * pDialogOp = ((DialogEventHandler *)(WindowID->GetEventHandler()))->pDialogOp;
+ // If it's a DialogTabOp, ask it for its default book gadget. If there isn't
+ // one, that's OK too
+ if ((pDialogOp) && (pDialogOp->IS_KIND_OF(DialogTabOp)))
+ Gadget=((DialogTabOp*)pDialogOp)->GetDefaultBookGadget();
+ }
+ }
+
// If we were passed a gadget ID, we can go use it
if (Gadget)
{
@@ -6421,13 +6439,15 @@
/********************************************************************************************
-> BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID)
+> BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID, CGadgetID Gadget=0)
Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xxxxxxxx>
Created: 22/11/94
Inputs: pDialogTabOp: The operation we wish to add a page too
DialogResID: The resource ID of the dialog page we wish to add to the
DialogTabOp
+ Gadget The gadget of the book control to add the page to (or zero to
+ take a good guess)
Outputs: -
Returns: TRUE if the page was added successfully.
Purpose: Adds a page to the tabbed dialog with resource ID DialogResID.
@@ -6437,11 +6457,11 @@
********************************************************************************************/
-BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID)
+BOOL DialogManager::AddAPage(DialogTabOp* pDialogTabOp, CDlgResID DialogResID, CGadgetID Gadget)
{
// Try to add the page to the property sheet associated with the DialogTabOp
// let's try and find it
- wxBookCtrlBase* pNoteBook = GetBookControl(pDialogTabOp->WindowID);
+ wxBookCtrlBase* pNoteBook = GetBookControl(pDialogTabOp->WindowID, Gadget);
// We need to create a page object
// Because wxNotebookPage is derived from an MFC object we have to cope with exceptions
Xara