2
* This file is part of wxSmithAui plugin for Code::Blocks Studio
3
* Copyright (C) 2008-2009 César Fernández Domínguez
5
* wxSmithAui is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmithAui is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmithAui. If not, see <http://www.gnu.org/licenses/>.
19
#include "wxSmithAuiToolBar.h"
21
#if wxCHECK_VERSION(2,8,9)
23
// missing wxITEM_* items, the same as in wx/auibar.cpp, needed for adding spacer exception
26
wxITEM_CONTROL = wxITEM_MAX,
31
wxSmithAuiToolBar::wxSmithAuiToolBar(wxWindow* parent,wxWindowID id,const wxPoint& position,const wxSize& size,long style)
32
: wxAuiToolBar(parent,id,position,size,style)
37
wxSmithAuiToolBar::~wxSmithAuiToolBar()
42
int wxSmithAuiToolBar::HitTest(const wxPoint& pt)
44
for (unsigned int i=0; i<m_items.Count(); i++)
46
wxAuiToolBarItem& Item = m_items.Item(i);
48
if (!Item.GetSizerItem())
51
wxRect rect = Item.GetSizerItem()->GetRect();
52
if ( Item.GetKind() == wxITEM_SPACER )
54
if ( rect.Contains(pt.x,rect.y) )
56
return GetToolIndex(Item.GetId());
60
if ( rect.Contains(pt.x,pt.y) )
62
return GetToolIndex(Item.GetId());
69
void wxSmithAuiToolBar::AddSpacer(int pixels,wxWindowID SpacerId)
71
wxAuiToolBarItem Item;
72
Item.SetHasDropDown(false);
73
Item.SetSpacerPixels(pixels);
75
Item.SetKind(wxITEM_SPACER);
76
Item.SetSticky(false);
81
void wxSmithAuiToolBar::AddStretchSpacer(int proportion,wxWindowID SpacerId)
83
wxAuiToolBarItem item;
84
item.SetHasDropDown(false);
86
item.SetProportion(proportion);
87
item.SetSticky(false);
92
#endif // wxCHECK_VERSION(2,8,9)