1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-11-12 02:17:44 +00:00
|
|
|
// Name: wx/msw/tbar95.h
|
1999-12-15 19:47:54 +00:00
|
|
|
// Purpose: wxToolBar (Windows 95 toolbar) class
|
1998-05-20 14:12:05 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-06-13 22:54:04 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_TBAR95_H_
|
|
|
|
#define _WX_TBAR95_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-12-15 19:47:54 +00:00
|
|
|
#pragma interface "tbar95.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
1999-06-13 22:54:04 +00:00
|
|
|
#if wxUSE_TOOLBAR
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-12-04 22:34:54 +00:00
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
class WXDLLEXPORT wxToolBar : public wxToolBarBase
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-11-12 02:17:44 +00:00
|
|
|
public:
|
1999-12-15 19:47:54 +00:00
|
|
|
// ctors and dtor
|
|
|
|
wxToolBar() { Init(); }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
wxToolBar(wxWindow *parent,
|
1999-11-12 02:17:44 +00: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 14:12:05 +00:00
|
|
|
|
1999-11-12 02:17:44 +00:00
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-11-12 02:17:44 +00: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 14:12:05 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
virtual ~wxToolBar();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
// override/implement base class virtuals
|
|
|
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
virtual bool Realize();
|
1998-11-28 13:38:40 +00:00
|
|
|
|
1999-11-12 02:17:44 +00:00
|
|
|
virtual void SetToolBitmapSize(const wxSize& size);
|
|
|
|
virtual wxSize GetToolSize() const;
|
1998-08-13 10:19:16 +00:00
|
|
|
|
1999-11-12 02:17:44 +00:00
|
|
|
virtual void SetRows(int nRows);
|
1998-07-27 09:47:57 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
2002-03-26 00:44:57 +00:00
|
|
|
virtual void SetWindowStyleFlag(long style);
|
|
|
|
|
1999-11-12 02:17:44 +00:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-11-12 02:17:44 +00:00
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2002-03-31 14:07:17 +00:00
|
|
|
void SetFocus() {}
|
|
|
|
|
2001-12-31 02:41:49 +00:00
|
|
|
static WXHBITMAP MapBitmap(WXHBITMAP bitmap, int width, int height);
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
1999-11-12 02:17:44 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2003-01-10 23:23:49 +00:00
|
|
|
// create the native toolbar control
|
|
|
|
bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size);
|
2002-09-14 21:36:18 +00:00
|
|
|
|
|
|
|
// recreate the control completely
|
|
|
|
void Recreate();
|
|
|
|
|
1999-12-15 19:47:54 +00: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 22:34:54 +00:00
|
|
|
|
1999-12-15 19:47:54 +00: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 22:34:54 +00:00
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
virtual wxToolBarToolBase *CreateTool(int id,
|
2002-03-25 23:14:33 +00:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bmpNormal,
|
|
|
|
const wxBitmap& bmpDisabled,
|
|
|
|
wxItemKind kind,
|
1999-12-15 19:47:54 +00:00
|
|
|
wxObject *clientData,
|
2002-03-25 23:14:33 +00:00
|
|
|
const wxString& shortHelp,
|
|
|
|
const wxString& longHelp);
|
1999-12-15 19:47:54 +00:00
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2002-03-15 23:42:42 +00:00
|
|
|
// override WndProc mainly to process WM_SIZE
|
1999-12-15 19:47:54 +00:00
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1999-11-16 21:31:40 +00:00
|
|
|
|
2002-09-14 21:36:18 +00:00
|
|
|
// return the appropriate size and flags for the toolbar control
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
|
|
|
|
2002-03-15 23:42:42 +00:00
|
|
|
// handlers for various events
|
|
|
|
bool HandleSize(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
bool HandlePaint(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
void HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
2002-09-14 21:36:18 +00:00
|
|
|
// should be called whenever the toolbar size changes
|
|
|
|
void UpdateSize();
|
|
|
|
|
1999-12-15 19:47:54 +00:00
|
|
|
// the big bitmap containing all bitmaps of the toolbar buttons
|
|
|
|
WXHBITMAP m_hBitmap;
|
|
|
|
|
|
|
|
// the total number of toolbar elements
|
|
|
|
size_t m_nButtons;
|
1999-11-16 21:31:40 +00:00
|
|
|
|
2001-09-23 15:38:01 +00:00
|
|
|
// the tool the cursor is in
|
|
|
|
wxToolBarToolBase *m_pInTool;
|
|
|
|
|
1999-11-16 21:31:40 +00:00
|
|
|
private:
|
1999-12-15 19:47:54 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-11-16 21:31:40 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
2003-01-02 23:38:11 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxToolBar)
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
1999-06-13 22:54:04 +00:00
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_TBAR95_H_
|