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
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
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
|
|
|
|
// -------------------------------
|
|
|
|
|
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);
|
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);
|
|
|
|
|
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);
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-03-15 18:42:42 -05:00
|
|
|
// override WndProc mainly to process WM_SIZE
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1999-11-16 16:31:40 -05:00
|
|
|
|
2002-09-14 17:36:18 -04: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 18:42:42 -05: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 17:36:18 -04:00
|
|
|
// should be called whenever the toolbar size changes
|
|
|
|
void UpdateSize();
|
|
|
|
|
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)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxToolBar)
|
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_
|