1998-05-21 11:02:02 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-12-15 14:47:54 -05:00
|
|
|
// Name: wx/tbarsmpl.h
|
1998-05-21 11:02:02 -04:00
|
|
|
// Purpose: wxToolBarSimple class
|
|
|
|
// Author: Julian Smart
|
1999-12-15 14:47:54 -05:00
|
|
|
// Modified by: VZ on 14.12.99 during wxToolBar classes reorganization
|
1998-05-21 11:02:02 -04:00
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-12-15 14:47:54 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-21 11:02:02 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_TBARSMPLH__
|
|
|
|
#define _WX_TBARSMPLH__
|
1998-05-21 11:02:02 -04:00
|
|
|
|
2002-08-31 07:29:13 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
1999-12-15 14:47:54 -05:00
|
|
|
#pragma interface "tbarsmpl.h"
|
1998-05-21 11:02:02 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/tbarbase.h"
|
|
|
|
|
2003-06-14 09:00:55 -04:00
|
|
|
#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_SIMPLE
|
1999-12-15 14:47:54 -05:00
|
|
|
|
1998-09-17 12:57:01 -04:00
|
|
|
class WXDLLEXPORT wxMemoryDC;
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxToolBarSimple is a generic toolbar implementation in pure wxWindows
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-21 11:02:02 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
|
|
|
{
|
1999-12-15 14:47:54 -05:00
|
|
|
public:
|
|
|
|
// ctors and dtor
|
|
|
|
wxToolBarSimple() { Init(); }
|
|
|
|
|
|
|
|
wxToolBarSimple(wxWindow *parent,
|
2003-03-20 21:58:55 -05:00
|
|
|
wxWindowID winid,
|
1999-12-15 14:47:54 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
|
|
|
const wxString& name = wxToolBarNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
2003-03-20 21:58:55 -05:00
|
|
|
Create(parent, winid, pos, size, style, name);
|
1999-12-15 14:47:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
2003-03-20 21:58:55 -05:00
|
|
|
wxWindowID winid,
|
1999-12-15 14:47:54 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
|
|
|
|
virtual ~wxToolBarSimple();
|
|
|
|
|
|
|
|
// override/implement base class virtuals
|
|
|
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
|
|
|
|
|
|
|
virtual bool Realize();
|
|
|
|
|
|
|
|
virtual void SetRows(int nRows);
|
|
|
|
|
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
|
|
|
|
|
|
|
// SCROLLING: this has to be copied from wxScrolledWindow since
|
|
|
|
// wxToolBarBase inherits from wxControl. This could have been put into
|
|
|
|
// wxToolBarSimple, but we might want any derived toolbar class to be
|
|
|
|
// scrollable.
|
|
|
|
|
|
|
|
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
|
|
|
// Length of virtual canvas in user units
|
|
|
|
virtual void SetScrollbars(int horizontal, int vertical,
|
|
|
|
int x_length, int y_length,
|
|
|
|
int x_pos = 0, int y_pos = 0);
|
|
|
|
|
|
|
|
// Physically scroll the window
|
|
|
|
virtual void Scroll(int x_pos, int y_pos);
|
|
|
|
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
|
|
|
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
|
|
|
virtual void AdjustScrollbars();
|
|
|
|
|
|
|
|
// Prepare the DC by translating it according to the current scroll position
|
|
|
|
virtual void PrepareDC(wxDC& dc);
|
|
|
|
|
|
|
|
int GetScrollPageSize(int orient) const ;
|
|
|
|
void SetScrollPageSize(int orient, int pageSize);
|
|
|
|
|
|
|
|
// Get the view start
|
|
|
|
virtual void ViewStart(int *x, int *y) const;
|
|
|
|
|
|
|
|
// Actual size in pixels when scrolling is taken into account
|
|
|
|
virtual void GetVirtualSize(int *x, int *y) const;
|
|
|
|
|
|
|
|
int CalcScrollInc(wxScrollEvent& event);
|
|
|
|
|
|
|
|
// event handlers
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
void OnKillFocus(wxFocusEvent& event);
|
|
|
|
void OnScroll(wxScrollEvent& event);
|
1998-07-27 05:47:57 -04:00
|
|
|
|
|
|
|
protected:
|
1999-12-15 14:47:54 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// implement base class pure virtuals
|
2002-03-25 16:38:18 -05:00
|
|
|
virtual wxToolBarToolBase *DoAddTool
|
|
|
|
(
|
2003-03-20 21:58:55 -05:00
|
|
|
int toolid,
|
2002-03-25 16:38:18 -05:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& bmpDisabled,
|
|
|
|
wxItemKind kind,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString,
|
|
|
|
wxObject *clientData = NULL,
|
|
|
|
wxCoord xPos = -1,
|
|
|
|
wxCoord yPos = -1
|
|
|
|
);
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
|
|
|
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
|
|
|
|
|
|
|
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
|
|
|
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
|
|
|
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
|
|
|
|
2003-03-20 21:58:55 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(int winid,
|
2002-03-25 16:38:18 -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 16:38:18 -05:00
|
|
|
const wxString& shortHelp,
|
|
|
|
const wxString& longHelp);
|
1999-12-15 14:47:54 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
|
|
|
|
|
|
|
// helpers
|
|
|
|
void DrawTool(wxToolBarToolBase *tool);
|
|
|
|
virtual void DrawTool(wxDC& dc, wxToolBarToolBase *tool);
|
|
|
|
virtual void SpringUpButton(int index);
|
|
|
|
|
|
|
|
int m_currentRowsOrColumns;
|
|
|
|
|
|
|
|
int m_pressedTool, m_currentTool;
|
|
|
|
|
|
|
|
wxCoord m_lastX, m_lastY;
|
|
|
|
wxCoord m_maxWidth, m_maxHeight;
|
|
|
|
wxCoord m_xPos, m_yPos;
|
|
|
|
|
|
|
|
// scrolling data
|
|
|
|
int m_xScrollPixelsPerLine;
|
|
|
|
int m_yScrollPixelsPerLine;
|
|
|
|
bool m_xScrollingEnabled;
|
|
|
|
bool m_yScrollingEnabled;
|
|
|
|
int m_xScrollPosition;
|
|
|
|
int m_yScrollPosition;
|
|
|
|
int m_xScrollLines;
|
|
|
|
int m_yScrollLines;
|
|
|
|
int m_xScrollLinesPerPage;
|
|
|
|
int m_yScrollLinesPerPage;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-07-21 21:42:41 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarSimple)
|
1998-05-21 11:02:02 -04:00
|
|
|
};
|
|
|
|
|
1999-12-15 14:47:54 -05:00
|
|
|
#endif // wxUSE_TOOLBAR_SIMPLE
|
|
|
|
|
1998-05-21 11:02:02 -04:00
|
|
|
#endif
|
1998-08-14 20:23:28 -04:00
|
|
|
// _WX_TBARSMPLH__
|
1998-05-21 11:02:02 -04:00
|
|
|
|