shell.h

Go to the documentation of this file.
00001 /**
00002  * \file mgui/shell.h
00003  * \brief MGUI::SHELL definitions
00004  *
00005  * \if NODOC
00006  * $Id: shell.h_v 1.8 2004/03/04 18:30:57 mju Exp $
00007  *
00008  * $Log: shell.h_v $
00009  * Revision 1.8  2004/03/04 18:30:57  mju
00010  * Make copy ctor/op= private and unimplemented.
00011  * Make dtor virtual.
00012  *
00013  * Revision 1.7  2003/12/15 21:31:19  mju
00014  * Fix comment.
00015  *
00016  * Revision 1.6  2003/10/03 19:58:19  linux32build!build
00017  * Doxygen
00018  *
00019  * Revision 1.5  2003/10/01 22:32:34  dwilliss
00020  * doxygen
00021  *
00022  * Revision 1.4  2003/09/15 13:49:32  fileserver!dwilliss
00023  * Doxygen
00024  *
00025  * Revision 1.3  2003/08/29 16:43:51  mju
00026  * Change SetTitle to just take mistring ref.
00027  *
00028  * Revision 1.2  2003/06/04 15:36:53  scowan
00029  * Made the v_Cmd router virtual.
00030  *
00031  * Revision 1.1  2003/05/28 16:08:35  mju
00032  * Initial revision
00033  *
00034  * \endif
00035 **/
00036 
00037 #ifndef  INC_MGUI_SHELL_H
00038 #define  INC_MGUI_SHELL_H
00039 
00040 #ifndef  INC_MI32_STDDEFNS_H
00041 #include <mi32/stddefns.h>
00042 #endif
00043 
00044 #ifndef  INC_MI32_HELPID_H
00045 #include <mi32/helpid.h>
00046 #endif
00047 
00048 #ifndef  INC_MGUI_COMMAND_H
00049 #include <mgui/command.h>
00050 #endif
00051 
00052 #ifndef  INC_MGUI_LAYOUT_H
00053 #include <mgui/layout.h>
00054 #endif
00055 
00056 #ifndef  INC_MI32_RECT_H
00057 #include <mi32/rect.h>
00058 #endif
00059 
00060 
00061 #ifndef GENERATING_DOXYGEN_OUTPUT
00062 // Forward declarations.
00063 class CWnd;
00064 namespace MGUI {
00065 class CTRL_STATUSBAR;
00066 class DLGSHELL;
00067 class TOPSHELL;
00068 }
00069 #endif // GENERATING_DOXYGEN_OUTPUT
00070 
00071 
00072 namespace MGUI {
00073 
00074 //! Base class for 'shell' windows (application windows and dialogs).
00075 class SHELL {
00076    public:
00077 
00078       class PLACEMENT;
00079 
00080       //! Get MDLGPARENT for use as parent for child dialogs.
00081       MDLGPARENT GetDlgParent (
00082          ) const;
00083 
00084       //! Destroy the shell.
00085       void Destroy ();
00086 
00087       //! Get Help ID.
00088       HELPID GetHelpID (
00089          ) const { return (m_HelpID); }
00090 
00091       //! Get main layout pane.
00092       LAYOUT_PANE_MAIN& GetMainPane (
00093          ) { return (v_GetMainPane()); }
00094 
00095       //! Get shell 'placement' on screen.
00096       void GetPlacement (
00097          PLACEMENT& placement
00098          ) const;
00099 
00100       //! Determine if shell has been 'created' yet.
00101       bool IsCreated (
00102          ) const {
00103          #ifdef WIN32_MFC
00104             return (m_pWnd != 0);
00105          #else
00106             return (m_shell != 0);
00107          #endif
00108          }
00109 
00110       //! Set shell 'placement' on screen.
00111       //! Return 'true' if successful, 'false' if not.
00112       bool SetPlacement (
00113          const PLACEMENT& placement
00114          );
00115 
00116       //! Set Ini/Registry key for automatic shell placement.
00117       //! This will automatically load the placement and subsequently
00118       //! record any changes later made to the placement by the user.
00119       void SetPlacementByKey (
00120          const char *PlacementKey
00121          );
00122 
00123       //! Set title.
00124       void SetTitle (
00125          const MISTRING& title         //!< Title string (can be TEXTID also)
00126          );
00127 
00128    protected:
00129 
00130       //! Constructor.
00131       SHELL (
00132          HELPID helpid
00133          );
00134 
00135       //! Destructor.
00136       virtual ~SHELL ();
00137 
00138       //! Get "command router" for shell.
00139       MGUI::COMMAND_ROUTER* GetCmdRouter (
00140          ) const {
00141       #ifdef X_NATIVE
00142          return (0);
00143       #else
00144          return (v_GetCmdRouter());
00145       #endif
00146          }
00147 
00148       void SetMenuBar (
00149          const MGUI::MENU& menu
00150          );
00151 
00152       //! Set status bar.
00153       void SetStatusBar (
00154          MGUI::CTRL_STATUSBAR& StatusBar
00155          ) { m_pStatusBar = &StatusBar; }
00156 
00157    private:
00158       #ifndef GENERATING_DOXYGEN_OUTPUT
00159 
00160       friend class MGUI::TOPSHELL;
00161       friend class MGUI::DLGSHELL;
00162 
00163    #ifdef WIN32_MFC
00164       CWnd *m_pWnd;
00165    #endif
00166    #ifdef X_NATIVE
00167       Widget m_shell;
00168       LAYOUT_PANE_MAIN m_MainPane;
00169    #endif
00170       HELPID m_HelpID;
00171       CTRL_STATUSBAR *m_pStatusBar;
00172       char *m_PlacementKey;
00173       bool m_AllowClose;
00174       MISTRING m_Title;
00175 
00176    #ifdef X_NATIVE
00177       void AttachShell (Widget shell, bool AllowClose=true);
00178    #endif
00179       void OnCloseRequest () { v_OnCloseRequest(); }
00180    #ifdef X_NATIVE
00181       static void OnNotifyXDelete (Widget, SHELL*, void*);
00182    #endif
00183 
00184       // Unimplemented.
00185       SHELL (const SHELL&);
00186       SHELL& operator= (const SHELL&);
00187 
00188       #endif // GENERATING_DOXYGEN_OUTPUT
00189 
00190       // Overridables
00191 
00192       //! Create shell contents.
00193       //! For details see MGUI::TOPSHELL or MGUI::DLGSHELL.
00194       virtual int v_CreateContent () = 0;
00195 
00196       //! Destroy the shell.
00197       virtual void v_Destroy () = 0;
00198 
00199    #ifdef WIN32_MFC
00200       //! Get command router (MFC only).
00201       virtual MGUI::COMMAND_ROUTER* v_GetCmdRouter () const = 0;
00202    #endif
00203 
00204       //! Get main layout pane.
00205       virtual LAYOUT_PANE_MAIN& v_GetMainPane () = 0;
00206 
00207       //! Called when user requests that shell be 'closed'.
00208       //! Usually results from an OS or Window Manager notification.
00209       virtual void v_OnCloseRequest () = 0;
00210 
00211    };
00212 
00213 
00214 //! Container to encapsulate shell 'placement' for save/restore.
00215 class SHELL::PLACEMENT {
00216    public:
00217 
00218       //! Constructor.
00219       PLACEMENT ();
00220 
00221       const LRECT2D& GetNormalPosition (
00222          ) const { return (m_NormalPosition); }
00223 
00224       void IniRead (
00225          INIHANDLE IniHandle,
00226          const char *IniGroup,
00227          const char *IniName
00228          );
00229 
00230       void IniWrite (
00231          INIHANDLE IniHandle,
00232          const char *IniGroup,
00233          const char *IniName
00234          ) const;
00235 
00236       bool IsMaximized (
00237          ) const { return (m_IsMaximized); };
00238 
00239       void SetMaximized (
00240          bool Maximized
00241          ) { m_IsMaximized = Maximized; }
00242 
00243       void SetNormalPosition (
00244          const LRECT2D& NormalPosition
00245          ) { m_NormalPosition = NormalPosition; }
00246 
00247    private:
00248       #ifndef GENERATING_DOXYGEN_OUTPUT
00249       bool m_IsMaximized;
00250       LRECT2D m_NormalPosition;
00251       #endif // GENERATING_DOXYGEN_OUTPUT
00252    };
00253 
00254 }  // End namespace MGUI
00255 
00256 #endif   // INC_MGUI_SHELL_H

Generated on Tue Dec 14 13:18:18 2004 for TNTsdk by  doxygen 1.3.8-20040913