2008-08-24 05:28:07 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/aui/toolbar.h
|
|
|
|
// Purpose: wxaui: wx advanced user interface - docking window manager
|
|
|
|
// Author: Benjamin I. Williams
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2008-08-04
|
2008-10-06 05:29:12 -04:00
|
|
|
// RCS-ID: $Id$
|
2008-08-24 05:28:07 -04:00
|
|
|
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
|
|
|
|
// Licence: wxWindows Library Licence, Version 3.1
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_AUIBAR_H_
|
|
|
|
#define _WX_AUIBAR_H_
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_AUI
|
|
|
|
|
2008-09-03 03:28:03 -04:00
|
|
|
#include "wx/control.h"
|
2008-09-18 14:47:57 -04:00
|
|
|
#include "wx/sizer.h"
|
|
|
|
#include "wx/pen.h"
|
|
|
|
|
|
|
|
//class WXDLLIMPEXP_FWD_CORE wxSizerItem;
|
2008-08-24 05:28:07 -04:00
|
|
|
|
|
|
|
enum wxAuiToolBarStyle
|
|
|
|
{
|
|
|
|
wxAUI_TB_TEXT = 1 << 0,
|
|
|
|
wxAUI_TB_NO_TOOLTIPS = 1 << 1,
|
|
|
|
wxAUI_TB_NO_AUTORESIZE = 1 << 2,
|
|
|
|
wxAUI_TB_GRIPPER = 1 << 3,
|
|
|
|
wxAUI_TB_OVERFLOW = 1 << 4,
|
|
|
|
wxAUI_TB_VERTICAL = 1 << 5,
|
2008-09-03 10:45:47 -04:00
|
|
|
wxAUI_TB_HORZ_LAYOUT = 1 << 6,
|
|
|
|
wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
|
2008-08-24 05:28:07 -04:00
|
|
|
wxAUI_TB_DEFAULT_STYLE = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wxAuiToolBarArtSetting
|
|
|
|
{
|
|
|
|
wxAUI_TBART_SEPARATOR_SIZE = 0,
|
|
|
|
wxAUI_TBART_GRIPPER_SIZE = 1,
|
|
|
|
wxAUI_TBART_OVERFLOW_SIZE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum wxAuiToolBarToolTextOrientation
|
|
|
|
{
|
|
|
|
wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented
|
|
|
|
wxAUI_TBTOOL_TEXT_RIGHT = 1,
|
|
|
|
wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented
|
|
|
|
wxAUI_TBTOOL_TEXT_BOTTOM = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// aui toolbar event class
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAuiToolBarEvent(wxEventType command_type = wxEVT_NULL,
|
|
|
|
int win_id = 0)
|
|
|
|
: wxNotifyEvent(command_type, win_id)
|
|
|
|
{
|
|
|
|
is_dropdown_clicked = false;
|
|
|
|
click_pt = wxPoint(-1, -1);
|
|
|
|
rect = wxRect(-1,-1, 0, 0);
|
|
|
|
tool_id = -1;
|
|
|
|
}
|
|
|
|
#ifndef SWIG
|
|
|
|
wxAuiToolBarEvent(const wxAuiToolBarEvent& c) : wxNotifyEvent(c)
|
|
|
|
{
|
|
|
|
is_dropdown_clicked = c.is_dropdown_clicked;
|
|
|
|
click_pt = c.click_pt;
|
|
|
|
rect = c.rect;
|
|
|
|
tool_id = c.tool_id;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); }
|
|
|
|
|
|
|
|
bool IsDropDownClicked() const { return is_dropdown_clicked; }
|
|
|
|
void SetDropDownClicked(bool c) { is_dropdown_clicked = c; }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxPoint GetClickPoint() const { return click_pt; }
|
|
|
|
void SetClickPoint(const wxPoint& p) { click_pt = p; }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxRect GetItemRect() const { return rect; }
|
|
|
|
void SetItemRect(const wxRect& r) { rect = r; }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
int GetToolId() const { return tool_id; }
|
|
|
|
void SetToolId(int id) { tool_id = id; }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
private:
|
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
bool is_dropdown_clicked;
|
|
|
|
wxPoint click_pt;
|
|
|
|
wxRect rect;
|
|
|
|
int tool_id;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarItem
|
|
|
|
{
|
2008-09-03 10:06:26 -04:00
|
|
|
friend class wxAuiToolBar;
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBarItem()
|
|
|
|
{
|
|
|
|
window = NULL;
|
|
|
|
sizer_item = NULL;
|
2008-09-03 10:06:26 -04:00
|
|
|
spacer_pixels = 0;
|
2008-08-24 05:28:07 -04:00
|
|
|
id = 0;
|
|
|
|
kind = wxITEM_NORMAL;
|
|
|
|
state = 0; // normal, enabled
|
|
|
|
proportion = 0;
|
|
|
|
active = true;
|
|
|
|
dropdown = true;
|
|
|
|
sticky = true;
|
|
|
|
user_data = 0;
|
2009-03-25 11:56:23 -04:00
|
|
|
alignment = wxALIGN_CENTER;
|
2008-08-24 05:28:07 -04:00
|
|
|
}
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxAuiToolBarItem(const wxAuiToolBarItem& c)
|
|
|
|
{
|
|
|
|
Assign(c);
|
|
|
|
}
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxAuiToolBarItem& operator=(const wxAuiToolBarItem& c)
|
|
|
|
{
|
|
|
|
Assign(c);
|
|
|
|
return *this;
|
|
|
|
}
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void Assign(const wxAuiToolBarItem& c)
|
|
|
|
{
|
|
|
|
window = c.window;
|
|
|
|
label = c.label;
|
|
|
|
bitmap = c.bitmap;
|
|
|
|
disabled_bitmap = c.disabled_bitmap;
|
|
|
|
hover_bitmap = c.hover_bitmap;
|
|
|
|
short_help = c.short_help;
|
|
|
|
long_help = c.long_help;
|
|
|
|
sizer_item = c.sizer_item;
|
|
|
|
min_size = c.min_size;
|
2008-09-03 10:06:26 -04:00
|
|
|
spacer_pixels = c.spacer_pixels;
|
2008-08-24 05:28:07 -04:00
|
|
|
id = c.id;
|
|
|
|
kind = c.kind;
|
|
|
|
state = c.state;
|
|
|
|
proportion = c.proportion;
|
|
|
|
active = c.active;
|
|
|
|
dropdown = c.dropdown;
|
|
|
|
sticky = c.sticky;
|
|
|
|
user_data = c.user_data;
|
2009-03-25 11:56:23 -04:00
|
|
|
alignment = c.alignment;
|
2008-08-24 05:28:07 -04:00
|
|
|
}
|
2008-09-18 14:47:57 -04:00
|
|
|
|
|
|
|
|
2008-09-08 05:56:49 -04:00
|
|
|
void SetWindow(wxWindow* w) { window = w; }
|
2008-09-03 10:06:26 -04:00
|
|
|
wxWindow* GetWindow() { return window; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-08 05:56:49 -04:00
|
|
|
void SetId(int new_id) { id = new_id; }
|
2008-09-03 10:06:26 -04:00
|
|
|
int GetId() const { return id; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-08 05:56:49 -04:00
|
|
|
void SetKind(int new_kind) { kind = new_kind; }
|
2008-09-03 10:06:26 -04:00
|
|
|
int GetKind() const { return kind; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-08 05:56:49 -04:00
|
|
|
void SetState(int new_state) { state = new_state; }
|
2008-09-03 10:06:26 -04:00
|
|
|
int GetState() const { return state; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-08 05:56:49 -04:00
|
|
|
void SetSizerItem(wxSizerItem* s) { sizer_item = s; }
|
2008-09-03 10:06:26 -04:00
|
|
|
wxSizerItem* GetSizerItem() const { return sizer_item; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetLabel(const wxString& s) { label = s; }
|
|
|
|
const wxString& GetLabel() const { return label; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetBitmap(const wxBitmap& bmp) { bitmap = bmp; }
|
|
|
|
const wxBitmap& GetBitmap() const { return bitmap; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetDisabledBitmap(const wxBitmap& bmp) { disabled_bitmap = bmp; }
|
|
|
|
const wxBitmap& GetDisabledBitmap() const { return disabled_bitmap; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetHoverBitmap(const wxBitmap& bmp) { hover_bitmap = bmp; }
|
|
|
|
const wxBitmap& GetHoverBitmap() const { return hover_bitmap; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetShortHelp(const wxString& s) { short_help = s; }
|
|
|
|
const wxString& GetShortHelp() const { return short_help; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetLongHelp(const wxString& s) { long_help = s; }
|
|
|
|
const wxString& GetLongHelp() const { return long_help; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetMinSize(const wxSize& s) { min_size = s; }
|
|
|
|
const wxSize& GetMinSize() const { return min_size; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetSpacerPixels(int s) { spacer_pixels = s; }
|
|
|
|
int GetSpacerPixels() const { return spacer_pixels; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetProportion(int p) { proportion = p; }
|
|
|
|
int GetProportion() const { return proportion; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetActive(bool b) { active = b; }
|
|
|
|
bool IsActive() const { return active; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetHasDropDown(bool b) { dropdown = b; }
|
|
|
|
bool HasDropDown() const { return dropdown; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetSticky(bool b) { sticky = b; }
|
|
|
|
bool IsSticky() const { return sticky; }
|
2008-09-18 14:47:57 -04:00
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
void SetUserData(long l) { user_data = l; }
|
|
|
|
long GetUserData() const { return user_data; }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2009-03-25 11:56:23 -04:00
|
|
|
void SetAlignment(int l) { alignment = l; }
|
|
|
|
int GetAlignment() const { return alignment; }
|
|
|
|
|
2008-09-03 10:06:26 -04:00
|
|
|
private:
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxWindow* window; // item's associated window
|
|
|
|
wxString label; // label displayed on the item
|
|
|
|
wxBitmap bitmap; // item's bitmap
|
|
|
|
wxBitmap disabled_bitmap; // item's disabled bitmap
|
|
|
|
wxBitmap hover_bitmap; // item's hover bitmap
|
|
|
|
wxString short_help; // short help (for tooltip)
|
|
|
|
wxString long_help; // long help (for status bar)
|
|
|
|
wxSizerItem* sizer_item; // sizer item
|
|
|
|
wxSize min_size; // item's minimum size
|
2008-09-03 10:06:26 -04:00
|
|
|
int spacer_pixels; // size of a spacer
|
2008-08-24 05:28:07 -04:00
|
|
|
int id; // item's id
|
|
|
|
int kind; // item's kind
|
|
|
|
int state; // state
|
|
|
|
int proportion; // proportion
|
|
|
|
bool active; // true if the item is currently active
|
|
|
|
bool dropdown; // true if the item has a dropdown button
|
|
|
|
bool sticky; // overrides button states if true (always active)
|
|
|
|
long user_data; // user-specified data
|
2009-03-25 11:56:23 -04:00
|
|
|
int alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
|
2008-08-24 05:28:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tab art class
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBarArt
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBarArt() { }
|
|
|
|
virtual ~wxAuiToolBarArt() { }
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxAuiToolBarArt* Clone() = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
virtual void SetFlags(unsigned int flags) = 0;
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual unsigned int GetFlags() = 0;
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void SetFont(const wxFont& font) = 0;
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual wxFont GetFont() = 0;
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void SetTextOrientation(int orientation) = 0;
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual int GetTextOrientation() = 0;
|
2008-08-24 05:28:07 -04:00
|
|
|
|
|
|
|
virtual void DrawBackground(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
2008-09-03 03:28:03 -04:00
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawDropDownButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawControlLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawSeparator(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawGripper(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect) = 0;
|
|
|
|
|
|
|
|
virtual void DrawOverflowButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect,
|
|
|
|
int state) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxSize GetLabelSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxSize GetToolSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual int GetElementSize(int element_id) = 0;
|
|
|
|
virtual void SetElementSize(int element_id, int size) = 0;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual int ShowDropDown(
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItemArray& items) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiDefaultToolBarArt();
|
|
|
|
virtual ~wxAuiDefaultToolBarArt();
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxAuiToolBarArt* Clone();
|
|
|
|
virtual void SetFlags(unsigned int flags);
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual unsigned int GetFlags();
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void SetFont(const wxFont& font);
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual wxFont GetFont();
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void SetTextOrientation(int orientation);
|
2009-03-25 10:23:14 -04:00
|
|
|
virtual int GetTextOrientation();
|
2008-08-24 05:28:07 -04:00
|
|
|
|
|
|
|
virtual void DrawBackground(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
2008-09-03 03:28:03 -04:00
|
|
|
const wxRect& rect);
|
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawDropDownButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawControlLabel(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawSeparator(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawGripper(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual void DrawOverflowButton(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxRect& rect,
|
|
|
|
int state);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxSize GetLabelSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual wxSize GetToolSize(
|
|
|
|
wxDC& dc,
|
|
|
|
wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItem& item);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
virtual int GetElementSize(int element);
|
|
|
|
virtual void SetElementSize(int element_id, int size);
|
|
|
|
|
|
|
|
virtual int ShowDropDown(wxWindow* wnd,
|
|
|
|
const wxAuiToolBarItemArray& items);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
wxBitmap m_button_dropdown_bmp;
|
|
|
|
wxBitmap m_disabled_button_dropdown_bmp;
|
|
|
|
wxBitmap m_overflow_bmp;
|
|
|
|
wxBitmap m_disabled_overflow_bmp;
|
|
|
|
wxColour m_base_colour;
|
|
|
|
wxColour m_highlight_colour;
|
|
|
|
wxFont m_font;
|
|
|
|
unsigned int m_flags;
|
|
|
|
int m_text_orientation;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxPen m_gripper_pen1;
|
|
|
|
wxPen m_gripper_pen2;
|
|
|
|
wxPen m_gripper_pen3;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
int m_separator_size;
|
|
|
|
int m_gripper_size;
|
|
|
|
int m_overflow_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_AUI wxAuiToolBar : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAuiToolBar(wxWindow* parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint& position = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxAUI_TB_DEFAULT_STYLE);
|
2008-10-01 06:42:50 -04:00
|
|
|
virtual ~wxAuiToolBar();
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetWindowStyleFlag(long style);
|
2009-03-25 09:42:35 -04:00
|
|
|
long GetWindowStyleFlag() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetArtProvider(wxAuiToolBarArt* art);
|
|
|
|
wxAuiToolBarArt* GetArtProvider() const;
|
|
|
|
|
|
|
|
bool SetFont(const wxFont& font);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddTool(int tool_id,
|
2008-08-24 05:28:07 -04:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxString& short_help_string = wxEmptyString,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddTool(int tool_id,
|
2008-08-24 05:28:07 -04:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& disabled_bitmap,
|
|
|
|
wxItemKind kind,
|
|
|
|
const wxString& short_help_string,
|
|
|
|
const wxString& long_help_string,
|
|
|
|
wxObject* client_data);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddTool(int tool_id,
|
2008-08-24 05:28:07 -04:00
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& disabled_bitmap,
|
|
|
|
bool toggle = false,
|
|
|
|
wxObject* client_data = NULL,
|
|
|
|
const wxString& short_help_string = wxEmptyString,
|
|
|
|
const wxString& long_help_string = wxEmptyString)
|
|
|
|
{
|
2008-10-01 06:42:50 -04:00
|
|
|
return AddTool(tool_id,
|
2008-08-24 05:28:07 -04:00
|
|
|
wxEmptyString,
|
|
|
|
bitmap,
|
|
|
|
disabled_bitmap,
|
|
|
|
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
|
|
|
|
short_help_string,
|
|
|
|
long_help_string,
|
|
|
|
client_data);
|
|
|
|
}
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddLabel(int tool_id,
|
2008-08-24 05:28:07 -04:00
|
|
|
const wxString& label = wxEmptyString,
|
|
|
|
const int width = -1);
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddControl(wxControl* control,
|
2008-08-24 05:28:07 -04:00
|
|
|
const wxString& label = wxEmptyString);
|
2008-10-01 06:42:50 -04:00
|
|
|
wxAuiToolBarItem* AddSeparator();
|
|
|
|
wxAuiToolBarItem* AddSpacer(int pixels);
|
|
|
|
wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
bool Realize();
|
|
|
|
|
|
|
|
wxControl* FindControl(int window_id);
|
|
|
|
wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
|
|
|
|
wxAuiToolBarItem* FindToolByIndex(int idx) const;
|
|
|
|
wxAuiToolBarItem* FindTool(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void ClearTools() { Clear() ; }
|
|
|
|
void Clear();
|
|
|
|
bool DeleteTool(int tool_id);
|
|
|
|
bool DeleteByIndex(int tool_id);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
size_t GetToolCount() const;
|
|
|
|
int GetToolPos(int tool_id) const { return GetToolIndex(tool_id); }
|
|
|
|
int GetToolIndex(int tool_id) const;
|
|
|
|
bool GetToolFits(int tool_id) const;
|
|
|
|
wxRect GetToolRect(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
bool GetToolFitsByIndex(int tool_id) const;
|
2008-08-24 05:28:07 -04:00
|
|
|
bool GetToolBarFits() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); }
|
|
|
|
void SetMargins(int x, int y) { SetMargins(x, x, y, y); }
|
|
|
|
void SetMargins(int left, int right, int top, int bottom);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolBitmapSize(const wxSize& size);
|
|
|
|
wxSize GetToolBitmapSize() const;
|
|
|
|
|
|
|
|
bool GetOverflowVisible() const;
|
|
|
|
void SetOverflowVisible(bool visible);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
bool GetGripperVisible() const;
|
|
|
|
void SetGripperVisible(bool visible);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void ToggleTool(int tool_id, bool state);
|
|
|
|
bool GetToolToggled(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void EnableTool(int tool_id, bool state);
|
|
|
|
bool GetToolEnabled(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolDropDown(int tool_id, bool dropdown);
|
|
|
|
bool GetToolDropDown(int tool_id) const;
|
|
|
|
|
|
|
|
void SetToolBorderPadding(int padding);
|
|
|
|
int GetToolBorderPadding() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolTextOrientation(int orientation);
|
|
|
|
int GetToolTextOrientation() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolPacking(int packing);
|
|
|
|
int GetToolPacking() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolProportion(int tool_id, int proportion);
|
|
|
|
int GetToolProportion(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolSeparation(int separation);
|
|
|
|
int GetToolSeparation() const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetToolSticky(int tool_id, bool sticky);
|
|
|
|
bool GetToolSticky(int tool_id) const;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxString GetToolLabel(int tool_id) const;
|
|
|
|
void SetToolLabel(int tool_id, const wxString& label);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxBitmap GetToolBitmap(int tool_id) const;
|
|
|
|
void SetToolBitmap(int tool_id, const wxBitmap& bitmap);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxString GetToolShortHelp(int tool_id) const;
|
|
|
|
void SetToolShortHelp(int tool_id, const wxString& help_string);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
wxString GetToolLongHelp(int tool_id) const;
|
|
|
|
void SetToolLongHelp(int tool_id, const wxString& help_string);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
|
|
|
|
const wxAuiToolBarItemArray& append);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void OnCustomRender(wxDC& WXUNUSED(dc),
|
|
|
|
const wxAuiToolBarItem& WXUNUSED(item),
|
|
|
|
const wxRect& WXUNUSED(rect)) { }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void DoIdleUpdate();
|
|
|
|
void SetOrientation(int orientation);
|
|
|
|
void SetHoverItem(wxAuiToolBarItem* item);
|
|
|
|
void SetPressedItem(wxAuiToolBarItem* item);
|
|
|
|
void RefreshOverflowState();
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
int GetOverflowState() const;
|
|
|
|
wxRect GetOverflowRect() const;
|
|
|
|
wxSize GetLabelSize(const wxString& label);
|
|
|
|
wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const;
|
|
|
|
|
|
|
|
void DoSetSize(int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
protected: // handlers
|
|
|
|
|
|
|
|
void OnSize(wxSizeEvent& evt);
|
|
|
|
void OnIdle(wxIdleEvent& evt);
|
|
|
|
void OnPaint(wxPaintEvent& evt);
|
|
|
|
void OnEraseBackground(wxEraseEvent& evt);
|
|
|
|
void OnLeftDown(wxMouseEvent& evt);
|
|
|
|
void OnLeftUp(wxMouseEvent& evt);
|
|
|
|
void OnRightDown(wxMouseEvent& evt);
|
|
|
|
void OnRightUp(wxMouseEvent& evt);
|
|
|
|
void OnMiddleDown(wxMouseEvent& evt);
|
|
|
|
void OnMiddleUp(wxMouseEvent& evt);
|
|
|
|
void OnMotion(wxMouseEvent& evt);
|
|
|
|
void OnLeaveWindow(wxMouseEvent& evt);
|
|
|
|
void OnSetCursor(wxSetCursorEvent& evt);
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
wxAuiToolBarItemArray m_items; // array of toolbar items
|
|
|
|
wxAuiToolBarArt* m_art; // art provider
|
|
|
|
wxBoxSizer* m_sizer; // main sizer for toolbar
|
|
|
|
wxAuiToolBarItem* m_action_item; // item that's being acted upon (pressed)
|
|
|
|
wxAuiToolBarItem* m_tip_item; // item that has its tooltip shown
|
|
|
|
wxBitmap m_bitmap; // double-buffer bitmap
|
|
|
|
wxSizerItem* m_gripper_sizer_item;
|
|
|
|
wxSizerItem* m_overflow_sizer_item;
|
|
|
|
wxSize m_absolute_min_size;
|
|
|
|
wxPoint m_action_pos; // position of left-mouse down
|
|
|
|
wxAuiToolBarItemArray m_custom_overflow_prepend;
|
|
|
|
wxAuiToolBarItemArray m_custom_overflow_append;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
int m_button_width;
|
|
|
|
int m_button_height;
|
|
|
|
int m_sizer_element_count;
|
|
|
|
int m_left_padding;
|
|
|
|
int m_right_padding;
|
|
|
|
int m_top_padding;
|
|
|
|
int m_bottom_padding;
|
|
|
|
int m_tool_packing;
|
|
|
|
int m_tool_border_padding;
|
|
|
|
int m_tool_text_orientation;
|
|
|
|
int m_overflow_state;
|
|
|
|
bool m_dragging;
|
|
|
|
bool m_gripper_visible;
|
|
|
|
bool m_overflow_visible;
|
|
|
|
long m_style;
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_CLASS(wxAuiToolBar)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// wx event machinery
|
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
|
2009-02-07 13:59:25 -05:00
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent );
|
2008-08-24 05:28:07 -04:00
|
|
|
|
|
|
|
typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
|
|
|
|
|
|
|
|
#define wxAuiToolBarEventHandler(func) \
|
2009-01-12 09:26:13 -05:00
|
|
|
wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func)
|
2008-09-03 03:28:03 -04:00
|
|
|
|
2008-08-24 05:28:07 -04:00
|
|
|
#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \
|
|
|
|
wx__DECLARE_EVT1(wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn))
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// wxpython/swig event work
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK;
|
|
|
|
%constant wxEventType wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG;
|
|
|
|
|
|
|
|
%pythoncode {
|
|
|
|
EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN, 1 )
|
|
|
|
EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK, 1 )
|
|
|
|
EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG, 1 )
|
|
|
|
}
|
|
|
|
#endif // SWIG
|
|
|
|
|
|
|
|
#endif // wxUSE_AUI
|
|
|
|
#endif // _WX_AUIBAR_H_
|
|
|
|
|