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
|
1999-06-13 18:54:04 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_TBAR95_H_
|
|
|
|
#define _WX_TBAR95_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-12-15 14:47:54 -05:00
|
|
|
#pragma interface "tbar95.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
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"
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
class WXDLLEXPORT 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
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
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);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
protected:
|
1999-11-11 21:17:44 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
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,
|
|
|
|
const wxBitmap& bitmap1,
|
|
|
|
const wxBitmap& bitmap2,
|
|
|
|
bool toggle,
|
|
|
|
wxObject *clientData,
|
|
|
|
const wxString& shortHelpString,
|
|
|
|
const wxString& longHelpString);
|
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// should be called whenever the toolbar size changes
|
|
|
|
void UpdateSize();
|
1999-11-16 16:31:40 -05:00
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// override WndProc to process WM_SIZE
|
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1999-11-16 16:31:40 -05:00
|
|
|
|
1999-12-15 14:47:54 -05: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 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:
|
1999-12-15 14:47:54 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-11-16 16:31:40 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
2001-01-22 06:55:47 -05:00
|
|
|
|
|
|
|
static bool sm_coloursInit; // Have we initialized the colour table yet?
|
|
|
|
static long sm_stdColours[6]; // The RGB values of the standard 6 colours
|
|
|
|
|
|
|
|
public:
|
|
|
|
void MapBitmap(WXHBITMAP bitmap, int width, int height);
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_TOOLBAR
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_TBAR95_H_
|