Mercurial > fife-parpg
annotate engine/core/gui/widgets/togglebutton.cpp @ 336:16112ef84609
PyChan fixes:
* Previous commits removed the ability to map events to unnamed widgets. Fixed.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 24 Aug 2009 15:34:23 +0000 |
parents | 51cc05d862f2 |
children |
rev | line source |
---|---|
177
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 /*************************************************************************** |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 * Copyright (C) 2005-2008 by the FIFE team * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 * http://www.fifengine.de * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 * This file is part of FIFE. * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 * * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 * FIFE is free software; you can redistribute it and/or * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 * * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 * Lesser General Public License for more details. * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 * * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 * License along with this library; if not, write to the * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 * Free Software Foundation, Inc., * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 ***************************************************************************/ |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 /*************************************************************************** |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 * Note! Group and groupmap borrows heavily from ideas of Guichan library * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 * version 0.8.1 * |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 ***************************************************************************/ |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 // Standard C++ library includes |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 #include <cassert> |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 // 3rd party library includes |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 // FIFE includes |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 // These includes are split up in two parts, separated by one empty line |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 // First block: files included from the FIFE root src directory |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 // Second block: files included from the same folder |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 #include <iostream> |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 #include <guichan/mouseevent.hpp> |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 #include "togglebutton.h" |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 namespace gcn { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 ToggleButton::GroupMap ToggleButton::m_groupMap; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 ToggleButton::ToggleButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption, const std::string& group): |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 Button(), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
49 m_upImage(up_file), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
50 m_downImage(down_file), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 m_hoverImage(hover_file), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 x_downoffset(0), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 y_downoffset(0), |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 m_group(group) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 m_hoverImage = hover_file; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 setFrameSize(0); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 setGroup(m_group); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 adjustSize(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 mCaption = caption; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
61 m_toggled = false; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 addActionListener(this); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
65 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 ToggleButton::~ToggleButton() { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 setGroup(""); // Remove button from group |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
69 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 void ToggleButton::setDownOffset(int x, int y) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 x_downoffset = x; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 y_downoffset = y; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 void ToggleButton::draw(Graphics *graphics) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 Color faceColor = getBaseColor(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 Color highlightColor; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 Color shadowColor; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 int alpha = getBaseColor().a; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 Image* img = NULL; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 int xoffset = 0; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 int yoffset = 0; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 if (isPressed() || m_toggled) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 faceColor = faceColor - 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 faceColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 highlightColor = faceColor - 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 highlightColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 shadowColor = faceColor + 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 shadowColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 if( m_downImage ) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 img = m_downImage; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 xoffset = x_downoffset; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 yoffset = y_downoffset; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 } else if(mHasMouse) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 faceColor = faceColor + 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 faceColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 highlightColor = faceColor + 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 highlightColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 shadowColor = faceColor - 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 shadowColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 if ( m_hoverImage ) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 img = m_hoverImage; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 } else{ |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 highlightColor = faceColor + 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
111 highlightColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 shadowColor = faceColor - 0x303030; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
113 shadowColor.a = alpha; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
114 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 if (m_upImage) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 img = m_upImage; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 graphics->setColor(faceColor); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 graphics->fillRectangle(Rectangle(1, 1, getDimension().width-1, getHeight() - 1)); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 graphics->setColor(highlightColor); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 graphics->drawLine(0, 0, getWidth() - 1, 0); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 graphics->drawLine(0, 1, 0, getHeight() - 1); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 graphics->setColor(shadowColor); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 graphics->drawLine(1, getHeight() - 1, getWidth() - 1, getHeight() - 1); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 graphics->setColor(getForegroundColor()); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
134 if (img) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
135 graphics->drawImage(img, xoffset, yoffset); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
136 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
137 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
138 int textX; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 int textY = getHeight() / 2 - getFont()->getHeight() / 2; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
140 switch (getAlignment()) |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
141 { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 case Graphics::LEFT: |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
143 textX = 4; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
144 break; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
145 case Graphics::CENTER: |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
146 textX = getWidth() / 2; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 break; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 case Graphics::RIGHT: |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
149 textX = getWidth() - 4; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 break; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 default: |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
152 throw GCN_EXCEPTION("Unknown alignment."); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
153 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
154 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 graphics->setFont(getFont()); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 if (mCaption.size() > 0) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
157 if (isPressed()) |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
158 graphics->drawText(getCaption(), textX + 1, |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
159 textY + 1, getAlignment()); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
160 else |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
161 graphics->drawText(getCaption(), textX, textY, getAlignment()); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
162 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
163 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
164 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
165 void ToggleButton::action(const ActionEvent& actionEvent) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
166 setToggled(!m_toggled); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
167 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
168 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
169 void ToggleButton::adjustSize() { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
170 int w = 0; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
171 int h = w; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
172 if( m_upImage ) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
173 w = m_upImage->getWidth(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
174 h = m_upImage->getHeight(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
175 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
176 if( m_downImage ) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
177 w = std::max(m_downImage->getWidth(), w); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
178 h = std::max(m_downImage->getHeight(), h); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
179 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
180 if( m_hoverImage ) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
181 w = std::max(m_hoverImage->getWidth(), w); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
182 h = std::max(m_hoverImage->getHeight(), h); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
183 } |
255
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
184 |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
185 if( mCaption.length() > 0 ) { |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
186 w = std::max(static_cast<int>(getFont()->getWidth(mCaption)+2*mSpacing), w); |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
187 h = std::max(static_cast<int>(getFont()->getHeight()+2*mSpacing), h); |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
188 } |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
238
diff
changeset
|
189 |
177
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
190 setWidth(w); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
191 setHeight(h); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
192 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
193 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
194 void ToggleButton::setUpImage(Image* image) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
195 m_upImage = image; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
196 adjustSize(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
197 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
198 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
199 void ToggleButton::setDownImage(Image* image) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
200 m_downImage = image; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
201 adjustSize(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
202 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
203 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
204 void ToggleButton::setHoverImage(Image* image) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
205 m_hoverImage = image; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
206 adjustSize(); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
207 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
208 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
209 bool ToggleButton::isToggled() const { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
210 return m_toggled; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
211 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
212 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
213 void ToggleButton::setToggled(bool toggled) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
214 if (toggled && m_group != "") { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
215 // untoggle all buttons in group |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
216 GroupIterator iter, iterEnd; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
217 iterEnd = m_groupMap.upper_bound(m_group); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
218 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
219 for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
220 if (iter->second->isToggled()) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
221 iter->second->setToggled(false); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
222 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
223 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
224 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
225 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
226 m_toggled = toggled; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
227 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
228 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
229 void ToggleButton::setGroup(const std::string &group) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
230 // Remove button from previous group |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
231 if (m_group != "") { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
232 GroupIterator iter, iterEnd; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
233 iterEnd = m_groupMap.upper_bound(m_group); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
234 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
235 for (iter = m_groupMap.lower_bound(m_group); iter != iterEnd; iter++) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
236 if (iter->second == this) { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
237 m_groupMap.erase(iter); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
238 break; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
239 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
240 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
241 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
242 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
243 // Add button to new group |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
244 if (group != "") { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
245 m_groupMap.insert( std::pair<std::string, ToggleButton *>(group, this)); |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
246 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
247 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
248 m_group = group; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
249 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
250 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
251 const std::string &ToggleButton::getGroup() const { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
252 return m_group; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
253 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
254 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
255 int ToggleButton::getDownXOffset() const { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
256 return x_downoffset; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
257 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
258 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
259 int ToggleButton::getDownYOffset() const { |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
260 return y_downoffset; |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
261 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
262 |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
263 } |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
264 /* vim: set noexpandtab: set shiftwidth=2: set tabstop=2: */ |
3fb17daa1b27
* Added ToggleButton widget
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
265 |