ImportFileDialog Class Reference

To provide a custom open file dialog, which enables us to resize the drop down list of filters. More...

#include <filedlgs.h>

Inheritance diagram for ImportFileDialog:

BaseFileDialog List of all members.

Public Member Functions

 ImportFileDialog (LPCTSTR lpszFilter=NULL)
 Constructs a file import dialog.

Protected Member Functions

virtual BOOL ExplorerInitDialog (wxWindow *hDlg)
 Should be called when the explorer style dialog boxes need setting up. We can take this opportunity to add in any extra controls that we require.

Private Member Functions

BOOL OnInitDialog (wxInitDialogEvent &event)
 Make the drop-down filter box bigger than usual.
void DoDataExchange (CDataExchange *pDX)
 Gets the state of the "Import Layers" check-box in the import file dialog.
afx_msg void OnLButtonDblClk (UINT32 nFlags, CPoint point)
 DECLARE_DYNAMIC (ImportFileDialog)

Private Attributes

wxButton * LayersButton

Detailed Description

To provide a custom open file dialog, which enables us to resize the drop down list of filters.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/02/94
See also:
OpMenuImport

Definition at line 493 of file filedlgs.h.


Constructor & Destructor Documentation

ImportFileDialog::ImportFileDialog LPCTSTR  lpszFilter = NULL  ) 
 

Constructs a file import dialog.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/95
Parameters:
lpszFilter which file extensions to display/allow [INPUTS]
Graham 6/6/97: Took out the OFN_NOVALIDATE flag. Olivier had set this to allow URLs to be typed into the "File name" field, but it was stopping wildcard searches (e.g. *.gif) from working

Definition at line 2998 of file filedlgs.cpp.

02999     :   BaseFileDialog(TRUE, ((CCamApp::IsNewWindowsUI()) ? OFN_ENABLETEMPLATE : 0) | 
03000 //          OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, lpszFilter, NULL)
03001     : BaseFileDialog( TRUE, wxFILE_MUST_EXIST, lpszFilter, NULL )
03002 {
03003 PORTNOTE("other", "Disabled template stuff" )
03004 #if !defined(EXCLUDE_FROM_XARALX)
03005     if (CCamApp::IsNewWindowsUI())
03006     {
03007         // Use our template to do the ammendment and addition of controls to the dialog box
03008         m_ofn.lpTemplateName = MAKEINTRESOURCE(_R(IDD_PREVIEWBITMAP));
03009     }
03010     else
03011         m_ofn.lpTemplateName = NULL;
03012 #endif
03013     
03014     // Set the preview bitmap to be NULL
03015     pBitmapToUse = NULL;
03016 }


Member Function Documentation

ImportFileDialog::DECLARE_DYNAMIC ImportFileDialog   )  [private]
 

void ImportFileDialog::DoDataExchange CDataExchange *  pDX  )  [private]
 

Gets the state of the "Import Layers" check-box in the import file dialog.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/5/95
Parameters:
(a standard MFC object) [INPUTS]

Definition at line 3189 of file filedlgs.cpp.

03190 {
03191     BaseFileDialog::DoDataExchange(pDX);
03192     //{{AFX_DATA_MAP(CMyDialog)
03193     DDX_Check(pDX, _R(IDC_LAYERS_BUTTON), Filter::ImportWithLayers);
03194     if (CCamApp::IsNewWindowsUI())
03195     {
03196         DDX_Check(pDX, _R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap);
03197     }
03198     //}}AFX_DATA_MAP
03199 }

BOOL ImportFileDialog::ExplorerInitDialog wxWindow *  hDlg  )  [protected, virtual]
 

Should be called when the explorer style dialog boxes need setting up. We can take this opportunity to add in any extra controls that we require.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/8/96
Returns:
TRUE if it worked, FALSE if it failed
See also:
BaseFileDialog::ExplorerInitDialog; BaseFileDialog::OnHookMsg; BaseFileDialog::HookProc;

Reimplemented from BaseFileDialog.

Definition at line 3133 of file filedlgs.cpp.

03134 {
03135 PORTNOTE("other", "Remove MFC code" )
03136 #if !defined(EXCLUDE_FROM_XARALX)
03137     // Do nothing of not on explorer type dialog boxes
03138     if (!CCamApp::IsNewWindowsUI())
03139         return TRUE;
03140 
03141     // Set up and initialise the new buttons and controls
03142 
03143     // Give it the correct state according to the preference.
03144     CheckDlgButton(_R(IDC_SHOWPREVIEW), BaseFileDialog::ShowPreviewBitmap != FALSE);
03145 
03146     wxWindow* Icon = FindWindow( _R(IDC_PREVIEW));
03147     ::EnableWindow(Icon, TRUE);
03148 
03149     // WEBSTER - markn 28/1/97
03150     Icon = FindWindow( _R(IDC_FILEDLG_OPTIONS));
03151     ::ShowWindow(Icon, SW_HIDE);
03152 
03153     //Graham 27/10/97: And the "use as default" button
03154     Icon = FindWindow( _R(IDC_USEASDEFAULT));
03155     ::ShowWindow(Icon, SW_HIDE);
03156 
03157     //And the "default templates folder" button
03158     //Icon = FindWindow( _R(IDC_DEFAULTTEMPLATESFOLDER));
03159     //::ShowWindow(Icon, SW_HIDE);
03160 
03161     // Move the Preview box down a little, so that it lines up with the List box
03162     CWnd *wndDlg = GetParent();
03163     wxWindow* pWndPreview = GetDlgItem(_R(IDC_PREVIEW));
03164     wxRect rPreview, rList;
03165     pWndPreview->GetWindowRect(&rPreview);
03166     ScreenToClient(rPreview);
03167     wxWindow* pWndList = wndDlg->GetDlgItem(lst1);  // lst1 is the ID for the main list box
03168     pWndList->GetWindowRect(&rList);
03169     ScreenToClient(rList);
03170     pWndPreview->SetWindowPos(NULL, rPreview.left, rList.top, rPreview.Width(), rPreview.Height(), 0);
03171 
03172     ExplorerInited = TRUE;
03173 #endif
03174 
03175     return TRUE;
03176 }

