X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ae76072f1a33be41f8ea8ba9171c5470df154a0..25088f1eea365f0da7aeb565932dd4fe0fd5d20e:/contrib/src/fl/toolwnd.cpp?ds=sidebyside diff --git a/contrib/src/fl/toolwnd.cpp b/contrib/src/fl/toolwnd.cpp index 4a97f944ca..6eeb02f0a6 100644 --- a/contrib/src/fl/toolwnd.cpp +++ b/contrib/src/fl/toolwnd.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: No names yet. -// Purpose: Contrib. demo +// Name: toolwnd.cpp +// Purpose: wxToolWindow implementation. // Author: Aleksandras Gluchovas // Modified by: // Created: 06/09/98 // RCS-ID: $Id$ // Copyright: (c) Aleksandras Gluchovas -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -41,9 +41,9 @@ static const unsigned char _gCheckerImg[16] = { _IMG_A,_IMG_B,_IMG_C,_IMG_D, /***** Implementation for class wxToolWindow *****/ -IMPLEMENT_DYNAMIC_CLASS( wxToolWindow, wxWindow ) +IMPLEMENT_DYNAMIC_CLASS( wxToolWindow, wxFrame) -BEGIN_EVENT_TABLE( wxToolWindow, wxWindow ) +BEGIN_EVENT_TABLE( wxToolWindow, wxFrame ) EVT_PAINT ( wxToolWindow::OnPaint ) EVT_MOTION ( wxToolWindow::OnMotion ) @@ -81,7 +81,7 @@ wxToolWindow::wxToolWindow() mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL ), #else // just to simulate MS-Dev style - mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL, FALSE, "MS Sans Serif" ), + mTitleFont( 8, wxSWISS, wxNORMAL, wxNORMAL, FALSE, wxT("MS Sans Serif") ), #endif mTitleHeight ( 16 ), @@ -157,7 +157,7 @@ void wxToolWindow::AddMiniButton( cbMiniButton* pBtn ) //LayoutMiniButtons(); } -void wxToolWindow::OnPaint( wxPaintEvent& event ) +void wxToolWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) { wxPaintDC pdc( this ); wxWindowDC dc( this ); @@ -165,15 +165,17 @@ void wxToolWindow::OnPaint( wxPaintEvent& event ) int w,h; GetSize( &w, &h ); - dc.SetBrush( *wxLIGHT_GREY_BRUSH ); - dc.SetPen( *wxTRANSPARENT_PEN ); + wxBrush backGround( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID ); + //dc.SetBrush( *wxLIGHT_GREY_BRUSH ); + dc.SetBrush( backGround ); + dc.SetPen( *wxTRANSPARENT_PEN ); - int y = mWndVertGap + mTitleHeight + mClntVertGap + 1; - dc.DrawRectangle( 0,0, w, y ); - dc.DrawRectangle( 0,y-1, mWndHorizGap + mClntHorizGap + 1, h - y ); - dc.DrawRectangle( w - ( mWndHorizGap + mClntHorizGap ), y-1, - mWndHorizGap + mClntHorizGap, h - y ); - dc.DrawRectangle( 0, h - mWndVertGap - mClntVertGap, w, mWndVertGap + mClntVertGap ); + int y = mWndVertGap + mTitleHeight + mClntVertGap; + dc.DrawRectangle( 0,0, w, y ); // Top grey part. + dc.DrawRectangle( 0,y-1, mWndHorizGap + mClntHorizGap, h - y ); // Left grey part. + dc.DrawRectangle( w - ( mWndHorizGap + mClntHorizGap ), y-1, + mWndHorizGap + mClntHorizGap, h - y ); // Right grey part. + dc.DrawRectangle( 0, h - mWndVertGap - mClntVertGap, w, mWndVertGap + mClntVertGap ); // Bottom grey part. // draw shades dc.SetPen( *wxLIGHT_GREY_PEN ); @@ -336,21 +338,20 @@ void wxToolWindow::DrawHintRect( const wxRect& r ) void wxToolWindow::SetHintCursor( int type ) { - if ( mResizeStarted ) return; + if ( mResizeStarted ) + return; if ( type == HITS_WND_NOTHING || type == HITS_WND_CLIENT ) { // the cursor is out of window - reset to arrow - if ( mMouseCaptured && !mResizeStarted ) + if ( mMouseCaptured ) { ReleaseMouse(); mMouseCaptured = FALSE; } - if ( mCursorType == HITS_WND_NOTHING && !mResizeStarted ) - - SetCursor( wxCURSOR_ARROW ); + SetCursor( wxCURSOR_ARROW ); mCursorType = type; @@ -496,7 +497,7 @@ void wxToolWindow::CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& } else { - wxFAIL( _T("what did the cursor hit?") ); + wxFAIL_MSG( _T("what did the cursor hit?") ); } rect.x = left; @@ -570,6 +571,8 @@ void wxToolWindow::OnMotion( wxMouseEvent& event ) { DrawHintRect( mPrevHintRect ); DrawHintRect( finalRect ); + + ::wxLogTrace(wxT("%d,%d / %d,%d\n"), finalRect.x, finalRect.y, finalRect.width, finalRect.height); } mPrevHintRect = finalRect; @@ -669,7 +672,7 @@ void wxToolWindow::OnLeftUp( wxMouseEvent& event ) } } -void wxToolWindow::OnSize( wxSizeEvent& event ) +void wxToolWindow::OnSize( wxSizeEvent& WXUNUSED(event) ) { if ( mpClientWnd ) { @@ -679,14 +682,12 @@ void wxToolWindow::OnSize( wxSizeEvent& event ) int x = mWndHorizGap + mClntHorizGap; int y = mWndVertGap + mTitleHeight + mClntVertGap; -#if 1 - mpClientWnd->SetSize( x -1, y -1, - w - 2*(mWndHorizGap + mClntHorizGap), - h - y - mClntVertGap - mWndVertGap, - 0 - ); -#endif - } + mpClientWnd->SetSize( x-1, y-1, + w - 2*(mWndHorizGap + mClntHorizGap), + h - y - mClntVertGap - mWndVertGap, + 0 + ); + } LayoutMiniButtons(); } @@ -696,7 +697,7 @@ wxSize wxToolWindow::GetPreferredSize( const wxSize& given ) return given; } -void wxToolWindow::OnEraseBackground( wxEraseEvent& event ) +void wxToolWindow::OnEraseBackground( wxEraseEvent& WXUNUSED(event) ) { // nothing } @@ -754,7 +755,7 @@ void cbMiniButton::OnLeftDown( const wxPoint& pos ) } } -void cbMiniButton::OnLeftUp( const wxPoint& pos ) +void cbMiniButton::OnLeftUp( const wxPoint& WXUNUSED(pos) ) { if ( !mVisible || !mDragStarted ) return; @@ -868,7 +869,7 @@ void cbMiniButton::Reset() void cbCloseBox::Draw( wxDC& dc ) { -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXX11__) cbMiniButton::Draw( dc ); @@ -1136,7 +1137,7 @@ bool cbFloatedBarWindow::HandleTitleClick( wxMouseEvent& event ) return TRUE; } -void cbFloatedBarWindow::OnDblClick( wxMouseEvent& event ) +void cbFloatedBarWindow::OnDblClick( wxMouseEvent& WXUNUSED(event) ) { mpLayout->SetBarState( mpBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE );