|
From: Emilien K. <cur...@us...> - 2005-09-14 14:19:19
|
Update of /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30551/include/wxDevCenter Modified Files: Frame.h MDIFrame.h Command.h Application.h Added Files: Layout.h Log Message: Add Command support (menu/toolbar unification). Add begining of layout support. Index: Command.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/Command.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Command.h 28 Aug 2005 15:57:10 -0000 1.1 --- Command.h 14 Sep 2005 14:19:10 -0000 1.2 *************** *** 31,34 **** --- 31,36 ---- { + class Layout; + class CommandGroup; *************** *** 51,58 **** /** Kind of command.*/ wxItemKind m_kind; - /** Is check.*/ - bool m_isChecked; - /** Is enable.*/ - bool m_isEnabled; public: /** Default constructor.*/ --- 53,56 ---- *************** *** 61,65 **** Command(const Command& cmd); /** Constructor.*/ ! Command(int iID, CommandGroup* pGroup, CommandGroup* pSubGroup, wxString strLabel, wxString strHelp, wxString strIconName, wxItemKind kind, bool isChecked, bool isEnabled); int GetID()const{return m_iID;} --- 59,66 ---- Command(const Command& cmd); /** Constructor.*/ ! Command(int iID, CommandGroup* pGroup, CommandGroup* pSubGroup, wxString strLabel, wxString strHelp, wxString strIconName, wxItemKind kind); ! ! /** Direct init constructor.*/ ! Command(int iID, wxString strLabel, wxString strHelp, wxString strIconName, wxItemKind kind); int GetID()const{return m_iID;} *************** *** 70,75 **** wxString GetIconName()const{return m_strIconName;} wxItemKind GetKind()const{return m_kind;} - bool IsChecked()const{return m_isChecked;} - bool IsEnabled()const{return m_isEnabled;} void SetID(int iID){m_iID = iID;} --- 71,74 ---- *************** *** 80,88 **** void SetIconName(wxString strIconName){m_strIconName = strIconName;} void SetKind(wxItemKind kind){m_kind = kind;} - void Check(bool isChecked){m_isChecked = isChecked;} - void Enable(bool isEnable){m_isEnabled = isEnable;} /** Create a menu item corrsponding to the command.*/ ! wxMenuItem* CreateMenuItem()const; }; --- 79,85 ---- void SetIconName(wxString strIconName){m_strIconName = strIconName;} void SetKind(wxItemKind kind){m_kind = kind;} /** Create a menu item corrsponding to the command.*/ ! wxMenuItem* CreateMenuItem(wxMenu* pMenu)const; }; *************** *** 90,101 **** enum CommandGroupType { ! Unknow = -1, ! Autodetect, ! Application, ! Workspace, ! Project, ! Document, ! View, ! WorkBar }; --- 87,101 ---- enum CommandGroupType { ! CmdGrpType_Unknow = -1, ! CmdGrpType_Autodetect, ! CmdGrpType_Application, ! CmdGrpType_Document, ! CmdGrpType_View, ! CmdGrpType_WorkBar, ! CmdGrpType_Project, ! CmdGrpType_Workspace, ! CmdGrpType_Frame, ! CmdGrpType_Help, ! CommandGroupNumber }; *************** *** 111,115 **** public: ! CommandGroup(wxString strLabel=wxT(""), wxString strIconName=wxT("")); CommandGroupType GetType()const{return m_Type;} --- 111,120 ---- public: ! /** Standard constructor. ! * @param strLabel Label of the command group. ! * @param strIconName Name of the icon. ! * @param pCommands Address of command array to attach. ! * @param nbCommands Number of command in the array to attach.*/ ! CommandGroup(wxString strLabel=wxT(""), wxString strIconName=wxT(""), Command* pCommands=NULL, long nbCommands=0); CommandGroupType GetType()const{return m_Type;} *************** *** 125,131 **** /** Append a command.*/ ! Command* AppendCommand(int ID, wxString strLabel, wxString strHelp, wxString strIconName); /** Append a checkable command.*/ ! Command* AppendChechCommand(int ID, wxString strLabel, wxString strHelp, wxString strIconName, bool isChecked); /** Append a separator.*/ Command* AppendSeparator(); --- 130,136 ---- /** Append a command.*/ ! Command* AppendCommand(int ID, wxString strLabel, wxString strHelp=wxT(""), wxString strIconName=wxT("")); /** Append a checkable command.*/ ! Command* AppendChechCommand(int ID, wxString strLabel, wxString strHelp=wxT(""), wxString strIconName=wxT("")); /** Append a separator.*/ Command* AppendSeparator(); *************** *** 133,149 **** Command* AppendSubGroup(int ID, CommandGroup* pSubGroup); ! /** Create a menu corrsponding to the command.*/ wxMenu* CreateMenu()const; }; /** Gestionnaire de commandes.*/ ! class WXDC_DLL_BASE CommandManager : protected ObjectManager<CommandGroup> { public: CommandManager(); /** Ajoute un groupe de commandes.*/ ! bool AddCommandManager(CommandGroup* pGroup, wxClassInfo* pRefClassInfo, CommandGroupType Type=Autodetect); }; --- 138,183 ---- Command* AppendSubGroup(int ID, CommandGroup* pSubGroup); ! /** Create a menu corresponding to the command.*/ wxMenu* CreateMenu()const; }; + /***** + * SelfRegisteredCommandGroup + *****/ + class WXDC_DLL_BASE SelfRegisteredCommandGroup : public CommandGroup + { + public: + /** Standard constructor. + * @param pRefClassInfo ClassInfo of attached class. + * @param Type Type of CommandGroup. + * @param strLabel Label of the command group. + * @param strIconName Name of the icon. + * @param pCommands Address of command array to attach. + * @param nbCommands Number of command in the array to attach.*/ + SelfRegisteredCommandGroup(wxClassInfo* pRefClassInfo, CommandGroupType Type, wxString strLabel, wxString strIconName, Command* pCommands, long nbCommands); + }; + /** Gestionnaire de commandes.*/ ! class WXDC_DLL_BASE CommandManager : public wxObject { + private: + /** Le seul et unique gestionnaire de commandes.*/ + static CommandManager s_CommandManager; + + protected: + /** Tableaux des Groupes de commandes. Un par type de groupe.*/ + ObjectManager<CommandGroup> m_CommandGroups[CommandGroupNumber]; public: + // Retourne le CommandManager. + static CommandManager& GetCommandManager(){return s_CommandManager;} + CommandManager(); /** Ajoute un groupe de commandes.*/ ! bool AddCommandManager(CommandGroup* pGroup, wxClassInfo* pRefClassInfo, CommandGroupType Type=CmdGrpType_Autodetect); ! ! /** Peuple une barre de menu.*/ ! bool PopulateMenuBar(wxMenuBar* pMenuBar, const Layout& layout); }; Index: Application.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/Application.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Application.h 26 Aug 2005 08:35:58 -0000 1.16 --- Application.h 14 Sep 2005 14:19:10 -0000 1.17 *************** *** 248,261 **** /** @} */ ! /** Initialise la ligne de commande. * @param parser Parseur de ligne de commande. */ void OnInitCmdLine(wxCmdLineParser& parser); - /** Parse la ligne de commande pour récupérer toutes les options voulues. * @param parser Parseur de ligne de commande. */ bool OnCmdLineParsed(wxCmdLineParser& parser); }; --- 248,265 ---- /** @} */ ! /** @name CmdLine ! * @{ */ /** Initialise la ligne de commande. * @param parser Parseur de ligne de commande. */ void OnInitCmdLine(wxCmdLineParser& parser); /** Parse la ligne de commande pour récupérer toutes les options voulues. * @param parser Parseur de ligne de commande. */ bool OnCmdLineParsed(wxCmdLineParser& parser); + /* @} */ + + /** Initie les groupes de commandes de l'application.*/ + void InitCommandGroups(); }; Index: Frame.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/Frame.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Frame.h 26 Aug 2005 08:35:58 -0000 1.11 --- Frame.h 14 Sep 2005 14:19:10 -0000 1.12 *************** *** 32,35 **** --- 32,37 ---- #define __WXDEVCENTER_FRAME + #include <wxDevCenter/Layout.h> + namespace wxDevCenter { *************** *** 201,205 **** void SetViewFrame(ViewFrame* pViewFrame){m_pViewFrame = pViewFrame;} /** Retourne la fenetre cadre fille des vues.*/ ! ViewFrame* GetViewFrame(){return m_pViewFrame;} --- 203,207 ---- void SetViewFrame(ViewFrame* pViewFrame){m_pViewFrame = pViewFrame;} /** Retourne la fenetre cadre fille des vues.*/ ! ViewFrame* GetViewFrame()const{return m_pViewFrame;} *************** *** 220,223 **** --- 222,230 ---- virtual bool ShowWorkBar(WorkBar* WXUNUSED(pWorkBar), bool WXUNUSED(bShow)){return false;} + + /** Retourne le layout attaché à la fenetre. + * @return Layout.*/ + virtual wxDevCenter::Layout GetLayout(); + /** Surcharge du processus de destruction. * Utilisé pour vider le cadre de ses WorkBar et la désenregistrer du WorkBarManager.*/ *************** *** 254,257 **** --- 261,266 ---- virtual void RemoveView(View *pView)=0; + + virtual View* GetCurrentView()const=0; }; Index: MDIFrame.h =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/include/wxDevCenter/MDIFrame.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MDIFrame.h 4 Apr 2005 08:11:21 -0000 1.6 --- MDIFrame.h 14 Sep 2005 14:19:10 -0000 1.7 *************** *** 71,74 **** --- 71,76 ---- virtual bool CanProcessEventFromParent(); + virtual View* GetCurrentView()const; + }; --- NEW FILE: Layout.h --- /** * @file wxDevCenter/Layout.h * @author Cursor * * @brief Class declaration for layout management (toolbar, workbar ...). */ // // wxDevCenter // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; only version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. #ifndef __WXDEVCENTER_LAYOUT #define __WXDEVCENTER_LAYOUT namespace wxDevCenter { class TopFrame; /** Layout descriptor.*/ class WXDC_DLL_BASE Layout : public wxObject { protected: /** Current project class name.*/ wxString m_strProjectClass; /** Current document class name.*/ wxString m_strDocClass; /** Current view class name.*/ wxString m_strViewClass; /** Current workbars.*/ wxArrayString m_arstrWorkbarClass; public: Layout(); Layout(const Layout& layout); Layout(const TopFrame* pFrame); virtual ~Layout(); void SetProjectClass(wxString strProjectClass){m_strProjectClass = strProjectClass;} void SetDocClass(wxString strDocClass){m_strDocClass = strDocClass;} void SetViewClass(wxString strViewClass){m_strViewClass = strViewClass;} void AddWorkbarClass(wxString strWorkBarClass){m_arstrWorkbarClass.Add(strWorkBarClass);} void RemoveWorkbarClass(wxString strWorkBarClass){if(m_arstrWorkbarClass.Index(strWorkBarClass)!=wxNOT_FOUND)m_arstrWorkbarClass.Remove(strWorkBarClass);} wxString GetProjectClass()const{return m_strProjectClass;} wxString GetDocClass()const{return m_strDocClass;} wxString GetViewClass()const{return m_strViewClass;} const wxArrayString& GetWorkBarClass()const{return m_arstrWorkbarClass;} bool IsProjectClass(wxString strProjectClass)const{return m_strProjectClass == strProjectClass;} bool IsDocClass(wxString strDocClass)const{return m_strDocClass == strDocClass;} bool IsViewClass(wxString strViewClass)const{return m_strViewClass == strViewClass;} bool HasWorkBarClass(wxString strWorkBarClass)const{return m_arstrWorkbarClass.Index(strWorkBarClass)!=wxNOT_FOUND;} protected: /** Initialise Layout from a frame.*/ void InitFromTopFrame(const TopFrame* pFrame); }; /** * Layout manager. */ class LayoutManager : public wxObject { public: LayoutManager(); virtual ~LayoutManager(); }; } #endif /*__WXDEVCENTER_LAYOUT*/ |