diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 5 | ||||
-rw-r--r-- | src/gui/char_select.h | 5 | ||||
-rw-r--r-- | src/gui/chat.cpp | 2 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/equipmentwindow.h | 3 | ||||
-rw-r--r-- | src/gui/gui.cpp | 10 | ||||
-rw-r--r-- | src/gui/itemcontainer.cpp | 21 | ||||
-rw-r--r-- | src/gui/itemcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/ministatus.cpp | 42 | ||||
-rw-r--r-- | src/gui/ministatus.h | 10 | ||||
-rw-r--r-- | src/gui/setup.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_joystick.cpp | 57 | ||||
-rw-r--r-- | src/gui/setup_joystick.h | 6 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 78 | ||||
-rw-r--r-- | src/gui/setup_video.h | 16 | ||||
-rw-r--r-- | src/gui/window.cpp | 21 | ||||
-rw-r--r-- | src/gui/window.h | 20 |
17 files changed, 258 insertions, 53 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index adcbe290..042a5be8 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -224,6 +224,11 @@ void CharSelectDialog::logic() updatePlayerInfo(); } +std::string CharSelectDialog::getName() +{ + return mNameLabel->getCaption(); +} + CharCreateDialog::CharCreateDialog(Window *parent, int slot): Window("Create Character", true, parent), mSlot(slot) { diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 73fc8b2d..06881bb5 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -54,6 +54,11 @@ class CharSelectDialog : public Window, public gcn::ActionListener void logic(); + /** + * Returns name of selected player + */ + std::string getName(); + private: LockedArray<LocalPlayer*> *mCharInfo; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 9098f9f0..9a5d60b0 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -395,7 +395,7 @@ ChatWindow::setInputText(std::string input_str) void ChatWindow::setVisible(bool isVisible) { - Widget::setVisible(isVisible); + Window::setVisible(isVisible); /* * For whatever reason, if setVisible is called, the mTmpVisible effect diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index bef39dff..2cbffde4 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -40,15 +40,10 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment): setWindowName("Equipment"); setDefaultSize(5, 230, 200, 120); loadWindowState(); - - mItemset = ResourceManager::getInstance()->getSpriteset( - "graphics/sprites/items.png", 32, 32); - if (!mItemset) logger->error("Unable to load items.png"); } EquipmentWindow::~EquipmentWindow() { - mItemset->decRef(); } void EquipmentWindow::draw(gcn::Graphics *graphics) @@ -70,7 +65,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) continue; } - image = mItemset->get(item->getInfo()->getImage() - 1); + image = item->getInfo()->getImage(); dynamic_cast<Graphics*>(graphics)->drawImage( image, 36 * (i % 4) + 10, 36 * (i / 4) + 25); } @@ -81,7 +76,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) return; } - image = mItemset->get(item->getInfo()->getImage() - 1); + image = item->getInfo()->getImage(); dynamic_cast<Graphics*>(graphics)->drawImage(image, 160, 25); graphics->drawText(toString(item->getQuantity()), 170, 62, diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index aeaae58c..99a3cc60 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -27,7 +27,6 @@ #include "window.h" class Equipment; -class Spriteset; /** * Equipment dialog. @@ -53,8 +52,6 @@ class EquipmentWindow : public Window void draw(gcn::Graphics *graphics); private: - Spriteset *mItemset; - Equipment *mEquipment; }; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 69563dc1..b27868e3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -27,11 +27,13 @@ #include <guichan/image.hpp> #include <guichan/imagefont.hpp> - -// Moved up because of nested inclusion of winnt.h which defines DELETE -// constant as well as guichan does +// Should stay here because of Guichan being sensitive to headers order #include <guichan/sdl/sdlinput.hpp> +#ifdef USE_OPENGL +#include "../resources/openglsdlimageloader.h" +#endif + #include "focushandler.h" #include "popupmenu.h" #include "window.h" @@ -231,6 +233,7 @@ Gui::draw() void Gui::mousePress(int mx, int my, int button) { + printf("Gui::mousePress(%d,%d)\n", mx, my); // Mouse pressed on window container (basically, the map) // Are we in-game yet? @@ -247,6 +250,7 @@ Gui::mousePress(int mx, int my, int button) int tilex = (mx + camera_x) / 32; int tiley = (my + camera_y) / 32; + printf("tilex,tiley: %d,%d\n", tilex, tiley); // Right click might open a popup if (button == gcn::MouseInput::RIGHT) diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index edcf9764..c7c55fd9 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -41,8 +41,6 @@ ItemContainer::ItemContainer(Inventory *inventory): mInventory(inventory) { ResourceManager *resman = ResourceManager::getInstance(); - mItemset = resman->getSpriteset("graphics/sprites/items.png", 32, 32); - if (!mItemset) logger->error("Unable to load items.png"); mSelImg = resman->getImage("graphics/gui/selection.png"); if (!mSelImg) logger->error("Unable to load selection.png"); @@ -55,7 +53,6 @@ ItemContainer::ItemContainer(Inventory *inventory): ItemContainer::~ItemContainer() { - mItemset->decRef(); mSelImg->decRef(); } @@ -73,8 +70,8 @@ void ItemContainer::logic() void ItemContainer::draw(gcn::Graphics* graphics) { - int gridWidth = mItemset->get(0)->getWidth() + 4; - int gridHeight = mItemset->get(0)->getHeight() + 10; + int gridWidth = 36; //(item icon width + 4) + int gridHeight = 42; //(item icon height + 10) int columns = getWidth() / gridWidth; // Have at least 1 column @@ -113,11 +110,11 @@ void ItemContainer::draw(gcn::Graphics* graphics) } // Draw item icon - int idx; - if ((idx = item->getInfo()->getImage()) > 0) + Image* image; + if ((image = item->getInfo()->getImage()) != NULL) { dynamic_cast<Graphics*>(graphics)->drawImage( - mItemset->get(idx - 1), itemX, itemY); + image, itemX, itemY); } // Draw item caption @@ -133,8 +130,8 @@ void ItemContainer::setWidth(int width) { gcn::Widget::setWidth(width); - int gridWidth = mItemset->get(0)->getWidth() + 4; - int gridHeight = mItemset->get(0)->getHeight() + 14; + int gridWidth = 36; //item icon width + 4 + int gridHeight = 46; //item icon height + 14 int columns = getWidth() / gridWidth; if (columns < 1) @@ -158,8 +155,8 @@ void ItemContainer::selectNone() void ItemContainer::mousePress(int mx, int my, int button) { - int gridWidth = mItemset->get(0)->getWidth() + 4; - int gridHeight = mItemset->get(0)->getHeight() + 10; + int gridWidth = 36; //(item icon width + 4) + int gridHeight = 42; //(item icon height + 10) int columns = getWidth() / gridWidth; if (button == gcn::MouseInput::LEFT || gcn::MouseInput::RIGHT) diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 63e8bf47..f52f37ec 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -30,7 +30,6 @@ class Image; class Inventory; class Item; -class Spriteset; /** * An item container. Used to show items in inventory and trade dialog. @@ -83,7 +82,6 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener private: Inventory *mInventory; - Spriteset *mItemset; Image *mSelImg; Item *mSelectedItem; diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 53849550..932b1f22 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -29,6 +29,8 @@ #include "progressbar.h" #include "../localplayer.h" +#include "../configuration.h" +#include "../graphics.h" #include "../utils/tostring.h" @@ -42,31 +44,40 @@ MiniStatusWindow::MiniStatusWindow(): mHpBar = new ProgressBar(1.0f, 100, 20, 0, 171, 34); mMpBar = new ProgressBar(1.0f, 100, 20, 26, 102, 230); + mXpBar = new ProgressBar(1.0f, 100, 20, 143, 192, 211); mHpLabel = new gcn::Label(""); mMpLabel = new gcn::Label(""); + mXpLabel = new gcn::Label(""); mHpBar->setPosition(0, 3); mMpBar->setPosition(mHpBar->getWidth() + 3, 3); + mXpBar->setPosition(mMpBar->getX() + mMpBar->getWidth() + 3, 3); mHpLabel->setDimension(mHpBar->getDimension()); mMpLabel->setDimension(mMpBar->getDimension()); + mXpLabel->setDimension(mXpBar->getDimension()); mHpLabel->setForegroundColor(gcn::Color(255, 255, 255)); mMpLabel->setForegroundColor(gcn::Color(255, 255, 255)); + mXpLabel->setForegroundColor(gcn::Color(255, 255, 255)); mHpLabel->setFont(speechFont); mMpLabel->setFont(speechFont); + mXpLabel->setFont(speechFont); mHpLabel->setAlignment(gcn::Graphics::CENTER); mMpLabel->setAlignment(gcn::Graphics::CENTER); + mXpLabel->setAlignment(gcn::Graphics::CENTER); add(mHpBar); add(mMpBar); + add(mXpBar); add(mHpLabel); add(mMpLabel); + add(mXpLabel); - setDefaultSize(0, 0, mMpBar->getX() + mMpBar->getWidth(), - mMpBar->getY() + mMpBar->getHeight()); + setDefaultSize(0, 0, mXpBar->getX() + mXpBar->getWidth(), + mXpBar->getY() + mXpBar->getHeight()); } void MiniStatusWindow::update() @@ -85,12 +96,33 @@ void MiniStatusWindow::update() mHpBar->setColor(0, 171, 34); // Green } - mHpBar->setProgress((float)player_node->mHp / (float)player_node->mMaxHp); - // mpBar->setProgress((float)player_node->mp / (float)player_node->maxMp); + mHpBar->setProgress((float) player_node->mHp / player_node->mMaxHp); + // mMpBar->setProgress((float) player_node->mMp / player_node->mMaxMp); + mXpBar->setProgress((float) player_node->mXp / player_node->mXpForNextLevel); - // Update and center labels + // Update labels mHpLabel->setCaption(toString(player_node->mHp)); mMpLabel->setCaption(toString(player_node->mMp)); + + std::stringstream updatedText; + updatedText << (int) ( + (float) player_node->mXp / + player_node->mXpForNextLevel * 100) << "%"; + + // Displays the number of monsters to next lvl + // (disabled for now but interesting idea) + /* + if(config.getValue("xpBarMonsterCounterExp", 0)!=0) + { + updatedText << " | " + << (int)(((float)player_node->mXpForNextLevel - (float)player_node->mXp) + / (float)config.getValue("xpBarMonsterCounterExp", 0)) + << " " + << config.getValue("xpBarMonsterCounterName", "Monsters") <<" left..."; + } + */ + + mXpLabel->setCaption(updatedText.str()); } void MiniStatusWindow::draw(gcn::Graphics *graphics) diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index f56f847c..718fe140 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -56,11 +56,15 @@ class MiniStatusWindow : public Window */ void update(); - /** + /* * Mini Status Bars */ - ProgressBar *mHpBar, *mMpBar; - gcn::Label *mHpLabel, *mMpLabel; + ProgressBar *mHpBar; + ProgressBar *mMpBar; + ProgressBar *mXpBar; + gcn::Label *mHpLabel; + gcn::Label *mMpLabel; + gcn::Label *mXpLabel; }; #endif diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 6af9119b..d12ace75 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -43,7 +43,7 @@ Setup::Setup(): Window("Setup") { int width = 230; - int height = 185; + int height = 225; setContentSize(width, height); const char *buttonNames[] = { @@ -58,7 +58,7 @@ Setup::Setup(): } TabbedContainer *panel = new TabbedContainer(); - panel->setDimension(gcn::Rectangle(5, 5, 220, 150)); + panel->setDimension(gcn::Rectangle(5, 5, 220, 185)); panel->setOpaque(false); SetupTab *tab; diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 36b0ee20..d9212728 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -26,22 +26,31 @@ #include <guichan/widgets/label.hpp> #include "button.h" - +#include "checkbox.h" +#include "../configuration.h" #include "../joystick.h" extern Joystick *joystick; Setup_Joystick::Setup_Joystick(): mCalibrateLabel(new gcn::Label("Press the button to start calibration")), - mCalibrateButton(new Button("Calibrate", "calibrate", this)) + mCalibrateButton(new Button("Calibrate", "calibrate", this)), + mJoystickEnabled(new CheckBox("Enable joystick")) { setOpaque(false); + mJoystickEnabled->setPosition(10, 10); + mCalibrateLabel->setPosition(10, 25); + mCalibrateButton->setPosition(10, 30 + mCalibrateLabel->getHeight()); + + mOriginalJoystickEnabled = (joystick ? joystick->isEnabled() : false); + mJoystickEnabled->setMarked(mOriginalJoystickEnabled); - mCalibrateLabel->setPosition(5, 10); - mCalibrateButton->setPosition(10, 20 + mCalibrateLabel->getHeight()); + mJoystickEnabled->setEventId("joystickEnabled"); + mJoystickEnabled->addActionListener(this); add(mCalibrateLabel); add(mCalibrateButton); + add(mJoystickEnabled); } void Setup_Joystick::action(const std::string &event, gcn::Widget *widget) @@ -50,13 +59,37 @@ void Setup_Joystick::action(const std::string &event, gcn::Widget *widget) return; } - if (joystick->isCalibrating()) { - mCalibrateButton->setCaption("Calibrate"); - mCalibrateLabel->setCaption("Press the button to start calibration"); - joystick->finishCalibration(); - } else { - mCalibrateButton->setCaption("Stop"); - mCalibrateLabel->setCaption("Rotate the stick"); - joystick->startCalibration(); + if (event == "joystickEnabled") + { + joystick->setEnabled(mJoystickEnabled->isMarked()); + } + else + { + if (joystick->isCalibrating()) { + mCalibrateButton->setCaption("Calibrate"); + mCalibrateLabel->setCaption( + "Press the button to start calibration"); + joystick->finishCalibration(); + } else { + mCalibrateButton->setCaption("Stop"); + mCalibrateLabel->setCaption("Rotate the stick"); + joystick->startCalibration(); + } } } + +void Setup_Joystick::cancel() +{ + if (joystick) + { + joystick->setEnabled(mOriginalJoystickEnabled); + } + mJoystickEnabled->setMarked(mOriginalJoystickEnabled); +} + +void Setup_Joystick::apply() +{ + config.setValue("joystickEnabled", + joystick ? joystick->isEnabled() : false); +} + diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index da773c8f..4cc2b3d9 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -35,14 +35,16 @@ class Setup_Joystick : public SetupTab, public gcn::ActionListener public: Setup_Joystick(); - void apply() {} - void cancel() {} + void apply(); + void cancel(); void action(const std::string& eventId, gcn::Widget* widget); private: gcn::Label *mCalibrateLabel; gcn::Button *mCalibrateButton; + bool mOriginalJoystickEnabled; + gcn::CheckBox *mJoystickEnabled; }; #endif diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7ac226d3..7c72975a 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -115,7 +115,13 @@ Setup_Video::Setup_Video(): mAlphaSlider(new Slider(0.2, 1.0)), mFpsCheckBox(new CheckBox("FPS Limit: ")), mFpsSlider(new Slider(10, 200)), - mFpsField(new TextField()) + mFpsField(new TextField()), + mOriginalScrollLaziness((int) config.getValue("ScrollLaziness", 32)), + mScrollLazinessSlider(new Slider(1, 64)), + mScrollLazinessField(new TextField()), + mOriginalScrollRadius((int) config.getValue("ScrollRadius", 32)), + mScrollRadiusSlider(new Slider(0, 128)), + mScrollRadiusField(new TextField()) { setOpaque(false); @@ -153,12 +159,36 @@ Setup_Video::Setup_Video(): mAlphaSlider->setEventId("guialpha"); mFpsCheckBox->setEventId("fpslimitcheckbox"); mFpsSlider->setEventId("fpslimitslider"); + mScrollRadiusSlider->setEventId("scrollradiusslider"); + mScrollRadiusField->setEventId("scrollradiusfield"); + mScrollLazinessSlider->setEventId("scrolllazinessslider"); + mScrollLazinessField->setEventId("scrolllazinessfield"); mCustomCursorCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); mFpsCheckBox->addActionListener(this); mFpsSlider->addActionListener(this); mFpsField->addKeyListener(this); + mScrollRadiusSlider->addActionListener(this); + mScrollRadiusField->addKeyListener(this); + mScrollLazinessSlider->addActionListener(this); + mScrollLazinessField->addKeyListener(this); + + mScrollRadiusSlider->setDimension(gcn::Rectangle(10, 120, 75, 10)); + gcn::Label *scrollRadiusLabel = new gcn::Label("Scroll radius"); + scrollRadiusLabel->setPosition(90, 120); + mScrollRadiusField->setPosition(180, 120); + mScrollRadiusField->setWidth(30); + mScrollRadiusField->setText(toString(mOriginalScrollRadius)); + mScrollRadiusSlider->setValue(mOriginalScrollRadius); + + mScrollLazinessSlider->setDimension(gcn::Rectangle(10, 140, 75, 10)); + gcn::Label *scrollLazinessLabel = new gcn::Label("Scroll laziness"); + scrollLazinessLabel->setPosition(90, 140); + mScrollLazinessField->setPosition(180, 140); + mScrollLazinessField->setWidth(30); + mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); + mScrollLazinessSlider->setValue(mOriginalScrollLaziness); add(scrollArea); add(mFsCheckBox); @@ -169,6 +199,12 @@ Setup_Video::Setup_Video(): add(mFpsCheckBox); add(mFpsSlider); add(mFpsField); + add(mScrollRadiusSlider); + add(scrollRadiusLabel); + add(mScrollRadiusField); + add(mScrollLazinessSlider); + add(scrollLazinessLabel); + add(mScrollLazinessField); } Setup_Video::~Setup_Video() @@ -225,6 +261,27 @@ void Setup_Video::apply() mOpenGLEnabled = config.getValue("opengl", 0); } +int +Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field, + const std::string &configName) +{ + int value; + std::stringstream temp(field->getText()); + temp >> value; + if (value < slider->getScaleStart()) + { + value = (int) slider->getScaleStart(); + } + else if (value > slider->getScaleEnd()) + { + value = (int) slider->getScaleEnd(); + } + field->setText(toString(value)); + slider->setValue(value); + config.setValue(configName, value); + return value; +} + void Setup_Video::cancel() { mFsCheckBox->setMarked(mFullScreenEnabled); @@ -232,6 +289,11 @@ void Setup_Video::cancel() mCustomCursorCheckBox->setMarked(mCustomCursorEnabled); mAlphaSlider->setValue(mOpacity); + mScrollRadiusField->setText(toString(mOriginalScrollRadius)); + mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); + updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius"); + updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness"); + config.setValue("screen", mFullScreenEnabled ? 1 : 0); config.setValue("customcursor", mCustomCursorEnabled ? 1 : 0); config.setValue("guialpha", mOpacity); @@ -254,6 +316,18 @@ void Setup_Video::action(const std::string &event, gcn::Widget *widget) mFps = (int)mFpsSlider->getValue(); mFpsField->setText(toString(mFps)); } + else if (event == "scrollradiusslider") + { + int val = (int)mScrollRadiusSlider->getValue(); + mScrollRadiusField->setText(toString(val)); + config.setValue("ScrollRadius", val); + } + else if (event == "scrolllazinessslider") + { + int val = (int)mScrollLazinessSlider->getValue(); + mScrollLazinessField->setText(toString(val)); + config.setValue("ScrollLaziness", val); + } else if (event == "fpslimitcheckbox") { if (mFpsCheckBox->isMarked()) @@ -293,4 +367,6 @@ void Setup_Video::keyPress(const gcn::Key &key) mFpsField->setText(""); mFps = 0; } + updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius"); + updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness"); } diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index d0a10925..a3fd8884 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -59,10 +59,26 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::CheckBox *mFsCheckBox; gcn::CheckBox *mOpenGLCheckBox; gcn::CheckBox *mCustomCursorCheckBox; + gcn::Slider *mAlphaSlider; gcn::CheckBox *mFpsCheckBox; gcn::Slider *mFpsSlider; gcn::TextField *mFpsField; + + int mOriginalScrollLaziness; + gcn::Slider *mScrollLazinessSlider; + gcn::TextField *mScrollLazinessField; + + int mOriginalScrollRadius; + gcn::Slider *mScrollRadiusSlider; + gcn::TextField *mScrollRadiusField; + + void + updateSliders(bool originalValues); + + int + updateSlider(gcn::Slider *slider, gcn::TextField *field, + const std::string &configName); }; #endif diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 9a07111f..2172baa8 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -63,6 +63,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): mModal(modal), mResizable(false), mMouseResize(false), + mSticky(false), mMinWinWidth(100), mMinWinHeight(28), mMaxWinWidth(INT_MAX), @@ -243,6 +244,26 @@ bool Window::isResizable() return mResizable; } +void Window::setSticky(bool sticky) +{ + mSticky = sticky; +} + +bool Window::isSticky() { + return mSticky; +} + +void Window::setVisible(bool visible) { + if(isSticky()) + { + gcn::Window::setVisible(true); + } + else + { + gcn::Window::setVisible(visible); + } +} + void Window::scheduleDelete() { windowContainer->scheduleDelete(this); diff --git a/src/gui/window.h b/src/gui/window.h index 42ce444c..51c876e3 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -134,6 +134,25 @@ class Window : public gcn::Window void setMaxHeight(unsigned int height); /** + * Sets whether the window is sticky. + * A sticky window will not have its visibility set to false + * on a general setVisible(false) call. + */ + void setSticky(bool sticky); + + /** + * Returns whether the window is sticky. + */ + bool isSticky(); + + /** + * Overloads window setVisible by guichan to allow sticky window + * Handling + */ + + void setVisible(bool visible); + + /** * Returns the parent window. * * @return The parent window or <code>NULL</code> if there is none. @@ -204,6 +223,7 @@ class Window : public gcn::Window bool mModal; /**< Window is modal */ bool mResizable; /**< Window can be resized */ bool mMouseResize; /**< Window is being resized */ + bool mSticky; /**< Window resists minimzation */ int mMinWinWidth; /**< Minimum window width */ int mMinWinHeight; /**< Minimum window height */ int mMaxWinWidth; /**< Maximum window width */ |