SGalleryOptionsDlg Class Reference

#include <sgallery.h>

Inheritance diagram for SGalleryOptionsDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 SGalleryOptionsDlg ()
 Constructor.
 ~SGalleryOptionsDlg ()
 destructor
MsgResult Message (Msg *Message)
 Standard DialogOp message handler, for the Gallery display dialogue.
void Do (OpDescriptor *)
 'Does' a gallery display dialogue op. DO NOT call this method - it must be invoked via DoWithParam
void DoWithParam (OpDescriptor *, OpParam *Param)
 'Does' a gallery display dialogue op. Shows the dialogue.
BOOL Create ()
 Creates a gallery display dialogue box.
void AddDisplayModeName (UINT32 NameResourceID)
 Called (multiple times) by derived gallery classes in response to a call we make (upon opening the dialogue) to ParentGallery->ApplyAction(SGACTION_SETOPTIONS).
void AddDisplayModeName (StringBase *EntryName)
 Called (multiple times) by derived gallery classes in response to a call we make (upon opening the dialogue) to ParentGallery->ApplyAction(SGACTION_SETOPTIONS).

Static Public Member Functions

static BOOL Init ()
 Initialises the colour sort dialogue op.
static OpState GetState (String_256 *, OpDescriptor *)
 Get the state of the Colour sort dialogue op.
static void InvokeDialog (SuperGallery *Parent)
 Creates a new instance of this dialogue type, connects it to the given gallery, and opens the dialogue on screen.

Static Public Attributes

static const UINT32 IDD = _R(IDD_SGDISPLAY)
static const CDlgMode Mode = MODELESS

Protected Member Functions

void InitValues (void)
 Initialises the gallery display dialogue, and sets its controls Scope: private.
void SetControls (void)
 (Re)Initialises the colour manager dialogue controls (This simply sets the combo boxes etc up from the current settings)
void Commit (void)
 Applies the current settings in the dialogue to its parent gallery.

Protected Attributes

SuperGalleryParentGallery

Detailed Description

Definition at line 731 of file sgallery.h.


Constructor & Destructor Documentation

SGalleryOptionsDlg::SGalleryOptionsDlg  ) 
 

Constructor.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95

Definition at line 3648 of file sgallery.cpp.

SGalleryOptionsDlg::~SGalleryOptionsDlg  ) 
 

destructor

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95

Definition at line 3667 of file sgallery.cpp.

03668 {
03669     if (ParentGallery != NULL)
03670         ParentGallery->CurrentOptionsDlg = NULL;
03671 }


Member Function Documentation

void SGalleryOptionsDlg::AddDisplayModeName StringBase EntryName  ) 
 

Called (multiple times) by derived gallery classes in response to a call we make (upon opening the dialogue) to ParentGallery->ApplyAction(SGACTION_SETOPTIONS).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
EntryName - The name to set as the next item [INPUTS]
Notes: Each call appends another display mode name to the display mode combo box list in the options window. When an option is chosen from this list, the index of the selected item (starting from 0 for the first item) will be used to set a new DisplayMode for the parent gallery.

Definition at line 3786 of file sgallery.cpp.

03787 {
03788     SetStringGadgetValue(_R(IDC_SGDISPLAY_DMODE), *EntryName, TRUE, 0);
03789 }

void SGalleryOptionsDlg::AddDisplayModeName UINT32  NameResourceID  ) 
 

Called (multiple times) by derived gallery classes in response to a call we make (upon opening the dialogue) to ParentGallery->ApplyAction(SGACTION_SETOPTIONS).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
NameResourceID - The resource ID of the name string to use for the next item [INPUTS]
Notes: Each call appends another display mode name to the display mode combo box list in the options window. When an option is chosen from this list, the index of the selected item (starting from 0 for the first item) will be used to set a new DisplayMode for the parent gallery.

Definition at line 3759 of file sgallery.cpp.

03760 {
03761     SetStringGadgetValue(_R(IDC_SGDISPLAY_DMODE), NameResourceID, TRUE, 0);
03762 }

void SGalleryOptionsDlg::Commit void   )  [protected]
 

Applies the current settings in the dialogue to its parent gallery.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95

Definition at line 3845 of file sgallery.cpp.

