diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-14 17:39:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-14 20:37:31 +0300 |
commit | 9fc07b15f1b051eecd662802162772804dc77b8e (patch) | |
tree | d100d50693fc19edb32d01b9189603bdd3254bd2 | |
parent | 78ae06d2c7b565afe67c5032c872d68a74ea210a (diff) | |
download | manaverse-9fc07b15f1b051eecd662802162772804dc77b8e.tar.gz manaverse-9fc07b15f1b051eecd662802162772804dc77b8e.tar.bz2 manaverse-9fc07b15f1b051eecd662802162772804dc77b8e.tar.xz manaverse-9fc07b15f1b051eecd662802162772804dc77b8e.zip |
Rename class InventoryFilter to RadioGroup.
Add WidgetGroup and TabStrip classes for grouping controls.
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/inventorywindow.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/button.cpp | 53 | ||||
-rw-r--r-- | src/gui/widgets/button.h | 10 | ||||
-rw-r--r-- | src/gui/widgets/radiogroup.cpp | 39 | ||||
-rw-r--r-- | src/gui/widgets/radiogroup.h | 36 | ||||
-rw-r--r-- | src/gui/widgets/tabstrip.cpp | 65 | ||||
-rw-r--r-- | src/gui/widgets/tabstrip.h (renamed from src/gui/widgets/inventoryfilter.h) | 22 | ||||
-rw-r--r-- | src/gui/widgets/widgetgroup.cpp (renamed from src/gui/widgets/inventoryfilter.cpp) | 55 | ||||
-rw-r--r-- | src/gui/widgets/widgetgroup.h | 59 | ||||
-rw-r--r-- | src/guichan/widgets/button.cpp | 81 |
13 files changed, 311 insertions, 137 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 222728ca8..12c739773 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -134,8 +134,6 @@ SET(SRCS gui/widgets/icon.h gui/widgets/inttextfield.cpp gui/widgets/inttextfield.h - gui/widgets/inventoryfilter.cpp - gui/widgets/inventoryfilter.h gui/widgets/itemcontainer.cpp gui/widgets/itemcontainer.h gui/widgets/itemlinkhandler.cpp @@ -170,6 +168,8 @@ SET(SRCS gui/widgets/progressindicator.h gui/widgets/radiobutton.cpp gui/widgets/radiobutton.h + gui/widgets/radiogroup.cpp + gui/widgets/radiogroup.h gui/widgets/resizegrip.cpp gui/widgets/resizegrip.h gui/widgets/scrollarea.cpp @@ -198,6 +198,8 @@ SET(SRCS gui/widgets/guitable.h gui/widgets/tablemodel.cpp gui/widgets/tablemodel.h + gui/widgets/tabstrip.cpp + gui/widgets/tabstrip.h gui/widgets/textbox.cpp gui/widgets/textbox.h gui/widgets/textfield.cpp @@ -210,6 +212,8 @@ SET(SRCS gui/widgets/vertcontainer.h gui/widgets/whispertab.cpp gui/widgets/whispertab.h + gui/widgets/widgetgroup.cpp + gui/widgets/widgetgroup.h gui/widgets/window.cpp gui/widgets/window.h gui/widgets/windowcontainer.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 9c5db0ced..e76e9d866 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -142,14 +142,14 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/flowcontainer.h \ gui/widgets/guildchattab.cpp \ gui/widgets/guildchattab.h \ + gui/widgets/guitable.cpp \ + gui/widgets/guitable.h \ gui/widgets/horizontcontainer.cpp \ gui/widgets/horizontcontainer.h \ gui/widgets/icon.cpp \ gui/widgets/icon.h \ gui/widgets/inttextfield.cpp \ gui/widgets/inttextfield.h \ - gui/widgets/inventoryfilter.cpp \ - gui/widgets/inventoryfilter.h \ gui/widgets/itemcontainer.cpp \ gui/widgets/itemcontainer.h \ gui/widgets/itemlinkhandler.cpp \ @@ -184,6 +184,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/progressindicator.h \ gui/widgets/radiobutton.cpp \ gui/widgets/radiobutton.h \ + gui/widgets/radiogroup.cpp \ + gui/widgets/radiogroup.h \ gui/widgets/resizegrip.cpp \ gui/widgets/resizegrip.h \ gui/widgets/scrollarea.cpp \ @@ -208,10 +210,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/tab.h \ gui/widgets/tabbedarea.cpp \ gui/widgets/tabbedarea.h \ - gui/widgets/guitable.cpp \ - gui/widgets/guitable.h \ gui/widgets/tablemodel.cpp \ gui/widgets/tablemodel.h \ + gui/widgets/tabstrip.cpp \ + gui/widgets/tabstrip.h \ gui/widgets/textbox.cpp \ gui/widgets/textbox.h \ gui/widgets/textfield.cpp \ @@ -224,6 +226,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/vertcontainer.h \ gui/widgets/whispertab.cpp \ gui/widgets/whispertab.h \ + gui/widgets/widgetgroup.cpp \ + gui/widgets/widgetgroup.h \ gui/widgets/window.cpp \ gui/widgets/window.h \ gui/widgets/windowcontainer.cpp \ diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index f905bb5b9..d6fb95fe7 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -41,13 +41,13 @@ #include "gui/widgets/button.h" #include "gui/widgets/container.h" #include "gui/widgets/dropdown.h" -#include "gui/widgets/inventoryfilter.h" #include "gui/widgets/itemcontainer.h" #include "gui/widgets/label.h" #include "gui/widgets/layout.h" #include "gui/widgets/progressbar.h" #include "gui/widgets/radiobutton.h" #include "gui/widgets/scrollarea.h" +#include "gui/widgets/tabstrip.h" #include "gui/widgets/textfield.h" #include "net/inventoryhandler.h" @@ -139,7 +139,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS); int size = config.getIntValue("fontSize"); - mFilter = new InventoryFilter("filter_" + getWindowName(), size, 0); + mFilter = new TabStrip("filter_" + getWindowName(), size + 8, 0); mFilter->addActionListener(this); mFilter->setActionEventId("tag_"); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index c4e0f66a6..c2a214423 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -38,7 +38,7 @@ class DropDown; class Item; class ItemContainer; -class InventoryFilter; +class TabStrip; class LayoutCell; class ProgressBar; class SortListModel; @@ -163,7 +163,7 @@ class InventoryWindow : public Window, gcn::Label *mWeightLabel, *mSlotsLabel, *mFilterLabel; ProgressBar *mWeightBar, *mSlotsBar; - InventoryFilter *mFilter; + TabStrip *mFilter; DropDown *mSortDropDown; SortListModel *mSortModel; TextField *mNameFilter; diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 9519c144f..88d9311b9 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -79,7 +79,9 @@ Button::Button() : mXOffset(0), mYOffset(0), mImages(nullptr), - mImageSet(nullptr) + mImageSet(nullptr), + mStick(false), + mPressed(false) { init(); adjustSize(); @@ -99,7 +101,9 @@ Button::Button(const std::string &caption, const std::string &actionEventId, mImages(nullptr), mImageSet(nullptr), mImageWidth(0), - mImageHeight(0) + mImageHeight(0), + mStick(false), + mPressed(false) { init(); adjustSize(); @@ -125,7 +129,9 @@ Button::Button(const std::string &caption, const std::string &imageName, mImages(nullptr), mImageSet(nullptr), mImageWidth(imageWidth), - mImageHeight(imageHeight) + mImageHeight(imageHeight), + mStick(false), + mPressed(false) { init(); loadImage(imageName); @@ -151,7 +157,9 @@ Button::Button(const std::string &imageName, int imageWidth, int imageHeight, mImages(nullptr), mImageSet(nullptr), mImageWidth(imageWidth), - mImageHeight(imageHeight) + mImageHeight(imageHeight), + mStick(false), + mPressed(false) { init(); loadImage(imageName); @@ -286,7 +294,7 @@ void Button::draw(gcn::Graphics *graphics) if (!isEnabled()) mode = BUTTON_DISABLED; - else if (isPressed()) + else if (isPressed2()) mode = BUTTON_PRESSED; else if (mHasMouse || isFocused()) mode = BUTTON_HIGHLIGHTED; @@ -399,18 +407,22 @@ void Button::draw(gcn::Graphics *graphics) void Button::mouseReleased(gcn::MouseEvent& mouseEvent) { - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT - && mMousePressed && mHasMouse) - { - mMousePressed = false; - mClickCount = mouseEvent.getClickCount(); - distributeActionEvent(); - mouseEvent.consume(); - } - else if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) { - mMousePressed = false; - mClickCount = 0; + if (mStick) + mPressed = !mPressed; + + if (mMousePressed && mHasMouse) + { + mMousePressed = false; + mClickCount = mouseEvent.getClickCount(); + distributeActionEvent(); + } + else + { + mMousePressed = false; + mClickCount = 0; + } mouseEvent.consume(); } } @@ -446,7 +458,6 @@ void Button::adjustSize() void Button::setCaption(const std::string& caption) { mCaption = caption; -// adjustSize(); } void Button::keyPressed(gcn::KeyEvent& keyEvent) @@ -467,7 +478,15 @@ void Button::keyReleased(gcn::KeyEvent& keyEvent) if (key.getValue() == gcn::Key::SPACE && mKeyPressed) { mKeyPressed = false; + if (mStick) + mPressed = !mPressed; distributeActionEvent(); keyEvent.consume(); } } + + +bool Button::isPressed2() +{ + return (mPressed || isPressed()); +} diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 8e4cdd9e6..c2d8b0b52 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -103,6 +103,12 @@ class Button : public gcn::Button, public gcn::WidgetListener int getTag() const { return mTag; } + void setStick(bool b) + { mStick = b; } + + void setPressed(bool b) + { mPressed = b; } + void widgetResized(const gcn::Event &event); void widgetMoved(const gcn::Event &event); @@ -117,6 +123,8 @@ class Button : public gcn::Button, public gcn::WidgetListener void keyReleased(gcn::KeyEvent &keyEvent); + bool isPressed2(); + private: void init(); @@ -138,6 +146,8 @@ class Button : public gcn::Button, public gcn::WidgetListener ImageSet *mImageSet; int mImageWidth; int mImageHeight; + bool mStick; + bool mPressed; }; #endif diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp new file mode 100644 index 000000000..24813f6e2 --- /dev/null +++ b/src/gui/widgets/radiogroup.cpp @@ -0,0 +1,39 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "gui/widgets/radiogroup.h" + +#include "gui/widgets/radiobutton.h" + +#include "logger.h" + +#include "debug.h" + +RadioGroup::RadioGroup(std::string group, int height, int spacing) : + WidgetGroup(group, height, spacing) +{ +} + +gcn::Widget *RadioGroup::createWidget(std::string text) +{ + RadioButton *widget = new RadioButton(text, mGroup, mCount == 0); + widget->adjustSize(); + return widget; +} diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h new file mode 100644 index 000000000..07f2a8e34 --- /dev/null +++ b/src/gui/widgets/radiogroup.h @@ -0,0 +1,36 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GUI_RADIOGROUP_H +#define GUI_RADIOGROUP_H + +#include "gui/widgets/widgetgroup.h" + +#include <guichan/widget.hpp> + +class RadioGroup : public WidgetGroup +{ + public: + RadioGroup(std::string group, int height, int spacing); + + gcn::Widget *createWidget(std::string name); +}; + +#endif diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp new file mode 100644 index 000000000..6dcf02008 --- /dev/null +++ b/src/gui/widgets/tabstrip.cpp @@ -0,0 +1,65 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "gui/widgets/tabstrip.h" + +#include "gui/widgets/button.h" +#include "gui/widgets/tab.h" + +#include "logger.h" + +#include "debug.h" + +TabStrip::TabStrip(std::string group, int height, int spacing) : + WidgetGroup(group, height, spacing) +{ +} + +gcn::Widget *TabStrip::createWidget(std::string text) +{ + Button *widget = new Button(); + widget->setStick(true); + widget->setCaption(text); + widget->adjustSize(); + if (!mCount) + widget->setPressed(true); + return widget; +} + +void TabStrip::action(const gcn::ActionEvent &event) +{ + WidgetGroup::action(event); + if (event.getSource()) + { + gcn::Widget *widget = event.getSource(); + if (static_cast<Button*>(widget)->isPressed2()) + { + WidgetListConstIterator iter; + for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter) + { + if (*iter != widget) + { + Button *button = static_cast<Button*>(*iter); + button->setPressed(false); + } + } + } + } +} diff --git a/src/gui/widgets/inventoryfilter.h b/src/gui/widgets/tabstrip.h index c4f2b6242..588833606 100644 --- a/src/gui/widgets/inventoryfilter.h +++ b/src/gui/widgets/tabstrip.h @@ -1,6 +1,5 @@ /* * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. @@ -19,27 +18,22 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef GUI_INVENTORYFILTER_H -#define GUI_INVENTORYFILTER_H +#ifndef GUI_TABSTRIP_H +#define GUI_TABSTRIP_H -#include <guichan/actionlistener.hpp> -#include <guichan/widgetlistener.hpp> +#include "gui/widgets/widgetgroup.h" -#include "gui/widgets/horizontcontainer.h" +#include <guichan/actionevent.hpp> +#include <guichan/widget.hpp> -class InventoryFilter : public HorizontContainer, public gcn::ActionListener +class TabStrip : public WidgetGroup { public: - InventoryFilter(std::string group, int height, int spacing); + TabStrip(std::string group, int height, int spacing); - void addButton(std::string tag); - - void addButton(std::string text, std::string tag); + gcn::Widget *createWidget(std::string name); void action(const gcn::ActionEvent &event); - - private: - std::string mGroup; }; #endif diff --git a/src/gui/widgets/inventoryfilter.cpp b/src/gui/widgets/widgetgroup.cpp index 515682cb6..b2b513850 100644 --- a/src/gui/widgets/inventoryfilter.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -18,39 +18,42 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "gui/widgets/inventoryfilter.h" - -#include "gui/widgets/horizontcontainer.h" -#include "gui/widgets/radiobutton.h" +#include "gui/widgets/widgetgroup.h" #include "logger.h" #include "debug.h" -InventoryFilter::InventoryFilter(std::string group, int height, int spacing): - HorizontContainer(height, spacing), - mGroup(group) +WidgetGroup::WidgetGroup(std::string group, int height, int spacing) : + mSpacing(spacing), + mCount(0), + mGroup(group), + mLastX(spacing) { + setHeight(height); + addWidgetListener(this); } -void InventoryFilter::addButton(std::string tag) +void WidgetGroup::addButton(std::string tag) { addButton(tag, tag); } -void InventoryFilter::addButton(std::string text, std::string tag) +void WidgetGroup::addButton(std::string text, std::string tag) { if (text.empty() || tag.empty()) return; - RadioButton *radio = new RadioButton(text, mGroup, mCount == 0); - radio->adjustSize(); - radio->setActionEventId(mActionEventId + tag); - radio->addActionListener(this); - HorizontContainer::add(radio); + Widget *widget = createWidget(text); + if (widget) + { + widget->setActionEventId(mActionEventId + tag); + widget->addActionListener(this); + add(widget, mSpacing); + } } -void InventoryFilter::action(const gcn::ActionEvent &event) +void WidgetGroup::action(const gcn::ActionEvent &event) { ActionListenerIterator iter; for (iter = mActionListeners.begin(); @@ -59,3 +62,25 @@ void InventoryFilter::action(const gcn::ActionEvent &event) (*iter)->action(event); } } + +void WidgetGroup::add(gcn::Widget *widget, int spacing) +{ + if (!widget) + return; + + Container::add(widget); + widget->setPosition(mLastX, spacing); + mCount++; + mLastX += widget->getWidth() + 2 * mSpacing; +} + +void WidgetGroup::clear() +{ + Container::clear(); + + mCount = 0; +} + +void WidgetGroup::widgetResized(const gcn::Event &event A_UNUSED) +{ +} diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h new file mode 100644 index 000000000..7b8abd8e9 --- /dev/null +++ b/src/gui/widgets/widgetgroup.h @@ -0,0 +1,59 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GUI_WIDGETGROUP_H +#define GUI_WIDGETGROUP_H + +#include "gui/widgets/container.h" + +#include <guichan/actionlistener.hpp> +#include <guichan/widgetlistener.hpp> + +class WidgetGroup : public Container, + public gcn::WidgetListener, + public gcn::ActionListener +{ + public: + WidgetGroup(std::string group, int height, int spacing); + + virtual void addButton(std::string tag); + + virtual void addButton(std::string text, std::string tag); + + void action(const gcn::ActionEvent &event); + + virtual void add(gcn::Widget *widget, int spacing); + + virtual void clear(); + + void widgetResized(const gcn::Event &event); + + virtual Widget *createWidget(std::string name) = 0; + + protected: + int mSpacing; + int mCount; + std::string mGroup; + + private: + int mLastX; +}; + +#endif diff --git a/src/guichan/widgets/button.cpp b/src/guichan/widgets/button.cpp index 42dc686f0..f30c890b4 100644 --- a/src/guichan/widgets/button.cpp +++ b/src/guichan/widgets/button.cpp @@ -122,83 +122,6 @@ namespace gcn return mSpacing; } -/* - void Button::draw(Graphics* graphics) - { - Color faceColor = getBaseColor(); - Color highlightColor, shadowColor; - int alpha = getBaseColor().a; - - if (isPressed()) - { - faceColor = faceColor - 0x303030; - faceColor.a = alpha; - highlightColor = faceColor - 0x303030; - highlightColor.a = alpha; - shadowColor = faceColor + 0x303030; - shadowColor.a = alpha; - } - else - { - highlightColor = faceColor + 0x303030; - highlightColor.a = alpha; - shadowColor = faceColor - 0x303030; - shadowColor.a = alpha; - } - - graphics->setColor(faceColor); - graphics->fillRectangle(Rectangle(1, 1, - getDimension().width - 1, getHeight() - 1)); - - graphics->setColor(highlightColor); - graphics->drawLine(0, 0, getWidth() - 1, 0); - graphics->drawLine(0, 1, 0, getHeight() - 1); - - graphics->setColor(shadowColor); - graphics->drawLine(getWidth() - 1, 1, getWidth() - 1, getHeight() - 1); - graphics->drawLine(1, getHeight() - 1, - getWidth() - 1, getHeight() - 1); - - graphics->setColor(getForegroundColor()); - - int textX; - int textY = getHeight() / 2 - getFont()->getHeight() / 2; - - switch (getAlignment()) - { - case Graphics::LEFT: - textX = mSpacing; - break; - case Graphics::CENTER: - textX = getWidth() / 2; - break; - case Graphics::RIGHT: - textX = getWidth() - mSpacing; - break; - default: - throw GCN_EXCEPTION("Unknown alignment."); - } - - graphics->setFont(getFont()); - - if (isPressed()) - { - graphics->drawText(getCaption(), textX + 1, textY + 1, - getAlignment()); - } - else - { - graphics->drawText(getCaption(), textX, textY, getAlignment()); - - if (isFocused()) - { - graphics->drawRectangle(Rectangle(2, 2, getWidth() - 4, - getHeight() - 4)); - } - } - } -*/ - void Button::adjustSize() { setWidth(getFont()->getWidth(mCaption) + 2*mSpacing); @@ -208,13 +131,9 @@ namespace gcn bool Button::isPressed() const { if (mMousePressed) - { return mHasMouse; - } else - { return mKeyPressed; - } } void Button::mousePressed(MouseEvent& mouseEvent) |