2009-01-17 05:43:43 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2010-07-13 09:29:58 -04:00
|
|
|
// Name: wx/osx/toolbar.h
|
2009-01-17 05:43:43 -05:00
|
|
|
// Purpose: wxToolBar class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_TOOLBAR_H_
|
|
|
|
#define _WX_TOOLBAR_H_
|
|
|
|
|
|
|
|
#if wxUSE_TOOLBAR
|
|
|
|
|
|
|
|
#include "wx/tbarbase.h"
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase
|
|
|
|
{
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxToolBar);
|
|
|
|
public:
|
2009-01-17 05:43:43 -05:00
|
|
|
/*
|
|
|
|
* Public interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxToolBar() { Init(); }
|
|
|
|
|
2015-10-25 13:20:32 -04:00
|
|
|
wxToolBar(wxWindow *parent, wxWindowID id,
|
2009-01-17 05:43:43 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2014-11-07 09:59:33 -05:00
|
|
|
long style = wxTB_DEFAULT_STYLE,
|
2009-01-17 05:43:43 -05:00
|
|
|
const wxString& name = wxToolBarNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
|
|
|
virtual ~wxToolBar();
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2014-11-07 09:59:33 -05:00
|
|
|
long style = wxTB_DEFAULT_STYLE,
|
2009-01-17 05:43:43 -05:00
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void SetWindowStyleFlag(long style) wxOVERRIDE;
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual bool Destroy() wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
|
|
|
// override/implement base class virtuals
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2009-11-13 13:39:38 -05:00
|
|
|
#ifndef __WXOSX_IPHONE__
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual bool Show(bool show = true) wxOVERRIDE;
|
|
|
|
virtual bool IsShown() const wxOVERRIDE;
|
2009-11-13 13:39:38 -05:00
|
|
|
#endif
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual bool Realize() wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void SetToolBitmapSize(const wxSize& size) wxOVERRIDE;
|
|
|
|
virtual wxSize GetToolSize() const wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void SetRows(int nRows) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
|
|
|
|
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2009-11-13 13:39:38 -05:00
|
|
|
#ifndef __WXOSX_IPHONE__
|
2009-01-17 05:43:43 -05:00
|
|
|
// Add all the buttons
|
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual wxString MacGetToolTipString( wxPoint &where ) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
void OnPaint(wxPaintEvent& event) ;
|
|
|
|
void OnMouse(wxMouseEvent& event) ;
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void MacSuperChangedPosition() wxOVERRIDE;
|
2009-11-13 13:39:38 -05:00
|
|
|
#endif
|
2010-09-30 07:44:45 -04:00
|
|
|
|
2009-01-17 05:43:43 -05:00
|
|
|
#if wxOSX_USE_NATIVE_TOOLBAR
|
2013-02-28 11:28:56 -05:00
|
|
|
// make all tools selectable
|
|
|
|
void OSXSetSelectableTools(bool set);
|
|
|
|
void OSXSelectTool(int toolId);
|
|
|
|
|
2009-01-17 05:43:43 -05:00
|
|
|
bool MacInstallNativeToolbar(bool usesNative);
|
2009-12-25 15:43:43 -05:00
|
|
|
void MacUninstallNativeToolbar();
|
2009-01-17 05:43:43 -05:00
|
|
|
bool MacWantsNativeToolbar();
|
|
|
|
bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const;
|
2008-06-11 12:30:48 -04:00
|
|
|
#endif
|
2012-03-09 19:01:09 -05:00
|
|
|
|
|
|
|
virtual wxToolBarToolBase *CreateTool(int id,
|
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bmpNormal,
|
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
|
|
|
wxObject *clientData = NULL,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
2015-11-22 03:52:21 -05:00
|
|
|
const wxString& longHelp = wxEmptyString) wxOVERRIDE;
|
2012-03-09 19:01:09 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control,
|
2015-11-22 03:52:21 -05:00
|
|
|
const wxString& label) wxOVERRIDE;
|
2012-03-09 19:01:09 -05:00
|
|
|
|
2009-01-17 05:43:43 -05:00
|
|
|
protected:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
2011-02-16 13:31:16 -05:00
|
|
|
|
|
|
|
void DoLayout();
|
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2009-11-13 13:39:38 -05:00
|
|
|
#ifndef __WXOSX_IPHONE__
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void DoGetSize(int *width, int *height) const wxOVERRIDE;
|
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
2012-03-09 07:49:59 -05:00
|
|
|
#endif
|
|
|
|
#ifdef __WXOSX_COCOA__
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void DoGetPosition(int*x, int *y) const wxOVERRIDE;
|
2009-11-13 13:39:38 -05:00
|
|
|
#endif
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;
|
|
|
|
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2015-11-22 03:52:21 -05:00
|
|
|
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE;
|
|
|
|
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE;
|
|
|
|
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE;
|
2009-01-17 05:43:43 -05:00
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
2009-01-17 05:43:43 -05:00
|
|
|
#if wxOSX_USE_NATIVE_TOOLBAR
|
|
|
|
bool m_macUsesNativeToolbar ;
|
|
|
|
void* m_macToolbar ;
|
|
|
|
#endif
|
2009-11-13 13:39:38 -05:00
|
|
|
#ifdef __WXOSX_IPHONE__
|
2010-09-30 07:44:45 -04:00
|
|
|
WX_UIView m_macToolbar;
|
2009-11-13 13:39:38 -05:00
|
|
|
#endif
|
2009-01-17 05:43:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_TOOLBAR_H_
|