core/vgui/impl/mfc/vgui_mfc_dialog_impl.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/mfc/vgui_mfc_dialog_impl.h
00002 #ifndef vgui_mfc_dialog_impl_h_
00003 #define vgui_mfc_dialog_impl_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author  Marko Bacic, RRG, University of Oxford
00010 // \date    31 Jul 2000
00011 // \brief   The MFC implementation of vgui_dialog_impl.
00012 //
00013 // \verbatim
00014 //  Modifications
00015 //   31-JUL-2000 Marko Bacic - Initial version.
00016 //   03-MAR-2001 K.Y.McGaul - Added correct modifiers to key press/release events
00017 //                          - Set checkboxes to display current value correctly
00018 //   22-AUG-2001 K.Y.McGaul - Fixed memory leak: font is now deleted.
00019 //   19-SEP-2001 K.Y.McGaul & Marko Bacic - Finally got inline tableau working!
00020 //   16-NOV-2007 Gamze Tunali - private methods are now protected
00021 //                              vgui_mfc_dialog_extensions_impl is inheriting from
00022 // \endverbatim
00023 
00024 class CFont;
00025 
00026 #include <vgui/internals/vgui_dialog_impl.h>
00027 #include "StdAfx.h"
00028 #undef MAX_ITEMS // also defined in vgui_mfc_dialog_extensions_impl.h
00029 #define MAX_ITEMS 255
00030 // MFC documentation says that our IDs should be in the range 0x8000-0xDFF
00031 #undef ID_BROWSE_FILES // also defined in vgui_mfc_dialog_extensions_impl.h
00032 #define ID_BROWSE_FILES 0x8000  // Assume that there won't be more than 100 browser buttons
00033 #undef ID_CHOOSE_COLOUR // also defined in vgui_mfc_dialog_extensions_impl.h
00034 #define ID_CHOOSE_COLOUR 0x8100 // Assume that there won't be more than 100 color chooser buttons
00035 #undef ID_EDIT // also defined in vgui_mfc_dialog_extensions_impl.h
00036 #define ID_EDIT 0x8200
00037 #undef ID_COMBOBOX // also defined in vgui_mfc_dialog_extensions_impl.h
00038 #define ID_COMBOBOX 0x8300
00039 
00040 //: The MFC implementation of vgui_dialog_impl.
00041 //
00042 //  Creates a dialog box in MFC.
00043 //  Based on vgui_gtk_dialog_impl.
00044 class vgui_mfc_dialog_impl : public CDialog,public vgui_dialog_impl
00045 {
00046  public:
00047   vgui_mfc_dialog_impl(const char* name);
00048   ~vgui_mfc_dialog_impl();
00049 
00050   void* choice_field_widget(const char*, const vcl_vector<vcl_string>&, int&);
00051   void* inline_tableau_widget(const vgui_tableau_sptr tab, unsigned width, unsigned height);
00052   //: Sets the modality of the dialog box.
00053   // True makes the dialog modal (i.e. the dialog 'grabs' all events), this is
00054   // the default.  False makes the dialog non-modal. WARNING: It is dangerous to
00055   // make a dialog that changes data nonmodal, only messages should be nonmodal.
00056   // NOTE: currently a no-op
00057   void modal(bool ) {}
00058   //: Display the dialog box.
00059   bool ask();
00060  protected:
00061   LOGFONT m_logfont;
00062   //: Called by MFC when the user clicks the OK button.
00063   virtual void OnOk();
00064   //: Called by MFC when the user clicks the cancel button.
00065   virtual void OnCancel();
00066   //: Called by MFC when the user clicks the (file) browse button.
00067   virtual void OnBrowse(UINT uID);
00068   //: Called by MFC when the user clicks the colour chooser button.
00069   virtual void OnChooseColour(UINT uID);
00070   //: Called by MFC when the application is about to terminate.
00071   afx_msg void OnClose();
00072  protected:
00073   int nResult;
00074   //: File browser counter.
00075   int count_fbsr;
00076   //: Colour chooser counter.
00077   int count_csr;
00078   bool ok_clicked;
00079   //: Array of MFC file browser objects.
00080   CWnd *fbsrs[100];
00081   //: Array of MFC colour chooser objects.
00082   CWnd *csrs[100];
00083   //: MFC dialog box object.
00084   CWnd *dialog_box;
00085   vcl_vector<CWnd *> wlist;
00086   //: List of created MFC objects (so we can delete them).
00087   vcl_vector<CWnd *> awlist;
00088   DECLARE_MESSAGE_MAP()
00089   //: Type font.
00090   CFont* font;
00091 };
00092 
00093 #endif // vgui_mfc_dialog_impl_h_