1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-11-11 21:17:44 -05:00
|
|
|
// Name: wx/msw/tbar95.h
|
1999-12-15 14:47:54 -05:00
|
|
|
// Purpose: wxToolBar (Windows 95 toolbar) class
|
1998-05-20 10:12:05 -04:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-03-27 13:03:57 -05:00
|
|
|
#ifndef _WX_MSW_TBAR95_H_
|
|
|
|
#define _WX_MSW_TBAR95_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-06-13 18:54:04 -04:00
|
|
|
#if wxUSE_TOOLBAR
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-04 17:34:54 -05:00
|
|
|
#include "wx/dynarray.h"
|
2005-03-27 13:03:57 -05:00
|
|
|
#include "wx/imaglist.h"
|
1999-12-04 17:34:54 -05:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-11-11 21:17:44 -05:00
|
|
|
public:
|
1999-12-15 14:47:54 -05:00
|
|
|
// ctors and dtor
|
|
|
|
wxToolBar() { Init(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
wxToolBar(wxWindow *parent,
|
1999-11-11 21:17:44 -05:00
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
|
|
|
const wxString& name = wxToolBarNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual ~wxToolBar();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// override/implement base class virtuals
|
|
|
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual bool Realize();
|
1998-11-28 08:38:40 -05:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
virtual void SetToolBitmapSize(const wxSize& size);
|
|
|
|
virtual wxSize GetToolSize() const;
|
1998-08-13 06:19:16 -04:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
virtual void SetRows(int nRows);
|
1998-07-27 05:47:57 -04:00
|
|
|
|
2007-02-06 16:13:03 -05:00
|
|
|
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
|
|
|
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
2007-03-18 19:13:18 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
2002-03-25 19:44:57 -05:00
|
|
|
virtual void SetWindowStyleFlag(long style);
|
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-11 21:17:44 -05:00
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
2005-02-06 13:42:43 -05:00
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-03-31 09:07:17 -05:00
|
|
|
void SetFocus() {}
|
|
|
|
|
2001-12-30 21:41:49 -05:00
|
|
|
static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
|
|
|
|
|
2006-02-08 16:47:09 -05:00
|
|
|
// override WndProc mainly to process WM_SIZE
|
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
|
|
|
|
2007-08-09 11:05:56 -04:00
|
|
|
// returns true if the platform should explicitly apply a theme border
|
|
|
|
virtual bool CanApplyThemeBorder() const { return false; }
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
1999-11-11 21:17:44 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2003-01-10 18:23:49 -05:00
|
|
|
// create the native toolbar control
|
|
|
|
bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size);
|
2002-09-14 17:36:18 -04:00
|
|
|
|
|
|
|
// recreate the control completely
|
|
|
|
void Recreate();
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
|
|
|
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
1999-12-04 17:34:54 -05:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
|
|
|
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
|
|
|
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
1999-12-04 17:34:54 -05:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(int id,
|
2002-03-25 18:14:33 -05:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bmpNormal,
|
|
|
|
const wxBitmap& bmpDisabled,
|
|
|
|
wxItemKind kind,
|
1999-12-15 14:47:54 -05:00
|
|
|
wxObject *clientData,
|
2002-03-25 18:14:33 -05:00
|
|
|
const wxString& shortHelp,
|
|
|
|
const wxString& longHelp);
|
2007-03-18 19:13:18 -04:00
|
|
|
|
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control,
|
|
|
|
const wxString& label);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-09-14 17:36:18 -04:00
|
|
|
// return the appropriate size and flags for the toolbar control
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2002-03-15 18:42:42 -05:00
|
|
|
// handlers for various events
|
|
|
|
bool HandleSize(WXWPARAM wParam, WXLPARAM lParam);
|
2008-08-02 18:34:37 -04:00
|
|
|
#ifndef __WXWINCE__
|
2002-03-15 18:42:42 -05:00
|
|
|
bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam);
|
2008-08-02 18:34:37 -04:00
|
|
|
#endif // __WXWINCE__
|
2002-03-15 18:42:42 -05:00
|
|
|
void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
2002-09-14 17:36:18 -04:00
|
|
|
// should be called whenever the toolbar size changes
|
|
|
|
void UpdateSize();
|
|
|
|
|
2005-03-27 13:03:57 -05:00
|
|
|
// create m_disabledImgList (but doesn't fill it), set it to NULL if it is
|
|
|
|
// unneeded
|
|
|
|
void CreateDisabledImageList();
|
|
|
|
|
2006-07-24 10:57:57 -04:00
|
|
|
// get the Windows toolbar style of this control
|
|
|
|
long GetMSWToolbarStyle() const;
|
|
|
|
|
2005-03-27 13:03:57 -05:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// the big bitmap containing all bitmaps of the toolbar buttons
|
|
|
|
WXHBITMAP m_hBitmap;
|
|
|
|
|
2005-03-27 13:03:57 -05:00
|
|
|
// the image list with disabled images, may be NULL if we use
|
|
|
|
// system-provided versions of them
|
|
|
|
wxImageList *m_disabledImgList;
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// the total number of toolbar elements
|
|
|
|
size_t m_nButtons;
|
1999-11-16 16:31:40 -05:00
|
|
|
|
2001-09-23 11:38:01 -04:00
|
|
|
// the tool the cursor is in
|
|
|
|
wxToolBarToolBase *m_pInTool;
|
|
|
|
|
1999-11-16 16:31:40 -05:00
|
|
|
private:
|
2009-01-26 18:20:17 -05:00
|
|
|
// makes sure tool bitmap size is sufficient for all tools
|
|
|
|
void AdjustToolBitmapSize();
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-11-16 16:31:40 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
2009-02-08 06:45:59 -05:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxToolBar);
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
2005-03-27 13:03:57 -05:00
|
|
|
#endif // _WX_MSW_TBAR95_H_
|
|
|
|
|