BOOL ImportFileDialog::OnInitDialog wxInitDialogEvent &  event  )  [private]
 

Make the drop-down filter box bigger than usual.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/03/94
Returns:
TRUE => normal window focus is required.
See also:
ImportFileDialog

Definition at line 3030 of file filedlgs.cpp.

03031 {
03032     // Set up the string we require
03033     String_256 NewText(_R(IDN_IMPORTBUTTON));
03034     const TCHAR*    NewTextStr = NewText;
03035 
03036     // Get the handle of the ok button.
03037     wxButton*       OkButton = dynamic_cast<wxButton*>( FindWindow( wxID_OK ) );
03038 
03039     // Now replace the 'ok' by 'import'
03040     OkButton->SetLabel( NewTextStr ); 
03041 
03042 PORTNOTE("other", "Remove code to re-arrange ImportFileDialog" )
03043 #if !defined(EXCLUDE_FROM_XARALX)
03044     // Get the handle of the filter list box.
03045     wxComboBox*     ComboBox = dynamic_cast<wxComboBox*>( FindWindow( cmb1 ) );
03046 
03047     // Find out where the list box is.
03048     WINDOWPLACEMENT Placement;
03049     Placement.length = sizeof(Placement);
03050     ::GetWindowPlacement(ComboBox, &Placement);
03051 
03052     // Make the list box deeper than usual
03053     ::MoveWindow(ComboBox,
03054                  Placement.rcNormalPosition.left,
03055                  Placement.rcNormalPosition.top,
03056                  Placement.rcNormalPosition.right - Placement.rcNormalPosition.left,
03057                  (Placement.rcNormalPosition.bottom - Placement.rcNormalPosition.top) * 5,
03058                  TRUE);
03059 
03060     // Move the bottom of the dialog down...
03061     Placement.length = sizeof(Placement);
03062     ::GetWindowPlacement(GetSafeHwnd(), &Placement);
03063     INT32 Height = Placement.rcNormalPosition.bottom - Placement.rcNormalPosition.top;
03064 
03065     // ...and add a check box for the layers on/off preference.
03066     // We need to place the extra control differently if we are in Win 95
03067     // as the file dialog is a different size and shape. It also behaves differently,
03068     // adjusting its size to fit the controls etc. Much smarter.
03069     wxRect ButtonPos;
03070     if (CCamApp::IsNewWindowsUI()) //IsWin32c())
03071     {
03072         // Its windows 95, so use these settings
03073         ButtonPos = wxRect(10, 235, 160, 255);
03074         if (IsWin32NT())
03075         {
03076             // NT 4 seems to open the dialog box too narrow in height so the switch is hidden
03077             // Windows 95 shows the switch.
03078             ::MoveWindow(GetSafeHwnd(),
03079                  Placement.rcNormalPosition.left,
03080                  Placement.rcNormalPosition.top,
03081                  Placement.rcNormalPosition.right - Placement.rcNormalPosition.left,
03082                  Height + 20,
03083                  TRUE);
03084         }
03085     }
03086     else
03087     {
03088         // Its not Windows 95, so use these settings.
03089         // Note, we have to expand the dialog window here as well.
03090         ButtonPos = wxRect(10, Height-35, 160, Height-15);
03091         ::MoveWindow(GetSafeHwnd(),
03092                      Placement.rcNormalPosition.left,
03093                      Placement.rcNormalPosition.top,
03094                      Placement.rcNormalPosition.right - Placement.rcNormalPosition.left,
03095                      Height + 20,
03096                      TRUE);
03097     }
03098 
03099     // Get the text for the button - default to something useful
03100     // so that if SmartLoadString fails we still have something
03101     // even if it is in the wrong language
03102     char ButtonText[128] = "Import with Layers"; // Fallback - don't resourceify
03103     SmartLoadString(0, _R(IDS_IMPORTWITHLAYERS), ButtonText, 128);
03104     LayersButton.Create(ButtonText, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
03105                         ButtonPos, this, _R(IDC_LAYERS_BUTTON));
03106 
03107     // ..and make it use the same font as the rest of the dialog
03108     HFONT hFont = (HFONT) SendMessage(WM_GETFONT);
03109     LayersButton.SendMessage(WM_SETFONT, (WPARAM) hFont, MAKELPARAM(FALSE, 0));
03110 
03111     // Give it the correct state according to the preference.
03112     LayersButton.SetCheck(Filter::ImportWithLayers != FALSE);
03113 #endif
03114 
03115     // Leave the rest up to the base class . . .
03116     BaseFileDialog::OnInitDialog( event );
03117     return TRUE;
03118 }

afx_msg void ImportFileDialog::OnLButtonDblClk UINT32  nFlags,
CPoint  point
[private]
 


Member Data Documentation

wxButton* ImportFileDialog::LayersButton [private]
 

Definition at line 505 of file filedlgs.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:26 2007 for Camelot by  doxygen 1.4.4