|
From: Emilien K. <cur...@us...> - 2005-08-02 17:13:51
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21533/src Modified Files: MainFrame.cpp Log Message: Utilisation de wxDockIt à la place de wxFrameLayout pour l'integration des workbars. Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/MainFrame.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MainFrame.cpp 2 Aug 2005 12:50:54 -0000 1.16 --- MainFrame.cpp 2 Aug 2005 17:13:01 -0000 1.17 *************** *** 36,56 **** #include <wx/sashwin.h> ! ! ! ! // fl headers ! #include <wx/fl/controlbar.h> // core API ! // extra plugins ! #include <wx/fl/barhintspl.h> // bevel for bars with "X"s and grooves ! #include <wx/fl/rowdragpl.h> // NC-look with draggable rows ! #include <wx/fl/cbcustom.h> // customization plugin ! #include <wx/fl/hintanimpl.h> ! ! // beauty-care ! #include <wx/fl/gcupdatesmgr.h> // smooth d&d ! #include <wx/fl/antiflickpl.h> // double-buffered repaint of decorations ! #include <wx/fl/dyntbar.h> // auto-layout toolbar ! #include <wx/fl/dyntbarhnd.h> // control-bar dimension handler for it ! --- 36,43 ---- #include <wx/sashwin.h> ! // wxdockit includes ! #include <wx/layoutmanager.h> ! #include <wx/dockwindow.h> ! #include <wx/dockhost.h> *************** *** 91,97 **** EVT_MENU(IDM_HELP_ABOUT , MainFrame::OnMenuHelpAbout) - EVT_MENU_RANGE(IDM_WINDOW_WORKBAR_FIRST, IDM_WINDOW_WORKBAR_LAST, MainFrame::OnWorkBarMenu) - EVT_UPDATE_UI_RANGE(IDM_WINDOW_WORKBAR_FIRST, IDM_WINDOW_WORKBAR_LAST, MainFrame::OnUpdateWorkBarMenu) - EVT_UPDATE_UI(IDM_PROJECT_CLOSE , MainFrame::OnUpdateProjectClose) EVT_UPDATE_UI(IDM_FILE_CLOSE , MainFrame::OnUpdateWhenHasDoc) --- 78,81 ---- *************** *** 110,114 **** MainFrame::MainFrame(void): TopFrame(WXDC_NAME, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN), ! m_pFrameLayout(NULL), m_WorkBarArray(), m_pGlobalSizer(NULL), --- 94,98 ---- MainFrame::MainFrame(void): TopFrame(WXDC_NAME, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN), ! m_pLayoutManager(NULL), m_WorkBarArray(), m_pGlobalSizer(NULL), *************** *** 116,124 **** m_pMenuItemWorkBar(NULL) { - // Création de la barre de status. - SetStatusBar(new StatusBar(this)); - - // Création de la barre des menu puis réinitialisation de celle-ci - BuildMenu(); // Création de la fenetre cadre cliente. --- 100,103 ---- *************** *** 126,137 **** SetViewFrame(pChild); ! m_pFrameLayout = new wxFrameLayout(this, pChild); ! m_pFrameLayout->SetUpdatesManager( new cbGCUpdatesMgr() ); ! ! // setup plugins for testing ! m_pFrameLayout->PushDefaultPlugins(); ! m_pFrameLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars ! m_pFrameLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) ); ! m_pFrameLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) ); // Chargement de l'icone de l'application. --- 105,112 ---- SetViewFrame(pChild); ! // Création du wxDockIt's layout manager. ! m_pLayoutManager = new wxLayoutManager( this ); ! m_pLayoutManager->AddDefaultHosts(); ! m_pLayoutManager->SetLayout( wxDWF_LIVE_UPDATE|wxDWF_SPLITTER_BORDERS, pChild ); // Chargement de l'icone de l'application. *************** *** 139,142 **** --- 114,123 ---- SetIcon(m_Icon); + // Création de la barre de status. + SetStatusBar(new StatusBar(this)); + + // Création de la barre des menu puis réinitialisation de celle-ci + BuildMenu(); + SetDropTarget(new MainFrameDropTarget); } *************** *** 430,450 **** wxSize sz = pWorkBar->GetMinSize(); ! // drop in some bars ! cbDimInfo sizes( sz.x, sz.y, // when docked horizontally ! sz.x, sz.y, // when docked vertically ! sz.x, sz.y, // 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 - ); m_WorkBarArray.Register(pWorkBar); RebuildWorkBarMenu(); return true; --- 411,426 ---- wxSize sz = pWorkBar->GetMinSize(); ! wxDockWindow *pDockWindow = new wxDockWindow(this, wxID_ANY, strName, wxPoint(64, 64), sz, strName); ! pDockWindow->SetClient(pWorkBar); ! m_pLayoutManager->AddDockWindow(pDockWindow); ! ! wxHostInfo HostInfo = m_pLayoutManager->GetDockHost(wxDEFAULT_LEFT_HOST); ! m_pLayoutManager->DockWindow(pDockWindow, HostInfo); ! ! pWorkBar->SetExtraData(pDockWindow); m_WorkBarArray.Register(pWorkBar); + + RebuildWorkBarMenu(); return true; *************** *** 454,461 **** bool MainFrame::RemoveWorkBar(WorkBar* pWorkBar) { ! cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)pWorkBar); ! if(pBI!=NULL) { ! m_pFrameLayout->RemoveBar(pBI); m_WorkBarArray.Unregister(pWorkBar); RebuildWorkBarMenu(); --- 430,436 ---- bool MainFrame::RemoveWorkBar(WorkBar* pWorkBar) { ! if(pWorkBar->GetExtraData()!=NULL) { ! m_pLayoutManager->UndockWindow((wxDockWindowBase*)pWorkBar->GetExtraData()); m_WorkBarArray.Unregister(pWorkBar); RebuildWorkBarMenu(); *************** *** 469,513 **** { wxMenu *pMenu = m_pMenuItemWorkBar->GetSubMenu(); - if(pMenu) - { - while(pMenu->GetMenuItemCount()>0) - { - wxMenuItem* pChildItem = pMenu->FindItemByPosition(0); - pMenu->Destroy(pChildItem); - } ! for(unsigned int i=0; i<m_WorkBarArray.GetCount(); i++) ! { ! pMenu->Append(IDM_WINDOW_WORKBAR_FIRST+i, m_WorkBarArray.Item(i).GetName(), wxT(""), wxITEM_CHECK); ! } ! } ! } ! ! // Intercepte la mise à jour des menus de workbar. ! void MainFrame::OnUpdateWorkBarMenu(wxUpdateUIEvent& event) ! { ! cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)&m_WorkBarArray.Item(event.GetId()-IDM_WINDOW_WORKBAR_FIRST)); ! if(pBI) ! event.Check( !(pBI->mState==wxCBAR_HIDDEN) ); ! else ! event.Enable(false); ! } ! ! // Intercepte un menu de workbar. ! void MainFrame::OnWorkBarMenu(wxCommandEvent& event) ! { ! cbBarInfo* pBI = m_pFrameLayout->FindBarByWindow((wxWindow*)&m_WorkBarArray.Item(event.GetId()-IDM_WINDOW_WORKBAR_FIRST)); ! if(pBI) ! m_pFrameLayout->InverseVisibility(pBI); } - /** Force la mise à jour de la fenetre via les wxUpdateUIEvent.*/ void MainFrame::UpdateWindowUI(long flags) { wxFrame::UpdateWindowUI(flags); - - for(unsigned long l=0; l<m_WorkBarArray.GetCount(); l++) - m_WorkBarArray[l].UpdateWindowUI(flags); - } --- 444,454 ---- { wxMenu *pMenu = m_pMenuItemWorkBar->GetSubMenu(); ! m_pLayoutManager->SetWindowMenu(pMenu); } /** Force la mise à jour de la fenetre via les wxUpdateUIEvent.*/ void MainFrame::UpdateWindowUI(long flags) { wxFrame::UpdateWindowUI(flags); } |