1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Class ToolFrame is defined in a header, methods out of line

This commit is contained in:
Paul Licameli 2016-06-28 19:56:16 -04:00
parent f2a262e9d6
commit b29cc8ae48
2 changed files with 213 additions and 186 deletions

View File

@ -79,11 +79,8 @@
//
// Constructor
//
class ToolFrame final : public wxFrame
{
public:
ToolFrame( wxWindow *parent, ToolManager *manager, ToolBar *bar, wxPoint pos )
ToolFrame::ToolFrame
( wxWindow *parent, ToolManager *manager, ToolBar *bar, wxPoint pos )
: wxFrame( parent,
bar->GetId(),
wxEmptyString,
@ -157,25 +154,19 @@ class ToolFrame final : public wxFrame
}
}
~ToolFrame()
ToolFrame::~ToolFrame()
{
if(HasCapture())
ReleaseMouse();
}
//
// Transition a toolbar from float to dragging
//
void OnGrabber( GrabberEvent & event )
void ToolFrame::OnGrabber( GrabberEvent & event )
{
// Pass it on to the manager since it isn't in the handling hierarchy
mManager->ProcessEvent( event );
}
//
// Handle toolbar updates
//
void OnToolBarUpdate( wxCommandEvent & event )
void ToolFrame::OnToolBarUpdate( wxCommandEvent & event )
{
// Resize floater window to exactly contain toolbar
mBar->GetParent()->SetClientSize( mBar->GetMinSize() );
@ -184,10 +175,7 @@ class ToolFrame final : public wxFrame
event.Skip();
}
//
// Handle frame paint events
//
void OnPaint( wxPaintEvent & WXUNUSED(event) )
void ToolFrame::OnPaint( wxPaintEvent & WXUNUSED(event) )
{
wxPaintDC dc( this );
wxSize sz = GetSize();
@ -217,7 +205,7 @@ class ToolFrame final : public wxFrame
}
void OnMotion( wxMouseEvent & event )
void ToolFrame::OnMotion( wxMouseEvent & event )
{
// Don't do anything if we're docked or not resizeable
if( mBar->IsDocked() || !mBar->IsResizable() )
@ -276,7 +264,7 @@ class ToolFrame final : public wxFrame
}
}
void OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
void ToolFrame::OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
{
if( HasCapture() )
{
@ -284,16 +272,12 @@ class ToolFrame final : public wxFrame
}
}
//
// Do not allow the window to close through keyboard accelerators
// (like ALT+F4 on Windows)
//
void OnClose( wxCloseEvent & event )
void ToolFrame::OnClose( wxCloseEvent & event )
{
event.Veto();
}
void OnKeyDown( wxKeyEvent &event )
void ToolFrame::OnKeyDown( wxKeyEvent &event )
{
event.Skip();
if( HasCapture() && event.GetKeyCode() == WXK_ESCAPE ) {
@ -302,7 +286,7 @@ class ToolFrame final : public wxFrame
}
}
void Resize( const wxSize &size )
void ToolFrame::Resize( const wxSize &size )
{
SetMinSize( size );
SetSize( size );
@ -310,20 +294,6 @@ class ToolFrame final : public wxFrame
Refresh( false );
}
private:
wxWindow *mParent;
ToolManager *mManager;
ToolBar *mBar;
wxSize mMinSize;
wxSize mOrigSize;
public:
DECLARE_CLASS( ToolFrame );
DECLARE_EVENT_TABLE();
};
IMPLEMENT_CLASS( ToolFrame, wxFrame );
BEGIN_EVENT_TABLE( ToolFrame, wxFrame )

View File

@ -125,4 +125,61 @@ class ToolManager final : public wxEvtHandler
DECLARE_EVENT_TABLE();
};
////////////////////////////////////////////////////////////
/// class ToolFrame
////////////////////////////////////////////////////////////
class ToolFrame final : public wxFrame
{
public:
ToolFrame( wxWindow *parent, ToolManager *manager, ToolBar *bar, wxPoint pos );
~ToolFrame();
//
// Transition a toolbar from float to dragging
//
void OnGrabber( GrabberEvent & event );
//
// Handle toolbar updates
//
void OnToolBarUpdate( wxCommandEvent & event );
//
// Handle frame paint events
//
void OnPaint( wxPaintEvent & WXUNUSED(event) );
void OnMotion( wxMouseEvent & event );
void OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) );
//
// Do not allow the window to close through keyboard accelerators
// (like ALT+F4 on Windows)
//
void OnClose( wxCloseEvent & event );
void OnKeyDown( wxKeyEvent &event );
void Resize( const wxSize &size );
private:
wxWindow *mParent;
ToolManager *mManager;
ToolBar *mBar;
wxSize mMinSize;
wxSize mOrigSize;
public:
DECLARE_CLASS( ToolFrame );
DECLARE_EVENT_TABLE();
};
#endif