// // Destructer // ToolManager::~ToolManager() { // Save the toolbar states WriteConfig(); // Remove handlers from parent mParent->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Disconnect( wxEVT_MOTION, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Disconnect( wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler( ToolManager::OnCaptureLost ), NULL, this ); // Remove our event handlers mIndicator->Disconnect( wxEVT_CREATE, wxWindowCreateEventHandler( ToolManager::OnIndicatorCreate ), NULL, this ); mIndicator->Disconnect( wxEVT_PAINT, wxPaintEventHandler( ToolManager::OnIndicatorPaint ), NULL, this ); }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); // All dialogs should really have this style style |= wxTAB_TRAVERSAL; if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; if ( !m_hasFont ) SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); if ( HasFlag(wxRESIZE_BORDER) ) { CreateGripper(); Connect(wxEVT_CREATE, wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); } return true; }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); // All dialogs should really have this style style |= wxTAB_TRAVERSAL; if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; if ( !m_hasFont ) SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #if defined(__SMARTPHONE__) && defined(__WXWINCE__) SetLeftMenu(wxID_OK, _("OK")); #endif #if wxUSE_TOOLBAR && defined(__POCKETPC__) CreateToolBar(); #endif #if wxUSE_DIALOG_SIZEGRIP if ( HasFlag(wxRESIZE_BORDER) ) { CreateGripper(); Connect(wxEVT_CREATE, wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); } #endif // wxUSE_DIALOG_SIZEGRIP return true; }
// // Destructer // ToolManager::~ToolManager() { // Save the toolbar states WriteConfig(); // Remove handlers from parent mParent->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Disconnect( wxEVT_MOTION, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Disconnect( wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler( ToolManager::OnCaptureLost ), NULL, this ); // Remove our event handlers mIndicator->Disconnect( wxEVT_CREATE, wxWindowCreateEventHandler( ToolManager::OnIndicatorCreate ), NULL, this ); mIndicator->Disconnect( wxEVT_PAINT, wxPaintEventHandler( ToolManager::OnIndicatorPaint ), NULL, this ); // Must destroy the window since it doesn't have a parent mIndicator->Destroy(); // Delete the indicator regions delete mLeft; delete mDown; }
// // Constructor // ToolManager::ToolManager( AudacityProject *parent ) : wxEvtHandler() { wxPoint pt[ 3 ]; #if defined(__WXMAC__) // Save original transition mTransition = wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ); #endif // Initialize everything mParent = parent; mLastPos.x = mBarPos.x = -1; mLastPos.y = mBarPos.y = -1; mDragWindow = NULL; mDragDock = NULL; mDragBar = NULL; // Create the down arrow pt[ 0 ].x = 0; pt[ 0 ].y = 0; pt[ 1 ].x = 9; pt[ 1 ].y = 9; pt[ 2 ].x = 18; pt[ 2 ].y = 0; // Create the shaped region mDown = new wxRegion( 3, &pt[0] ); // Create the down arrow pt[ 0 ].x = 9; pt[ 0 ].y = 0; pt[ 1 ].x = 0; pt[ 1 ].y = 9; pt[ 2 ].x = 9; pt[ 2 ].y = 18; // Create the shaped region mLeft = new wxRegion( 3, &pt[0] ); // Create the indicator frame mIndicator = new wxFrame( NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 32, 32 ), wxFRAME_TOOL_WINDOW | wxFRAME_SHAPED | wxNO_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP ); // Hook the creation event...only needed on GTK, but doesn't hurt for all mIndicator->Connect( wxEVT_CREATE, wxWindowCreateEventHandler( ToolManager::OnIndicatorCreate ), NULL, this ); // Hook the paint event...needed for all mIndicator->Connect( wxEVT_PAINT, wxPaintEventHandler( ToolManager::OnIndicatorPaint ), NULL, this ); // It's a little shy mIndicator->Hide(); // Hook the parents mouse events...using the parent helps greatly // under GTK mParent->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Connect( wxEVT_MOTION, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Connect( wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler( ToolManager::OnCaptureLost ), NULL, this ); // Create the top and bottom docks mTopDock = new ToolDock( this, mParent, TopDockID ); mBotDock = new ToolDock( this, mParent, BotDockID ); // Create all of the toolbars mBars[ ToolsBarID ] = new ToolsToolBar(); mBars[ TransportBarID ] = new ControlToolBar(); mBars[ MeterBarID ] = new MeterToolBar(); mBars[ EditBarID ] = new EditToolBar(); mBars[ MixerBarID ] = new MixerToolBar(); mBars[ TranscriptionBarID ] = new TranscriptionToolBar(); mBars[ SelectionBarID ] = new SelectionBar(); mBars[ DeviceBarID ] = new DeviceToolBar(); // We own the timer mTimer.SetOwner( this ); // Process the toolbar config settings ReadConfig(); }