home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / WILDASS / SOURCE / XFILEDLG.H < prev   
C/C++ Source or Header  |  1993-08-10  |  4KB  |  121 lines

  1. // ///////////////////////////////////////////////////////////////////////////
  2. // xfiledlg.h - real world common file dialog and derived classes
  3. //
  4. // classes that are defined within
  5. //  - XFileDlg
  6. //    |- XDirectoryDialog
  7. //
  8. // update: 07-Feb-1993 thomas woelfer
  9. //         14-Feb-1993 thomas woelfer - final fixes
  10. //         10-Mar-1993 thomas woelfer - 3d controls under nt too
  11. //         08-Aug-1993 tw changed to work with morespace
  12. //                        NT support removed
  13. // ///////////////////////////////////////////////////////////////////////////
  14.  
  15.  
  16. #ifndef _INC_XFILEDLG
  17. #define _INC_XFILEDLG
  18.  
  19. #include <dlgs.h>
  20.  
  21. /* ************************************************************************ *\
  22.  * name: XFileDialog
  23.  *
  24.  *       a real world file dialog using the common dialogs. the dialog may
  25.  *       be resized to use the full screen estate height.
  26.  *
  27.  *       further reference can be found in the winhelp felp file xfiledlg.hlp
  28.  *
  29.  * update: 07-Feb-1993 thomas woelfer
  30.  *
  31. \* ************************************************************************ */
  32.  
  33. class XFileDialog : public CFileDialog
  34. {
  35. private:
  36.     int  m_xLeft;                // Left Border of "leftie" Controls in Dialog
  37.                                           // Used by StretchToFitLeft() memFxt
  38.     int  m_cyOffset;                           // Offset for new vertical size
  39.  
  40.     CString m_strDlgTitel;                          // initial Title of dialog
  41.  
  42.     // Offset Control to fit new vert. size
  43.     void OffsetCtrlY( const int nID ) const;
  44.  
  45.     // Stretch to new vert. size
  46.     void StretchToFitVerticaly( const int nID ) const;
  47.  
  48. public:
  49.    XFileDialog( const char* DlgTitel,                               // caption
  50.                 BOOL bIsOpenDlg,                            // open/close flag
  51.                 const char* szDefExt = "",                // default extension
  52.                 const char* szFileName = NULL ,            // default filename
  53.                 DWORD dwFlags = OFN_HIDEREADONLY |              // other flags
  54.                                 OFN_OVERWRITEPROMPT,
  55.                 const char* szFilter = "all(*.*)|*.*||", // our default filter
  56.                 CWnd* pParent = NULL )
  57.       : CFileDialog( bIsOpenDlg, szDefExt, szFileName, dwFlags, szFilter,
  58.                      pParent )
  59.    {
  60.       m_strDlgTitel = DlgTitel;
  61.    }
  62.  
  63.    BOOL OnInitDialog();                    // that one does the resizing stuff
  64.  
  65.    // this is only used for 3d ctls
  66.    // HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
  67.  
  68.    // don`t need a message map without ctl3d
  69.    // DECLARE_MESSAGE_MAP();
  70.  
  71. protected:
  72.    void HideCtrl( const int nID );                             // Hide a cntrl
  73.  
  74.        // Stretch a control so it fits to the left side of the left side ctrls
  75.    void StretchToFitLeft( const int nID ) const;
  76.    void StretchToFitRight( const int nID ) const;
  77.  
  78. };
  79.  
  80. /* ************************************************************************ *\
  81.  * name: XDirectoryDialog
  82.  *
  83.  *       directory picker dialog
  84.  *
  85.  *       further reference can be found in the winhelp felp file xfiledlg.hlp
  86.  *
  87.  * update: 07-Feb-1993 thomas woelfer
  88.  *
  89. \* ************************************************************************ */
  90.  
  91. class XDirectoryDialog : public XFileDialog           // Directory select ...
  92. {
  93. public:
  94.    XDirectoryDialog( const char* DlgTitel )
  95.       : XFileDialog( DlgTitel, TRUE, "*" )
  96.    {}
  97.  
  98.    CString GetPathName() const;    // override this helper for ease of parsing
  99.  
  100.    BOOL OnInitDialog()
  101.    {
  102.       VERIFY( XFileDialog::OnInitDialog());
  103.  
  104.       HideCtrl( stc3 );                         // Hide the stuff we dont want
  105.       HideCtrl( edt1 );
  106.       HideCtrl( lst1 );
  107.       HideCtrl( stc2 );
  108.       HideCtrl( cmb1 );
  109.  
  110.       StretchToFitLeft( -1 );           // "Directories"
  111.       
  112.       StretchToFitLeft( stc1 );
  113.       StretchToFitLeft( lst2 );
  114.  
  115.       return TRUE;
  116.    }
  117.  
  118. };
  119.  
  120. #endif
  121.