03846 {
03847     if (ParentGallery == NULL)
03848     {
03849         ERROR3("No parent gallery!");
03850         return;
03851     }
03852 
03853     INT32 NewDisplayMode = (INT32) GetSelectedValueIndex(_R(IDC_SGDISPLAY_DMODE));
03854     INT32 OldDisplayMode = ParentGallery->GetDisplayMode();
03855     if (NewDisplayMode != OldDisplayMode)
03856     {
03857         SGMiscInfo MiscInfo;
03858         ParentGallery->FillInMiscInfo(&MiscInfo);
03859 
03860         DocCoord OldPos(10000, MiscInfo.WindowHeight - 1000);
03861         SGDisplayNode *TopLeftItem = ParentGallery->FindNodeUnderPointer(&OldPos);
03862 
03863         INT32 OldScrollPos = ParentGallery->DisplayTree->GetScrollOffset();
03864 
03865         // Set the new display mode
03866         ParentGallery->DisplayMode = NewDisplayMode;
03867 
03868         // Get the parent gallery to 'vet' the new display mode number and take any
03869         // appropriate action.
03870         ParentGallery->ApplyAction(SGACTION_DISPLAYMODECHANGED);
03871 
03872         // After the gallery has 'vetted' the display mode, if it has really changed,
03873         // we need to redraw the list, and ensure it is not scrolled too far (as the
03874         // list extent has probably just changed dramatically)
03875         if (ParentGallery->GetDisplayMode() != OldDisplayMode)
03876         {
03877             ParentGallery->ForceRedrawOfList();     // Invlaidate the entire listbox
03878 
03879             if (ParentGallery->DisplayTree != NULL)
03880             {
03881                 // Re-cache the formatting
03882                 ParentGallery->GetDisplayExtent();
03883 
03884                 INT32 NewPos = OldScrollPos;
03885                 if (TopLeftItem != NULL)
03886                 {
03887                     // If possible, find where the previous top-left item has moved to,
03888                     // and set the scroll offset to show that item at the top left
03889                     DocRect TheRect;
03890                     TopLeftItem->GetFormatRect(&TheRect);
03891                     NewPos = ABS(TheRect.hi.y);
03892                 }
03893 
03894                 // And scroll to the current scroll offset (it will automatically clip
03895                 // the scroll offset back to a sensible place if necessary)
03896                 SGMiscInfo MiscInfo;
03897                 ParentGallery->FillInMiscInfo(&MiscInfo);
03898                 ParentGallery->DisplayTree->SetScrollOffset(NewPos, &MiscInfo);
03899             }
03900         }
03901     }
03902 }

BOOL SGalleryOptionsDlg::Create void   )  [virtual]
 

Creates a gallery display dialogue box.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Returns:
FALSE if it fails

Reimplemented from DialogOp.

Definition at line 4017 of file sgallery.cpp.

04018 {
04019     ERROR3IF(ParentGallery == NULL, "My ParentGallery is NULL!");
04020 
04021     if (DialogOp::Create())
04022     { 
04023         ParentGallery->CurrentOptionsDlg = this;
04024 
04025         InitValues();
04026         return(TRUE);
04027     }
04028 
04029     return(FALSE);
04030 }

void SGalleryOptionsDlg::Do OpDescriptor  )  [virtual]
 

'Does' a gallery display dialogue op. DO NOT call this method - it must be invoked via DoWithParam

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
OPDescriptor - the Opdescriptor for this op [INPUTS]
Notes: To show this dialogue you should call InvokeDialog

See also:
SGalleryOptionsDlg::InvokeDialog

Reimplemented from Operation.

Definition at line 4051 of file sgallery.cpp.

04052 {
04053     ERROR3("SGalleryOptionsDlg - You must use DoWithParam (Call InvokeDialog)");
04054     End();
04055 }

void SGalleryOptionsDlg::DoWithParam OpDescriptor ,
OpParam Param
[virtual]
 

'Does' a gallery display dialogue op. Shows the dialogue.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
Bob - the Opdescriptor for this op [INPUTS] Param - The parameter. Must point at a GalDlgParam object
Notes: To show this dialogue you should call InvokeDialog

See also:
SGalleryOptionsDlg::InvokeDialog

Reimplemented from Operation.

Definition at line 4076 of file sgallery.cpp.

04077 {
04078     ERROR3IF(Param == NULL, "Null parameters are illegal");
04079 
04080     ParentGallery = ((GalDlgParam *)Param)->ParentGal;
04081 
04082     ERROR3IF(ParentGallery == NULL, "SGalleryOptionsDlg needs a non-NULL parent gallery!"); 
04083 
04084     if (ParentGallery != NULL && Create())
04085         Open();
04086     else
04087         End();
04088 }

OpState SGalleryOptionsDlg::GetState String_256 ,
OpDescriptor
[static]
 

Get the state of the Colour sort dialogue op.

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

Errors: -

See also:
-

Definition at line 3966 of file sgallery.cpp.

03967 {    
03968     OpState OpSt;
03969     return(OpSt);
03970 }

BOOL SGalleryOptionsDlg::Init void   )  [static]
 

Initialises the colour sort dialogue op.

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

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 3989 of file sgallery.cpp.

03990 {
03991     return (RegisterOpDescriptor(
03992                                 0,
03993                                 _R(IDS_SGOPTIONSDLG),
03994                                 CC_RUNTIME_CLASS(SGalleryOptionsDlg),
03995                                 OPTOKEN_SGOPTIONSDLG,
03996                                 SGalleryOptionsDlg::GetState,
03997                                 _R(IDST_GALLERY_MENU),  // Status line help
03998                                 _R(IDBBL_GALLERY_MENU), // Bubble help
03999                                 0   /* bitmap ID */
04000                                 ));
04001 }

