new native toolbar implementation (turned off by default, not supporting embedded controls yet)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,6 +59,10 @@ public:
|
|||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
|
// get the origin of the client area (which may be different from (0, 0)
|
||||||
|
// if the frame has a toolbar) in client coordinates
|
||||||
|
virtual wxPoint GetClientAreaOrigin() const;
|
||||||
|
|
||||||
// override some more virtuals
|
// override some more virtuals
|
||||||
virtual bool Enable(bool enable = TRUE) ;
|
virtual bool Enable(bool enable = TRUE) ;
|
||||||
|
|
||||||
@@ -73,6 +77,7 @@ public:
|
|||||||
const wxString& name = wxToolBarNameStr);
|
const wxString& name = wxToolBarNameStr);
|
||||||
|
|
||||||
virtual void PositionToolBar();
|
virtual void PositionToolBar();
|
||||||
|
virtual void SetToolBar(wxToolBar *toolbar);
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
// Status bar
|
// Status bar
|
||||||
|
@@ -33,7 +33,6 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
|||||||
|
|
||||||
wxToolBar() { Init(); }
|
wxToolBar() { Init(); }
|
||||||
|
|
||||||
|
|
||||||
inline wxToolBar(wxWindow *parent, wxWindowID id,
|
inline wxToolBar(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
||||||
@@ -48,9 +47,14 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
|||||||
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
||||||
const wxString& name = wxToolBarNameStr);
|
const wxString& name = wxToolBarNameStr);
|
||||||
|
|
||||||
|
virtual void SetWindowStyleFlag(long style);
|
||||||
|
|
||||||
// override/implement base class virtuals
|
// override/implement base class virtuals
|
||||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true);
|
||||||
|
virtual bool IsShown() const;
|
||||||
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
virtual bool Realize();
|
virtual bool Realize();
|
||||||
|
|
||||||
virtual void SetToolBitmapSize(const wxSize& size);
|
virtual void SetToolBitmapSize(const wxSize& size);
|
||||||
@@ -64,6 +68,12 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
|||||||
void OnPaint(wxPaintEvent& event) ;
|
void OnPaint(wxPaintEvent& event) ;
|
||||||
void OnMouse(wxMouseEvent& event) ;
|
void OnMouse(wxMouseEvent& event) ;
|
||||||
virtual void MacSuperChangedPosition() ;
|
virtual void MacSuperChangedPosition() ;
|
||||||
|
|
||||||
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
bool MacInstallNativeToolbar(bool usesNative);
|
||||||
|
bool MacWantsNativeToolbar();
|
||||||
|
bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const;
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
@@ -87,6 +97,10 @@ protected:
|
|||||||
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
bool m_macUsesNativeToolbar ;
|
||||||
|
void* m_macHIToolbarRef ;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
@@ -1098,6 +1098,11 @@
|
|||||||
// Set to 0 for no libmspack
|
// Set to 0 for no libmspack
|
||||||
#define wxUSE_LIBMSPACK 0
|
#define wxUSE_LIBMSPACK 0
|
||||||
|
|
||||||
|
// native toolbar does not support embedding controls yet, please test by setting to 1
|
||||||
|
#define wxMAC_USE_NATIVE_TOOLBAR 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_SETUP_H_
|
// _WX_SETUP_H_
|
||||||
|
@@ -85,6 +85,33 @@ wxFrame::~wxFrame()
|
|||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get the origin of the client area in the client coordinates
|
||||||
|
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||||
|
{
|
||||||
|
wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
|
||||||
|
|
||||||
|
#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__)
|
||||||
|
wxToolBar *toolbar = GetToolBar();
|
||||||
|
if ( toolbar && toolbar->IsShown() )
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
toolbar->GetSize(&w, &h);
|
||||||
|
|
||||||
|
if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
|
||||||
|
{
|
||||||
|
pt.x += w;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if !wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
pt.y += h;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxFrame::Enable(bool enable)
|
bool wxFrame::Enable(bool enable)
|
||||||
{
|
{
|
||||||
@@ -243,7 +270,10 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
// todo verify whether HIToolBox is giving correct sizes here for the tlw
|
||||||
if ( y ) *y -= h;
|
if ( y ) *y -= h;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
@@ -288,6 +318,23 @@ void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
|
|||||||
|
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
|
void wxFrame::SetToolBar(wxToolBar *toolbar)
|
||||||
|
{
|
||||||
|
if ( m_frameToolBar == toolbar )
|
||||||
|
return ;
|
||||||
|
|
||||||
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
if ( m_frameToolBar )
|
||||||
|
m_frameToolBar->MacInstallNativeToolbar(false) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_frameToolBar = toolbar ;
|
||||||
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
|
if ( toolbar )
|
||||||
|
toolbar->MacInstallNativeToolbar( true ) ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||||
{
|
{
|
||||||
if ( wxFrameBase::CreateToolBar(style, id, name) )
|
if ( wxFrameBase::CreateToolBar(style, id, name) )
|
||||||
@@ -326,8 +373,10 @@ void wxFrame::PositionToolBar()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if !wxMAC_USE_NATIVE_TOOLBAR
|
||||||
// Use the 'real' position
|
// Use the 'real' position
|
||||||
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
|
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user