From 6e0bf19c43e545c5cb558edd69b40614fe71ca59 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 16 Dec 2004 16:29:47 +0000 Subject: Doxygen improvements. --- docs/SOURCE/tmw.doxcfg | 4 +-- file.list | 4 +-- src/gui/button.cpp | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ src/gui/button.h | 55 ++++++++++++++++++++++++++++ src/gui/char_server.cpp | 6 ++-- src/gui/char_server.h | 12 +++++-- src/gui/checkbox.cpp | 65 +++++++++++++++++++++++++++++++++ src/gui/checkbox.h | 41 +++++++++++++++++++++ src/gui/gui.h | 4 +++ src/gui/login.cpp | 10 +++--- src/gui/login.h | 6 +++- src/gui/mw_button.cpp | 96 ------------------------------------------------- src/gui/mw_button.h | 50 -------------------------- src/gui/mw_checkbox.cpp | 65 --------------------------------- src/gui/mw_checkbox.h | 36 ------------------- 15 files changed, 288 insertions(+), 262 deletions(-) create mode 100644 src/gui/button.cpp create mode 100644 src/gui/button.h create mode 100644 src/gui/checkbox.cpp create mode 100644 src/gui/checkbox.h delete mode 100644 src/gui/mw_button.cpp delete mode 100644 src/gui/mw_button.h delete mode 100644 src/gui/mw_checkbox.cpp delete mode 100644 src/gui/mw_checkbox.h diff --git a/docs/SOURCE/tmw.doxcfg b/docs/SOURCE/tmw.doxcfg index cb786e42..fe5039fb 100644 --- a/docs/SOURCE/tmw.doxcfg +++ b/docs/SOURCE/tmw.doxcfg @@ -137,7 +137,7 @@ SHORT_NAMES = NO # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. -JAVADOC_AUTOBRIEF = NO +JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// @@ -170,7 +170,7 @@ DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. -TAB_SIZE = 2 +TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". diff --git a/file.list b/file.list index 7add2732..46aee9ad 100644 --- a/file.list +++ b/file.list @@ -9,8 +9,8 @@ MODULES = src/sound/sound.cpp \ src/gui/setup.cpp \ src/gui/gui.cpp \ src/gui/login.cpp \ - src/gui/mw_button.cpp \ - src/gui/mw_checkbox.cpp \ + src/gui/button.cpp \ + src/gui/checkbox.cpp \ src/gui/char_server.cpp \ src/gui/char_select.cpp \ src/gui/inventory.cpp \ diff --git a/src/gui/button.cpp b/src/gui/button.cpp new file mode 100644 index 00000000..02a77984 --- /dev/null +++ b/src/gui/button.cpp @@ -0,0 +1,96 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World 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. + * + * The Mana World 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 The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "button.h" + +Button::Button(const std::string& caption): + gcn::Button(caption) +{ + mouseDown = false; + keyDown = false; +} + +void Button::draw(gcn::Graphics* graphics) { + int x, y; + int mode; + int offset = 0; + + getAbsolutePosition(x, y); + + if (false /*disabled*/) { + mode = 3; + } + else if (hasMouse() && mouseDown || keyDown) { + mode = 2; + offset = 1; + } + else if (hasMouse()) { + mode = 1; + } + else { + mode = 0; + } + + draw_skinned_rect(gui_bitmap, &gui_skin.button.background[mode], + x, y, getWidth(), getHeight()); + + int rtm = alfont_text_mode(-1); + gui_text(gui_bitmap, getCaption().c_str(), + x + 2 + offset, y + 4 + offset, + gui_skin.button.textcolor[mode], FALSE); + alfont_text_mode(rtm); +} + +void Button::lostFocus() { + mouseDown = false; + keyDown = false; +} + +void Button::mousePress(int x, int y, int button) { + if (button == gcn::MouseInput::LEFT && hasMouse()) { + mouseDown = true; + } +} + +void Button::mouseRelease(int x, int y, int button) { + if (button == gcn::MouseInput::LEFT) { + mouseDown = false; + } +} + +void Button::keyPress(const gcn::Key& key) { + if (key.getValue() == gcn::Key::ENTER || + key.getValue() == gcn::Key::SPACE) + { + keyDown = true; + } + mouseDown = false; +} + +void Button::keyRelease(const gcn::Key& key) { + if ((key.getValue() == gcn::Key::ENTER || + key.getValue() == gcn::Key::SPACE) && keyDown) + { + keyDown = false; + generateAction(); + } +} + diff --git a/src/gui/button.h b/src/gui/button.h new file mode 100644 index 00000000..d7026951 --- /dev/null +++ b/src/gui/button.h @@ -0,0 +1,55 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World 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. + * + * The Mana World 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 The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _TMW_BUTTON_H +#define _TMW_BUTTON_H + +#include "gui.h" + +/** + * Button widget. Same as the Guichan button but with custom look. + * + * \ingroup GUI + */ +class Button : public gcn::Button { + public: + Button(const std::string& caption); + + // Inherited from Widget + + void draw(gcn::Graphics* graphics); + void lostFocus(); + + // Inherited from MouseListener + + void mousePress(int x, int y, int button); + void mouseRelease(int x, int y, int button); + + // Inherited from KeyListener + + void keyPress(const gcn::Key& key); + void keyRelease(const gcn::Key& key); + + private: + bool mouseDown, keyDown; +}; + +#endif diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index bd02f51a..0bd431a5 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -23,7 +23,7 @@ #include "char_server.h" #include "../graphic/graphic.h" -#include "mw_button.h" +#include "button.h" char server[30]; int showServerList = 1; @@ -65,8 +65,8 @@ void char_server() { dialog = new gcn::Container(); serverList = new gcn::ListBox(serverListModel); scrollArea = new gcn::ScrollArea(serverList); - okButton = new MWButton("OK"); - cancelButton = new MWButton("Cancel"); + okButton = new Button("OK"); + cancelButton = new Button("Cancel"); dialog->setDimension(gcn::Rectangle(300, 200, 200, 100)); scrollArea->setDimension(gcn::Rectangle(4, 4, 192, 55)); diff --git a/src/gui/char_server.h b/src/gui/char_server.h index 521aa4c9..2d694ef4 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -32,13 +32,21 @@ #include "../net/network.h" #include "gui.h" -// The action listener for the server select dialog +/** + * The action listener for the server select dialog. + * + * \ingroup GUI + */ class ServerSelectListener : public gcn::ActionListener { public: void action(const std::string& eventId); }; -// The list model for the server list +/** + * The list model for the server list. + * + * \ingroup GUI + */ class ServerListModel : public gcn::ListModel { public: int getNumberOfElements(); diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp new file mode 100644 index 00000000..9105ae69 --- /dev/null +++ b/src/gui/checkbox.cpp @@ -0,0 +1,65 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World 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. + * + * The Mana World 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 The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "checkbox.h" + +CheckBox::CheckBox(const std::string& caption, bool marked): + gcn::CheckBox(caption, marked) +{ +} + +void CheckBox::draw(gcn::Graphics* graphics) { + BITMAP *box = NULL; + int x, y; + int tx, ty; + int col = 0; + + getAbsolutePosition(x, y); + + if (mMarked) { + if (false /*disabled*/) { + box = gui_skin.checkbox.disabled_checked; + } else { + box = gui_skin.checkbox.checked; + } + } else if (false /*disabled*/) { + box = gui_skin.checkbox.disabled; + } else { + box = gui_skin.checkbox.normal; + } + + if (false /*disabled*/) { + col = gui_skin.checkbox.textcolor[1]; + } else { + col = gui_skin.checkbox.textcolor[0]; + } + + x += 2; + y += 2; + tx = x + box->w + 2; + ty = y - 2; + + masked_blit(box, gui_bitmap, 0, 0, x, y, box->w, box->h); + + int rtm = alfont_text_mode(-1); + gui_text(gui_bitmap, getCaption().c_str(), tx, ty, col, 0); + alfont_text_mode(rtm); +} diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h new file mode 100644 index 00000000..c4240a40 --- /dev/null +++ b/src/gui/checkbox.h @@ -0,0 +1,41 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World 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. + * + * The Mana World 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 The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _TMW_CHECKBOX_H +#define _TMW_CHECKBOX_H + +#include "gui.h" + +/** + * Check box widget. Same as the Guichan check box but with custom look. + * + * \ingroup GUI + */ +class CheckBox : public gcn::CheckBox { + public: + CheckBox(const std::string& caption, bool marked = false); + + // Inherited from Widget + + void draw(gcn::Graphics* graphics); +}; + +#endif diff --git a/src/gui/gui.h b/src/gui/gui.h index 99d302db..0028cb77 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -32,6 +32,10 @@ #include #include +/** + * \defgroup GUI GUI related classes + */ + typedef struct { BITMAP *grid[9]; } LexSkinnedRect; diff --git a/src/gui/login.cpp b/src/gui/login.cpp index bae87745..f0697513 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -23,8 +23,8 @@ #include "login.h" #include "gui.h" -#include "mw_button.h" -#include "mw_checkbox.h" +#include "button.h" +#include "checkbox.h" #include "../graphic/graphic.h" // Dialog parts @@ -75,9 +75,9 @@ void login() { passLabel = new gcn::Label("Password:"); userField = new gcn::TextField("player"); passField = new gcn::TextField(); - keepCheck = new MWCheckBox("Keep", false); - okButton = new MWButton("OK"); - cancelButton = new MWButton("Cancel"); + keepCheck = new CheckBox("Keep", false); + okButton = new Button("OK"); + cancelButton = new Button("Cancel"); dialog->setDimension(gcn::Rectangle(300, 250, 200, 80)); userLabel->setPosition(4, 14); diff --git a/src/gui/login.h b/src/gui/login.h index e823381d..7cafb47f 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -35,7 +35,11 @@ #include #endif -// The action listener for the login dialog +/** + * The action listener for the login dialog. + * + * \ingroup GUI + */ class LoginActionListener : public gcn::ActionListener { public: void action(const std::string& eventId); diff --git a/src/gui/mw_button.cpp b/src/gui/mw_button.cpp deleted file mode 100644 index f7a01176..00000000 --- a/src/gui/mw_button.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "mw_button.h" - -MWButton::MWButton(const std::string& caption): - gcn::Button(caption) -{ - mouseDown = false; - keyDown = false; -} - -void MWButton::draw(gcn::Graphics* graphics) { - int x, y; - int mode; - int offset = 0; - - getAbsolutePosition(x, y); - - if (false /*disabled*/) { - mode = 3; - } - else if (hasMouse() && mouseDown || keyDown) { - mode = 2; - offset = 1; - } - else if (hasMouse()) { - mode = 1; - } - else { - mode = 0; - } - - draw_skinned_rect(gui_bitmap, &gui_skin.button.background[mode], - x, y, getWidth(), getHeight()); - - int rtm = alfont_text_mode(-1); - gui_text(gui_bitmap, getCaption().c_str(), - x + 2 + offset, y + 4 + offset, - gui_skin.button.textcolor[mode], FALSE); - alfont_text_mode(rtm); -} - -void MWButton::lostFocus() { - mouseDown = false; - keyDown = false; -} - -void MWButton::mousePress(int x, int y, int button) { - if (button == gcn::MouseInput::LEFT && hasMouse()) { - mouseDown = true; - } -} - -void MWButton::mouseRelease(int x, int y, int button) { - if (button == gcn::MouseInput::LEFT) { - mouseDown = false; - } -} - -void MWButton::keyPress(const gcn::Key& key) { - if (key.getValue() == gcn::Key::ENTER || - key.getValue() == gcn::Key::SPACE) - { - keyDown = true; - } - mouseDown = false; -} - -void MWButton::keyRelease(const gcn::Key& key) { - if ((key.getValue() == gcn::Key::ENTER || - key.getValue() == gcn::Key::SPACE) && keyDown) - { - keyDown = false; - generateAction(); - } -} - diff --git a/src/gui/mw_button.h b/src/gui/mw_button.h deleted file mode 100644 index 31c7bd44..00000000 --- a/src/gui/mw_button.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _TMW_BUTTON_H -#define _TMW_BUTTON_H - -#include "gui.h" - -class MWButton : public gcn::Button { - public: - MWButton(const std::string& caption); - - // Inherited from Widget - - void draw(gcn::Graphics* graphics); - void lostFocus(); - - // Inherited from MouseListener - - void mousePress(int x, int y, int button); - void mouseRelease(int x, int y, int button); - - // Inherited from KeyListener - - void keyPress(const gcn::Key& key); - void keyRelease(const gcn::Key& key); - - private: - bool mouseDown, keyDown; -}; - -#endif diff --git a/src/gui/mw_checkbox.cpp b/src/gui/mw_checkbox.cpp deleted file mode 100644 index a2b02e6e..00000000 --- a/src/gui/mw_checkbox.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "mw_checkbox.h" - -MWCheckBox::MWCheckBox(const std::string& caption, bool marked): - gcn::CheckBox(caption, marked) -{ -} - -void MWCheckBox::draw(gcn::Graphics* graphics) { - BITMAP *box = NULL; - int x, y; - int tx, ty; - int col = 0; - - getAbsolutePosition(x, y); - - if (mMarked) { - if (false /*disabled*/) { - box = gui_skin.checkbox.disabled_checked; - } else { - box = gui_skin.checkbox.checked; - } - } else if (false /*disabled*/) { - box = gui_skin.checkbox.disabled; - } else { - box = gui_skin.checkbox.normal; - } - - if (false /*disabled*/) { - col = gui_skin.checkbox.textcolor[1]; - } else { - col = gui_skin.checkbox.textcolor[0]; - } - - x += 2; - y += 2; - tx = x + box->w + 2; - ty = y - 2; - - masked_blit(box, gui_bitmap, 0, 0, x, y, box->w, box->h); - - int rtm = alfont_text_mode(-1); - gui_text(gui_bitmap, getCaption().c_str(), tx, ty, col, 0); - alfont_text_mode(rtm); -} diff --git a/src/gui/mw_checkbox.h b/src/gui/mw_checkbox.h deleted file mode 100644 index 427d943a..00000000 --- a/src/gui/mw_checkbox.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World 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. - * - * The Mana World 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 The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _TMW_CHECKBOX_H -#define _TMW_CHECKBOX_H - -#include "gui.h" - -class MWCheckBox : public gcn::CheckBox { - public: - MWCheckBox(const std::string& caption, bool marked = false); - - // Inherited from Widget - - void draw(gcn::Graphics* graphics); -}; - -#endif -- cgit v1.2.3-70-g09d2