void SGalleryOptionsDlg::InitValues void   )  [protected]
 

Initialises the gallery display dialogue, and sets its controls Scope: private.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
See also:
SGalleryOptionsDlg::SetControls

Definition at line 3689 of file sgallery.cpp.

03690 {
03691     if (ParentGallery == NULL)
03692     {
03693         ERROR3("SGalleryOptionsDlg MUST be given a valid parent pointer");
03694         return;
03695     }
03696 
03697     // Fill in the combo boxes etc with the current settings
03698     SetControls();
03699 }

void SGalleryOptionsDlg::InvokeDialog SuperGallery Parent  )  [static]
 

Creates a new instance of this dialogue type, connects it to the given gallery, and opens the dialogue on screen.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
Parent - the parent (owner) of this display dialogue. This pointer [INPUTS] is used to inform the parent of changes to display/sort modes. May NOT be NULL.

Definition at line 3719 of file sgallery.cpp.

03720 {
03721     if (Parent->CurrentOptionsDlg != NULL)      // There's one already open!
03722     {
03723         // Bring it to the front of the window stack, then return
03724         Parent->CurrentOptionsDlg->BringToTop();
03725         return;
03726     }
03727 
03728     GalDlgParam GalOptInfo(Parent);
03729     OpDescriptor *Dlg = OpDescriptor::FindOpDescriptor(CC_RUNTIME_CLASS(SGalleryOptionsDlg));
03730 
03731     ERROR3IF(Dlg == NULL, "I can't find the Dialog OpDescriptor");
03732 
03733     if (Dlg != NULL)
03734         Dlg->Invoke(&GalOptInfo);
03735 }

MsgResult SGalleryOptionsDlg::Message Msg Message  )  [virtual]
 

Standard DialogOp message handler, for the Gallery display dialogue.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95
Parameters:
Msg - The dialogue manager message to handle [INPUTS]
Returns:
A MsgResult

Reimplemented from DialogOp.

Definition at line 3920 of file sgallery.cpp.

03921 {
03922     if (!(IS_OUR_DIALOG_MSG(Message))) return DialogOp::Message(Message);
03923 
03924     DialogMsg* TheMsg = (DialogMsg*)Message;
03925 
03926     switch(TheMsg->DlgMsg)
03927     {
03928         case DIM_COMMIT:                        // OK clicked
03929             Commit();
03930             // Drop through to CANCEL to close the dlg...
03931 
03932         case DIM_CANCEL:                        // Cancel clicked
03933             Close();
03934             End();
03935             return OK;
03936             break;
03937 
03938         case DIM_SOFT_COMMIT:                   // OK "adjust clicked"
03939             Commit();
03940             break;
03941 
03942         default:
03943             break;
03944     }
03945 
03946     return DialogOp::Message(Message);
03947 }

void SGalleryOptionsDlg::SetControls void   )  [protected]
 

(Re)Initialises the colour manager dialogue controls (This simply sets the combo boxes etc up from the current settings)

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/3/95

Definition at line 3805 of file sgallery.cpp.

03806 {
03807     if (ParentGallery == NULL)
03808     {
03809         ERROR3("ParentGallery is NULL!");
03810         return;
03811     }
03812 
03813     // Set up the OK button to respond to Adjust (SOFT_COMMIT) clicks
03814     DualFunctionButton(wxID_OK);
03815 
03816     // Set values in our combo boxes - the gallery will call us back to do this
03817     DeleteAllValues(_R(IDC_SGDISPLAY_DMODE));
03818     GadgetRedraw(_R(IDC_SGDISPLAY_DMODE), FALSE);
03819 
03820     BOOL Result = ParentGallery->ApplyAction(SGACTION_SETOPTIONS);
03821 
03822     EnableGadget(_R(IDC_SGDISPLAY_DMODE), Result);
03823     GadgetRedraw(_R(IDC_SGDISPLAY_DMODE), TRUE);
03824 
03825     if (Result)
03826     {
03827         SetSelectedValueIndex(_R(IDC_SGDISPLAY_DMODE), (INT32) ParentGallery->GetDisplayMode());
03828         SetComboListLength(_R(IDC_SGDISPLAY_DMODE));
03829     }
03830 }


Member Data Documentation

const UINT32 SGalleryOptionsDlg::IDD = _R(IDD_SGDISPLAY) [static]
 

Definition at line 748 of file sgallery.h.

const CDlgMode SGalleryOptionsDlg::Mode = MODELESS [static]
 

Definition at line 749 of file sgallery.h.

SuperGallery* SGalleryOptionsDlg::ParentGallery [protected]
 

Definition at line 761 of file sgallery.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:54 2007 for Camelot by  doxygen 1.4.4