Include wx/toolbar.h according to precompiled headers of wx/wx.h (with other minor cleaning).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -34,12 +34,12 @@
|
|||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/dcscreen.h"
|
#include "wx/dcscreen.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include "wx/dcbuffer.h"
|
//#include "wx/dcbuffer.h"
|
||||||
|
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#if wxUSE_MDI
|
#if wxUSE_MDI
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 2003/08/17
|
// Created: 2003/08/17
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2003 David Elliott
|
// Copyright: (c) 2003 David Elliott
|
||||||
// Licence: wxWidgets licence
|
// Licence: wxWidgets licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -21,8 +21,10 @@
|
|||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR_NATIVE
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
@@ -29,11 +29,9 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -26,11 +26,9 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR_NATIVE
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -28,16 +28,13 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/layout.h"
|
#include "wx/layout.h"
|
||||||
#include "wx/module.h"
|
#include "wx/module.h"
|
||||||
#include "wx/combobox.h"
|
#include "wx/combobox.h"
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -26,11 +26,9 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR_NATIVE
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WXPRECOMP
|
#endif // WXPRECOMP
|
||||||
|
|
||||||
#include "wx/html/helpfrm.h"
|
#include "wx/html/helpfrm.h"
|
||||||
@@ -49,7 +50,6 @@
|
|||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "wx/busyinfo.h"
|
#include "wx/busyinfo.h"
|
||||||
#include "wx/progdlg.h"
|
#include "wx/progdlg.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/fontenum.h"
|
#include "wx/fontenum.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WXPRECOMP
|
#endif // WXPRECOMP
|
||||||
|
|
||||||
#include "wx/html/helpfrm.h"
|
#include "wx/html/helpfrm.h"
|
||||||
@@ -50,7 +51,6 @@
|
|||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "wx/busyinfo.h"
|
#include "wx/busyinfo.h"
|
||||||
#include "wx/progdlg.h"
|
#include "wx/progdlg.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/fontenum.h"
|
#include "wx/fontenum.h"
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
@@ -13,10 +13,14 @@
|
|||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
|
|
||||||
#include "wx/wx.h"
|
|
||||||
#include "wx/bitmap.h"
|
|
||||||
#include "wx/toolbar.h"
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
#include "wx/geometry.h"
|
#include "wx/geometry.h"
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
#include "wx/statbox.h"
|
#include "wx/statbox.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/layout.h"
|
#include "wx/layout.h"
|
||||||
@@ -38,8 +39,6 @@
|
|||||||
#include "wx/spinctrl.h"
|
#include "wx/spinctrl.h"
|
||||||
#include "wx/geometry.h"
|
#include "wx/geometry.h"
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
#include "wx/caret.h"
|
#include "wx/caret.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: toolbar.cpp
|
// Name: src/mac/classic/toolbar.cpp
|
||||||
// Purpose: wxToolBar
|
// Purpose: wxToolBar
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -9,11 +9,16 @@
|
|||||||
// Licence: The wxWindows licence
|
// Licence: The wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/wx.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
#include "wx/tabctrl.h"
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
@@ -21,8 +26,8 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
|
BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
|
||||||
EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
|
EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
|
||||||
EVT_PAINT( wxToolBar::OnPaint )
|
EVT_PAINT( wxToolBar::OnPaint )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
@@ -43,19 +48,19 @@ public:
|
|||||||
wxObject *clientData,
|
wxObject *clientData,
|
||||||
const wxString& shortHelp,
|
const wxString& shortHelp,
|
||||||
const wxString& longHelp) ;
|
const wxString& longHelp) ;
|
||||||
|
|
||||||
wxToolBarTool(wxToolBar *tbar, wxControl *control)
|
wxToolBarTool(wxToolBar *tbar, wxControl *control)
|
||||||
: wxToolBarToolBase(tbar, control)
|
: wxToolBarToolBase(tbar, control)
|
||||||
{
|
{
|
||||||
Init() ;
|
Init() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxToolBarTool()
|
~wxToolBarTool()
|
||||||
{
|
{
|
||||||
if ( m_controlHandle )
|
if ( m_controlHandle )
|
||||||
DisposeControl( m_controlHandle ) ;
|
DisposeControl( m_controlHandle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlHandle GetControlHandle() { return m_controlHandle ; }
|
ControlHandle GetControlHandle() { return m_controlHandle ; }
|
||||||
void SetControlHandle( ControlHandle handle ) { m_controlHandle = handle ; }
|
void SetControlHandle( ControlHandle handle ) { m_controlHandle = handle ; }
|
||||||
|
|
||||||
@@ -82,9 +87,9 @@ public:
|
|||||||
wxPoint GetPosition() const
|
wxPoint GetPosition() const
|
||||||
{
|
{
|
||||||
return wxPoint(m_x, m_y);
|
return wxPoint(m_x, m_y);
|
||||||
}
|
}
|
||||||
private :
|
private :
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
m_controlHandle = NULL ;
|
m_controlHandle = NULL ;
|
||||||
}
|
}
|
||||||
@@ -119,18 +124,18 @@ void wxToolBarTool::SetPosition(const wxPoint& position)
|
|||||||
{
|
{
|
||||||
int x , y ;
|
int x , y ;
|
||||||
x = y = 0 ;
|
x = y = 0 ;
|
||||||
WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetRootWindow() ;
|
WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetRootWindow() ;
|
||||||
GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
|
GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
|
||||||
int mac_x = x + position.x ;
|
int mac_x = x + position.x ;
|
||||||
int mac_y = y + position.y ;
|
int mac_y = y + position.y ;
|
||||||
|
|
||||||
|
|
||||||
Rect contrlRect ;
|
|
||||||
GetControlBounds( m_controlHandle , &contrlRect ) ;
|
Rect contrlRect ;
|
||||||
|
GetControlBounds( m_controlHandle , &contrlRect ) ;
|
||||||
int former_mac_x = contrlRect.left ;
|
int former_mac_x = contrlRect.left ;
|
||||||
int former_mac_y = contrlRect.top ;
|
int former_mac_y = contrlRect.top ;
|
||||||
wxSize sz = GetToolBar()->GetToolSize() ;
|
wxSize sz = GetToolBar()->GetToolSize() ;
|
||||||
|
|
||||||
if ( mac_x != former_mac_x || mac_y != former_mac_y )
|
if ( mac_x != former_mac_x || mac_y != former_mac_y )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -156,42 +161,42 @@ const short kwxMacToolBarTopMargin = 2 ;
|
|||||||
const short kwxMacToolBarLeftMargin = 2 ;
|
const short kwxMacToolBarLeftMargin = 2 ;
|
||||||
|
|
||||||
wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
||||||
int id,
|
int id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxBitmap& bmpNormal,
|
const wxBitmap& bmpNormal,
|
||||||
const wxBitmap& bmpDisabled,
|
const wxBitmap& bmpDisabled,
|
||||||
wxItemKind kind,
|
wxItemKind kind,
|
||||||
wxObject *clientData,
|
wxObject *clientData,
|
||||||
const wxString& shortHelp,
|
const wxString& shortHelp,
|
||||||
const wxString& longHelp)
|
const wxString& longHelp)
|
||||||
: wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
|
: wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
|
||||||
clientData, shortHelp, longHelp)
|
clientData, shortHelp, longHelp)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
if (id == wxID_SEPARATOR) return;
|
if (id == wxID_SEPARATOR) return;
|
||||||
|
|
||||||
WindowRef window = (WindowRef) tbar->MacGetRootWindow() ;
|
WindowRef window = (WindowRef) tbar->MacGetRootWindow() ;
|
||||||
wxSize toolSize = tbar->GetToolSize() ;
|
wxSize toolSize = tbar->GetToolSize() ;
|
||||||
Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
|
Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
|
||||||
|
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
|
wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
|
||||||
|
|
||||||
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
||||||
if ( CanBeToggled() )
|
if ( CanBeToggled() )
|
||||||
behaviour += kControlBehaviorToggles ;
|
behaviour += kControlBehaviorToggles ;
|
||||||
|
|
||||||
if ( info.contentType != kControlNoContent )
|
if ( info.contentType != kControlNoContent )
|
||||||
{
|
{
|
||||||
m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
|
m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
|
||||||
behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
|
|
||||||
::SetControlData( m_controlHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
::SetControlData( m_controlHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
|
m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
|
||||||
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
||||||
}
|
}
|
||||||
UMAShowControl( m_controlHandle ) ;
|
UMAShowControl( m_controlHandle ) ;
|
||||||
@@ -207,7 +212,7 @@ wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
|||||||
{
|
{
|
||||||
::SetControl32BitValue( m_controlHandle , 0 ) ;
|
::SetControl32BitValue( m_controlHandle , 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlHandle container = (ControlHandle) tbar->MacGetContainerForEmbedding() ;
|
ControlHandle container = (ControlHandle) tbar->MacGetContainerForEmbedding() ;
|
||||||
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
||||||
::EmbedControl( m_controlHandle , container ) ;
|
::EmbedControl( m_controlHandle , container ) ;
|
||||||
@@ -242,12 +247,12 @@ void wxToolBar::Init()
|
|||||||
|
|
||||||
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxString& name)
|
long style, const wxString& name)
|
||||||
{
|
{
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
|
|
||||||
if (width <= 0)
|
if (width <= 0)
|
||||||
width = 100;
|
width = 100;
|
||||||
if (height <= 0)
|
if (height <= 0)
|
||||||
@@ -256,20 +261,20 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
x = 0;
|
x = 0;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
|
|
||||||
m_backgroundColour = parent->GetBackgroundColour() ;
|
m_backgroundColour = parent->GetBackgroundColour() ;
|
||||||
m_foregroundColour = parent->GetForegroundColour() ;
|
m_foregroundColour = parent->GetForegroundColour() ;
|
||||||
|
|
||||||
if (id == -1)
|
if (id == wxID_ANY)
|
||||||
m_windowId = NewControlId();
|
m_windowId = NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
{
|
{
|
||||||
m_width = size.x ;
|
m_width = size.x ;
|
||||||
m_height = size.y ;
|
m_height = size.y ;
|
||||||
@@ -279,12 +284,12 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
m_x = x ;
|
m_x = x ;
|
||||||
m_y = y ;
|
m_y = y ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolBar::~wxToolBar()
|
wxToolBar::~wxToolBar()
|
||||||
{
|
{
|
||||||
// we must refresh the frame size when the toolbar is deleted but the frame
|
// we must refresh the frame size when the toolbar is deleted but the frame
|
||||||
// is not - otherwise toolbar leaves a hole in the place it used to occupy
|
// is not - otherwise toolbar leaves a hole in the place it used to occupy
|
||||||
}
|
}
|
||||||
@@ -292,17 +297,17 @@ wxToolBar::~wxToolBar()
|
|||||||
bool wxToolBar::Realize()
|
bool wxToolBar::Realize()
|
||||||
{
|
{
|
||||||
if (m_tools.GetCount() == 0)
|
if (m_tools.GetCount() == 0)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
int x = m_xMargin + kwxMacToolBarLeftMargin ;
|
int x = m_xMargin + kwxMacToolBarLeftMargin ;
|
||||||
int y = m_yMargin + kwxMacToolBarTopMargin ;
|
int y = m_yMargin + kwxMacToolBarTopMargin ;
|
||||||
|
|
||||||
int tw, th;
|
int tw, th;
|
||||||
GetSize(& tw, & th);
|
GetSize(& tw, & th);
|
||||||
|
|
||||||
int maxWidth = 0 ;
|
int maxWidth = 0 ;
|
||||||
int maxHeight = 0 ;
|
int maxHeight = 0 ;
|
||||||
|
|
||||||
int maxToolWidth = 0;
|
int maxToolWidth = 0;
|
||||||
int maxToolHeight = 0;
|
int maxToolHeight = 0;
|
||||||
|
|
||||||
@@ -326,15 +331,15 @@ bool wxToolBar::Realize()
|
|||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
|
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
|
||||||
wxSize cursize = tool->GetSize() ;
|
wxSize cursize = tool->GetSize() ;
|
||||||
|
|
||||||
// for the moment we just do a single row/column alignement
|
// for the moment we just do a single row/column alignement
|
||||||
if ( x + cursize.x > maxWidth )
|
if ( x + cursize.x > maxWidth )
|
||||||
maxWidth = x + cursize.x ;
|
maxWidth = x + cursize.x ;
|
||||||
if ( y + cursize.y > maxHeight )
|
if ( y + cursize.y > maxHeight )
|
||||||
maxHeight = y + cursize.y ;
|
maxHeight = y + cursize.y ;
|
||||||
|
|
||||||
tool->SetPosition( wxPoint( x , y ) ) ;
|
tool->SetPosition( wxPoint( x , y ) ) ;
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
if ( GetWindowStyleFlag() & wxTB_VERTICAL )
|
||||||
{
|
{
|
||||||
y += cursize.y ;
|
y += cursize.y ;
|
||||||
@@ -346,7 +351,7 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||||
{
|
{
|
||||||
if ( m_maxRows == 0 )
|
if ( m_maxRows == 0 )
|
||||||
@@ -354,7 +359,7 @@ bool wxToolBar::Realize()
|
|||||||
// if not set yet, only one row
|
// if not set yet, only one row
|
||||||
SetRows(1);
|
SetRows(1);
|
||||||
}
|
}
|
||||||
maxWidth = tw ;
|
maxWidth = tw ;
|
||||||
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
maxHeight += m_yMargin + kwxMacToolBarTopMargin;
|
||||||
m_maxHeight = maxHeight ;
|
m_maxHeight = maxHeight ;
|
||||||
}
|
}
|
||||||
@@ -369,11 +374,11 @@ bool wxToolBar::Realize()
|
|||||||
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
|
||||||
m_maxWidth = maxWidth ;
|
m_maxWidth = maxWidth ;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize(maxWidth, maxHeight);
|
SetSize(maxWidth, maxHeight);
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::SetToolBitmapSize(const wxSize& size)
|
void wxToolBar::SetToolBitmapSize(const wxSize& size)
|
||||||
@@ -387,15 +392,15 @@ wxSize wxToolBar::GetToolSize() const
|
|||||||
return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
|
return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
|
void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
|
||||||
{
|
{
|
||||||
wxToolBarToolsList::Node *node;
|
wxToolBarToolsList::Node *node;
|
||||||
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
|
wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
|
||||||
if ( tool->IsButton() )
|
if ( tool->IsButton() )
|
||||||
{
|
{
|
||||||
if( (WXWidget) tool->GetControlHandle() == control )
|
if( (WXWidget) tool->GetControlHandle() == control )
|
||||||
{
|
{
|
||||||
if ( tool->CanBeToggled() )
|
if ( tool->CanBeToggled() )
|
||||||
{
|
{
|
||||||
@@ -419,7 +424,7 @@ void wxToolBar::SetRows(int nRows)
|
|||||||
m_maxRows = nRows;
|
m_maxRows = nRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::MacSuperChangedPosition()
|
void wxToolBar::MacSuperChangedPosition()
|
||||||
{
|
{
|
||||||
wxWindow::MacSuperChangedPosition() ;
|
wxWindow::MacSuperChangedPosition() ;
|
||||||
Realize() ;
|
Realize() ;
|
||||||
@@ -491,7 +496,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
|||||||
tool->Attach(this);
|
tool->Attach(this);
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
|
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
|
||||||
@@ -519,7 +524,7 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
|
|||||||
tool->Detach();
|
tool->Detach();
|
||||||
|
|
||||||
// and finally reposition all the controls after this one
|
// and finally reposition all the controls after this one
|
||||||
|
|
||||||
for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
|
for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
|
||||||
@@ -535,24 +540,24 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
|
|||||||
}
|
}
|
||||||
tool2->SetPosition( pt ) ;
|
tool2->SetPosition( pt ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
return TRUE ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::OnPaint(wxPaintEvent& event)
|
void wxToolBar::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this) ;
|
wxPaintDC dc(this) ;
|
||||||
wxMacPortSetter helper(&dc) ;
|
wxMacPortSetter helper(&dc) ;
|
||||||
|
|
||||||
Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
|
Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
|
||||||
dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
|
dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
|
||||||
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
{
|
{
|
||||||
wxToolBarToolsList::Node *node;
|
wxToolBarToolsList::Node *node;
|
||||||
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
|
wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
|
||||||
if ( tool->IsButton() )
|
if ( tool->IsButton() )
|
||||||
{
|
{
|
||||||
UMADrawControl( tool->GetControlHandle() ) ;
|
UMADrawControl( tool->GetControlHandle() ) ;
|
||||||
@@ -561,41 +566,41 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouse( wxMouseEvent &event )
|
void wxToolBar::OnMouse( wxMouseEvent &event )
|
||||||
{
|
{
|
||||||
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
||||||
{
|
{
|
||||||
|
|
||||||
int x = event.m_x ;
|
int x = event.m_x ;
|
||||||
int y = event.m_y ;
|
int y = event.m_y ;
|
||||||
|
|
||||||
MacClientToRootWindow( &x , &y ) ;
|
MacClientToRootWindow( &x , &y ) ;
|
||||||
|
|
||||||
ControlHandle control ;
|
ControlHandle control ;
|
||||||
Point localwhere ;
|
Point localwhere ;
|
||||||
SInt16 controlpart ;
|
SInt16 controlpart ;
|
||||||
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
||||||
|
|
||||||
localwhere.h = x ;
|
localwhere.h = x ;
|
||||||
localwhere.v = y ;
|
localwhere.v = y ;
|
||||||
|
|
||||||
short modifiers = 0;
|
short modifiers = 0;
|
||||||
|
|
||||||
if ( !event.m_leftDown && !event.m_rightDown )
|
if ( !event.m_leftDown && !event.m_rightDown )
|
||||||
modifiers |= btnState ;
|
modifiers |= btnState ;
|
||||||
|
|
||||||
if ( event.m_shiftDown )
|
if ( event.m_shiftDown )
|
||||||
modifiers |= shiftKey ;
|
modifiers |= shiftKey ;
|
||||||
|
|
||||||
if ( event.m_controlDown )
|
if ( event.m_controlDown )
|
||||||
modifiers |= controlKey ;
|
modifiers |= controlKey ;
|
||||||
|
|
||||||
if ( event.m_altDown )
|
if ( event.m_altDown )
|
||||||
modifiers |= optionKey ;
|
modifiers |= optionKey ;
|
||||||
|
|
||||||
if ( event.m_metaDown )
|
if ( event.m_metaDown )
|
||||||
modifiers |= cmdKey ;
|
modifiers |= cmdKey ;
|
||||||
|
|
||||||
controlpart = ::FindControl( localwhere , window , &control ) ;
|
controlpart = ::FindControl( localwhere , window , &control ) ;
|
||||||
{
|
{
|
||||||
if ( control && ::IsControlActive( control ) )
|
if ( control && ::IsControlActive( control ) )
|
||||||
@@ -614,4 +619,3 @@ void wxToolBar::OnMouse( wxMouseEvent &event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
|
@@ -35,10 +35,10 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/icon.h"
|
#include "wx/icon.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
#pragma message disable nosimpint
|
#pragma message disable nosimpint
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
@@ -46,10 +47,6 @@
|
|||||||
#include "wx/msw/wince/resources.h"
|
#include "wx/msw/wince/resources.h"
|
||||||
#endif // __SMARTPHONE__ && __WXWINCE__
|
#endif // __SMARTPHONE__ && __WXWINCE__
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxWin macros
|
// wxWin macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
@@ -54,10 +55,6 @@
|
|||||||
#include "wx/generic/statusbr.h"
|
#include "wx/generic/statusbr.h"
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif // wxUSE_TOOLBAR
|
|
||||||
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
#ifdef __WXUNIVERSAL__
|
#ifdef __WXUNIVERSAL__
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/stockitem.h"
|
#include "wx/stockitem.h"
|
||||||
@@ -48,10 +49,6 @@
|
|||||||
#include "wx/msw/statbr95.h"
|
#include "wx/msw/statbr95.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif // wxUSE_TOOLBAR
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
|
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
@@ -38,7 +40,6 @@
|
|||||||
#include "wx/app.h" // for GetComCtl32Version
|
#include "wx/app.h" // for GetComCtl32Version
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#include "wx/sysopt.h"
|
#include "wx/sysopt.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
// with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
|
// with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
|
||||||
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
|
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
@@ -39,8 +41,6 @@
|
|||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
#if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
|
#if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
|
||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/os2/private.h"
|
#include "wx/os2/private.h"
|
||||||
@@ -38,10 +39,6 @@
|
|||||||
#include "wx/generic/statusbr.h"
|
#include "wx/generic/statusbr.h"
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif // wxUSE_TOOLBAR
|
|
||||||
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: toolbar.cpp
|
// Name: src/os2/toolbar.cpp
|
||||||
// Purpose: wxToolBar
|
// Purpose: wxToolBar
|
||||||
// Author: David Webster
|
// Author: David Webster
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
|
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
@@ -24,9 +26,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
bool wxToolBar::m_bInitialized = FALSE;
|
bool wxToolBar::m_bInitialized = false;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
@@ -275,12 +276,10 @@ wxToolBarToolBase* wxToolBar::InsertTool(
|
|||||||
return pTool;
|
return pTool;
|
||||||
} // end of wxToolBar::InsertTool
|
} // end of wxToolBar::InsertTool
|
||||||
|
|
||||||
bool wxToolBar::DoInsertTool(
|
bool wxToolBar::DoInsertTool( size_t WXUNUSED(nPos),
|
||||||
size_t WXUNUSED(nPos)
|
wxToolBarToolBase* pToolBase )
|
||||||
, wxToolBarToolBase* pToolBase
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
|
wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
|
||||||
|
|
||||||
pTool->m_vX = m_vXPos;
|
pTool->m_vX = m_vXPos;
|
||||||
if (pTool->m_vX == -1)
|
if (pTool->m_vX == -1)
|
||||||
@@ -303,27 +302,23 @@ bool wxToolBar::DoInsertTool(
|
|||||||
if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
|
if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
|
||||||
m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
|
m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxToolBar::DoInsertTool
|
} // end of wxToolBar::DoInsertTool
|
||||||
|
|
||||||
bool wxToolBar::DoDeleteTool(
|
bool wxToolBar::DoDeleteTool( size_t WXUNUSED(nPos),
|
||||||
size_t WXUNUSED(nPos)
|
wxToolBarToolBase* pTool )
|
||||||
, wxToolBarToolBase* pTool
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
pTool->Detach();
|
pTool->Detach();
|
||||||
Refresh();
|
Refresh();
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxToolBar::DoDeleteTool
|
} // end of wxToolBar::DoDeleteTool
|
||||||
|
|
||||||
bool wxToolBar::Create(
|
bool wxToolBar::Create( wxWindow* pParent,
|
||||||
wxWindow* pParent
|
wxWindowID vId,
|
||||||
, wxWindowID vId
|
const wxPoint& rPos,
|
||||||
, const wxPoint& rPos
|
const wxSize& rSize,
|
||||||
, const wxSize& rSize
|
long lStyle,
|
||||||
, long lStyle
|
const wxString& rsName )
|
||||||
, const wxString& rsName
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if ( !wxWindow::Create( pParent
|
if ( !wxWindow::Create( pParent
|
||||||
,vId
|
,vId
|
||||||
@@ -332,7 +327,7 @@ bool wxToolBar::Create(
|
|||||||
,lStyle
|
,lStyle
|
||||||
,rsName
|
,rsName
|
||||||
))
|
))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// Set it to grey (or other 3D face colour)
|
// Set it to grey (or other 3D face colour)
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
|
||||||
@@ -418,7 +413,7 @@ bool wxToolBar::Create(
|
|||||||
,nWidth
|
,nWidth
|
||||||
,nHeight
|
,nHeight
|
||||||
);
|
);
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxToolBar::Create
|
} // end of wxToolBar::Create
|
||||||
|
|
||||||
wxToolBar::~wxToolBar()
|
wxToolBar::~wxToolBar()
|
||||||
@@ -577,8 +572,8 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
m_maxWidth += m_xMargin;
|
m_maxWidth += m_xMargin;
|
||||||
m_maxHeight += m_yMargin;
|
m_maxHeight += m_yMargin;
|
||||||
m_bInitialized = TRUE;
|
m_bInitialized = true;
|
||||||
return TRUE;
|
return true;
|
||||||
} // end of wxToolBar::Realize
|
} // end of wxToolBar::Realize
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -716,9 +711,7 @@ void wxToolBar::OnMouseEvent(
|
|||||||
pTool = (wxToolBarTool *)FindById(m_nCurrentTool);
|
pTool = (wxToolBarTool *)FindById(m_nCurrentTool);
|
||||||
if (pTool && !pTool->IsToggled())
|
if (pTool && !pTool->IsToggled())
|
||||||
{
|
{
|
||||||
RaiseTool( pTool
|
RaiseTool( pTool, FALSE );
|
||||||
,FALSE
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
m_nCurrentTool = -1;
|
m_nCurrentTool = -1;
|
||||||
OnMouseEnter(-1);
|
OnMouseEnter(-1);
|
||||||
@@ -745,9 +738,7 @@ void wxToolBar::OnMouseEvent(
|
|||||||
wxToolBarTool* pOldTool = (wxToolBarTool*)FindById(m_nCurrentTool);
|
wxToolBarTool* pOldTool = (wxToolBarTool*)FindById(m_nCurrentTool);
|
||||||
|
|
||||||
if (pOldTool && !pTool->IsToggled())
|
if (pOldTool && !pTool->IsToggled())
|
||||||
RaiseTool( pOldTool
|
RaiseTool( pOldTool, FALSE );
|
||||||
,FALSE
|
|
||||||
);
|
|
||||||
m_nCurrentTool = pTool->GetId();
|
m_nCurrentTool = pTool->GetId();
|
||||||
OnMouseEnter(m_nCurrentTool);
|
OnMouseEnter(m_nCurrentTool);
|
||||||
if (!pTool->GetShortHelp().empty())
|
if (!pTool->GetShortHelp().empty())
|
||||||
@@ -810,27 +801,20 @@ void wxToolBar::OnMouseEvent(
|
|||||||
// drawing
|
// drawing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxToolBar::DrawTool(
|
void wxToolBar::DrawTool( wxToolBarToolBase* pTool )
|
||||||
wxToolBarToolBase* pTool
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxClientDC vDc(this);
|
wxClientDC vDc(this);
|
||||||
|
|
||||||
DrawTool( vDc
|
DrawTool( vDc, pTool );
|
||||||
,pTool
|
|
||||||
);
|
|
||||||
} // end of wxToolBar::DrawTool
|
} // end of wxToolBar::DrawTool
|
||||||
|
|
||||||
void wxToolBar::DrawTool(
|
void wxToolBar::DrawTool( wxDC& rDc, wxToolBarToolBase* pToolBase )
|
||||||
wxDC& rDc
|
|
||||||
, wxToolBarToolBase* pToolBase
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
|
wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
|
||||||
wxColour gray85( 85,85,85 );
|
wxColour gray85( 85,85,85 );
|
||||||
wxPen vDarkGreyPen( gray85, 1, wxSOLID );
|
wxPen vDarkGreyPen( gray85, 1, wxSOLID );
|
||||||
wxBitmap vBitmap = pTool->GetNormalBitmap();
|
wxBitmap vBitmap = pTool->GetNormalBitmap();
|
||||||
bool bUseMask = FALSE;
|
bool bUseMask = false;
|
||||||
wxMask* pMask = NULL;
|
wxMask* pMask = NULL;
|
||||||
|
|
||||||
PrepareDC(rDc);
|
PrepareDC(rDc);
|
||||||
@@ -839,7 +823,7 @@ void wxToolBar::DrawTool(
|
|||||||
return;
|
return;
|
||||||
if ((pMask = vBitmap.GetMask()) != NULL)
|
if ((pMask = vBitmap.GetMask()) != NULL)
|
||||||
if (pMask->GetMaskBitmap() != NULLHANDLE)
|
if (pMask->GetMaskBitmap() != NULLHANDLE)
|
||||||
bUseMask = TRUE;
|
bUseMask = true;
|
||||||
|
|
||||||
if (!pTool->IsToggled())
|
if (!pTool->IsToggled())
|
||||||
{
|
{
|
||||||
@@ -1179,15 +1163,11 @@ void wxToolBar::RaiseTool ( wxToolBarToolBase* pToolBase,
|
|||||||
}
|
}
|
||||||
} // end of wxToolBar::RaiseTool
|
} // end of wxToolBar::RaiseTool
|
||||||
|
|
||||||
void wxToolBar::OnTimer (
|
void wxToolBar::OnTimer ( wxTimerEvent& rEvent )
|
||||||
wxTimerEvent& rEvent
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (rEvent.GetId() == m_vToolTimer.GetTimerId())
|
if (rEvent.GetId() == m_vToolTimer.GetTimerId())
|
||||||
{
|
{
|
||||||
wxPoint vPos( m_vXMouse
|
wxPoint vPos( m_vXMouse, m_vYMouse );
|
||||||
,m_vYMouse
|
|
||||||
);
|
|
||||||
|
|
||||||
m_pToolTip->DisplayToolTipWindow(vPos);
|
m_pToolTip->DisplayToolTipWindow(vPos);
|
||||||
m_vToolTimer.Stop();
|
m_vToolTimer.Stop();
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
@@ -43,10 +44,6 @@
|
|||||||
#include "wx/generic/statusbr.h"
|
#include "wx/generic/statusbr.h"
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif // wxUSE_TOOLBAR
|
|
||||||
|
|
||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
|
|
||||||
#ifdef __WXUNIVERSAL__
|
#ifdef __WXUNIVERSAL__
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
@@ -47,10 +48,6 @@
|
|||||||
#include "wx/palmos/statbr95.h"
|
#include "wx/palmos/statbr95.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
#endif // wxUSE_TOOLBAR
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -21,10 +21,9 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
|
||||||
|
|
||||||
wxToolBarXmlHandler::wxToolBarXmlHandler()
|
wxToolBarXmlHandler::wxToolBarXmlHandler()
|
||||||
|
Reference in New Issue
Block a user