|
From: Emilien K. <cur...@us...> - 2005-03-17 14:37:53
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31889/src Modified Files: Application.cpp Frame.cpp MainFrame.cpp Log Message: Gestionnaire de barres de travail (WorkBar*). Index: Frame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Frame.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Frame.cpp 23 Feb 2005 15:12:14 -0000 1.3 --- Frame.cpp 17 Mar 2005 14:37:42 -0000 1.4 *************** *** 86,89 **** --- 86,90 ---- m_bHasViewMenu(false) { + wxGetApp().GetWorkBarManager().RegisterFrame(this); } *************** *** 114,117 **** --- 115,125 ---- } + // Surcharge du processus de destruction. + bool TopFrame::Destroy() + { + wxGetApp().GetWorkBarManager().UnregisterFrame(this); + return wxFrame::Destroy(); + } + ////////////////////////////////////////////////////////////////////// // ViewFrame Index: Application.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Application.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Application.cpp 16 Mar 2005 14:27:36 -0000 1.17 --- Application.cpp 17 Mar 2005 14:37:41 -0000 1.18 *************** *** 47,50 **** --- 47,66 ---- + class TestBar : public WorkBar + { + DECLARE_DYNAMIC_CLASS(TestBar); + public: + virtual bool Create(wxWindow* parent) + { + WorkBar::Create(parent); + new wxButton(this, -1, wxT("Blablabla")); + return true; + } + }; + + IMPLEMENT_DYNAMIC_CLASS(TestBar, WorkBar) + + + bool Application::OnInit(void) { *************** *** 57,69 **** SetVendorName(WXDC_SETUP_VENDOR); ! // Initialise le gestionnaire de configuration. m_ConfigManager.Initialize(); - m_ConfigManager.CreateUserProfile(); - - // Initialise le DocManager m_DocManager.Initialize(); - - // Initialise le ProjectManager m_ProjectManager.Initialize(); // Charge les plugins. --- 73,85 ---- SetVendorName(WXDC_SETUP_VENDOR); ! // Initialise les gestionnaires m_ConfigManager.Initialize(); m_DocManager.Initialize(); m_ProjectManager.Initialize(); + m_WorkBarManager.Initialize(); + + // Crée la config utilisateur. + m_ConfigManager.CreateUserProfile(); + // Charge les plugins. *************** *** 88,91 **** --- 104,112 ---- m_pMainFrame->Show(true); + + + // Test des worksbars. + m_WorkBarManager.RegisterWorkBar(CLASSINFO(TestBar), "tchock !", ""); + // Lance l'application. return true; Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MainFrame.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MainFrame.cpp 16 Mar 2005 14:27:37 -0000 1.7 --- MainFrame.cpp 17 Mar 2005 14:37:42 -0000 1.8 *************** *** 30,33 **** --- 30,34 ---- #include <wxDevCenter/FileSystem.h> #include <wxDevCenter/DocView.h> + #include <wxDevCenter/WorkBar.h> #include <wx/dataobj.h> *************** *** 549,551 **** --- 550,590 ---- + ////////////////////////////////////////////////////////////////////// + // Fonctions de gestion des WorkBar + ////////////////////////////////////////////////////////////////////// + + // Ajoute une fenetre comme barre de travail. + bool MainFrame::AddWorkBar(WorkBar* pWorkBar, wxString strName) + { + pWorkBar->Create(this); + + // drop in some bars + cbDimInfo sizes( 160, 220, // when docked horizontally + 220, 160, // when docked vertically + 160, 220, // when floated + FALSE, // the bar is not fixed-size + 4, // vertical gap (bar border) + 4 // horizontal gap (bar border) + ); + m_pFrameLayout->AddBar( (wxWindow*)pWorkBar, // bar window + sizes, FL_ALIGN_LEFT, // alignment ( 0-top,1-bottom, etc) + 0, // insert into 0th row (vert. position) + 0, // offset from the start of row (in pixels) + strName, // name for reference in customization pop-ups + FALSE + ); + return true; + } + + // Retire une fenetre de barre de travail. + bool MainFrame::RemoveWorkBar(WorkBar* pWorkBar) + { + cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)pWorkBar); + if(pBI!=NULL) + { + m_pFrameLayout->RemoveBar(pBI); + return true; + } + return false; + } |