diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/serverdialog.h | 24 | ||||
-rw-r--r-- | src/gui/widgets/.deps/.dirstamp | 0 | ||||
-rw-r--r-- | src/gui/widgets/.deps/dropdown.Po | 524 | ||||
-rw-r--r-- | src/gui/widgets/.dirstamp | 0 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 191 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.h | 85 |
8 files changed, 825 insertions, 15 deletions
@@ -1,3 +1,11 @@ +2006-08-30 Yohann Ferreira <bertram@cegetel.net> + + * src/Makefile.am, src/gui/widgets, src/gui/widgets/dropdown.h, + src/gui/widgets/dropdown.cpp, src/gui/serverdialog.h, + src/gui/serverdialog.cpp: Added a reusable skinned dropdown widget in + the new widgets folder. Other widgets will be be moved there later. + + 2006-09-09 Guillaume Melquiond <guillaume.melquiond@gmail.com> * src/map.cpp: Removed being collisions. Fixed wrong heuristic cost diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 944b0ae0..9c48b6a6 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -26,10 +26,9 @@ #include <iostream> #include <string> -// TODO : Replace the dropdown by our own skinned one. -#include <guichan/widgets/dropdown.hpp> #include <guichan/widgets/label.hpp> +// TODO : Replace the dropdown by our own skinned one. #include "button.h" #include "listbox.h" #include "ok_dialog.h" @@ -126,9 +125,10 @@ ServerDialog::ServerDialog(LoginData *loginData): } } - mMostUsedServersListBox = new ListBox(mMostUsedServersListModel); + mMostUsedServersListBox = new ListBox(NULL); + mMostUsedServersListBox->setListModel(mMostUsedServersListModel); mMostUsedServersScrollArea = new ScrollArea(); - mMostUsedServersDropDown = new gcn::DropDown(mMostUsedServersListModel, + mMostUsedServersDropDown = new DropDown(mMostUsedServersListModel, mMostUsedServersScrollArea, mMostUsedServersListBox); mDropDownListener = new DropDownListener(mServerNameField, mPortField, diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 687290f3..c0b8275d 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -24,20 +24,22 @@ #ifndef _TMW_SERVERDIALOG_H #define _TMW_SERVERDIALOG_H -#include <iosfwd>
-#include <vector>
+#include <iosfwd> +#include <vector> -#include <guichan/actionlistener.hpp>
+#include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> -
+//#include <guichan/widgets/dropdown.hpp> +#include "./widgets/dropdown.h" + #include "login.h" #include "window.h" -
+ #include "../guichanfwd.h" #include "../net/network.h" -class LoginData;
+class LoginData; /** * A server structure to keep pairs of servers and ports. @@ -54,7 +56,7 @@ struct Server { /** * Server and Port List Model */ -class ServersListModel : public gcn::ListModel
+class ServersListModel : public gcn::ListModel { public: /** @@ -76,7 +78,7 @@ class ServersListModel : public gcn::ListModel /** * Add an Element at the beginning of the server list */ - void addFirstElement(Server server);
+ void addFirstElement(Server server); private: std::vector<Server> servers; @@ -85,7 +87,7 @@ class ServersListModel : public gcn::ListModel /** * Listener used for handling the DropDown in the server Dialog. */ -class DropDownListener : public gcn::ActionListener
+class DropDownListener : public gcn::ActionListener { public: DropDownListener(gcn::TextField *serverNameField, @@ -113,7 +115,7 @@ class DropDownListener : public gcn::ActionListener * * \ingroup Interface */ -class ServerDialog : public Window, public gcn::ActionListener
+class ServerDialog : public Window, public gcn::ActionListener { public: /** @@ -140,7 +142,7 @@ class ServerDialog : public Window, public gcn::ActionListener gcn::Button *mCancelButton; // TODO : child the Dropdown List to skin it. - gcn::DropDown *mMostUsedServersDropDown; + DropDown *mMostUsedServersDropDown; gcn::ListBox *mMostUsedServersListBox; gcn::ScrollArea *mMostUsedServersScrollArea; ServersListModel *mMostUsedServersListModel; diff --git a/src/gui/widgets/.deps/.dirstamp b/src/gui/widgets/.deps/.dirstamp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/gui/widgets/.deps/.dirstamp diff --git a/src/gui/widgets/.deps/dropdown.Po b/src/gui/widgets/.deps/dropdown.Po new file mode 100644 index 00000000..6a0726bb --- /dev/null +++ b/src/gui/widgets/.deps/dropdown.Po @@ -0,0 +1,524 @@ +gui/widgets/dropdown.o gui/widgets/dropdown.o: gui/widgets/dropdown.cpp \ + gui/widgets/dropdown.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++config.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/gnu/stubs.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++locale.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++io.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/gthr.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/initspin.h \ + /usr/include/bits/sigthread.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/include/guichan/widgets/dropdown.hpp \ + /usr/include/guichan/actionlistener.hpp \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/include/guichan/platform.hpp \ + /usr/include/guichan/basiccontainer.hpp \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/list \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_list.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/list.tcc \ + /usr/include/guichan/widget.hpp /usr/include/guichan/color.hpp \ + /usr/include/guichan/rectangle.hpp \ + /usr/include/guichan/focushandler.hpp \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/include/guichan/keylistener.hpp /usr/include/guichan/listmodel.hpp \ + /usr/include/guichan/mouselistener.hpp \ + /usr/include/guichan/platform.hpp \ + /usr/include/guichan/widgets/listbox.hpp \ + /usr/include/guichan/widget.hpp \ + /usr/include/guichan/widgets/scrollarea.hpp gui/widgets/../scrollarea.h \ + /usr/include/guichan/widgets/scrollarea.hpp gui/widgets/../listbox.h \ + /usr/include/guichan/widgets/listbox.hpp gui/widgets/../../graphics.h \ + /usr/include/guichan/sdl/sdlgraphics.hpp /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/strings.h /usr/include/inttypes.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h /usr/include/guichan/color.hpp \ + /usr/include/guichan/graphics.hpp \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/stack \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/deque \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_deque.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/deque.tcc \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_stack.h \ + /usr/include/guichan/cliprectangle.hpp \ + /usr/include/guichan/platform.hpp gui/widgets/../../graphic/imagerect.h \ + gui/widgets/../../resources/image.h \ + gui/widgets/../../resources/../main.h \ + gui/widgets/../../resources/../../config.h /usr/include/SDL/SDL.h \ + gui/widgets/../../resources/resource.h \ + gui/widgets/../../resources/resourcemanager.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/map \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h \ + gui/widgets/../../utils/dtor.h \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/functional \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/utility \ + /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h + +gui/widgets/dropdown.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++config.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/gnu/stubs.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++locale.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/bits/types.h: + +/usr/include/bits/wordsize.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++io.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/gthr.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/bits/sched.h: + +/usr/include/bits/time.h: + +/usr/include/signal.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/bits/initspin.h: + +/usr/include/bits/sigthread.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/include/guichan/widgets/dropdown.hpp: + +/usr/include/guichan/actionlistener.hpp: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/sys/types.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/include/guichan/platform.hpp: + +/usr/include/guichan/basiccontainer.hpp: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/list: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_list.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/list.tcc: + +/usr/include/guichan/widget.hpp: + +/usr/include/guichan/color.hpp: + +/usr/include/guichan/rectangle.hpp: + +/usr/include/guichan/focushandler.hpp: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/include/guichan/keylistener.hpp: + +/usr/include/guichan/listmodel.hpp: + +/usr/include/guichan/mouselistener.hpp: + +/usr/include/guichan/platform.hpp: + +/usr/include/guichan/widgets/listbox.hpp: + +/usr/include/guichan/widget.hpp: + +/usr/include/guichan/widgets/scrollarea.hpp: + +gui/widgets/../scrollarea.h: + +/usr/include/guichan/widgets/scrollarea.hpp: + +gui/widgets/../listbox.h: + +/usr/include/guichan/widgets/listbox.hpp: + +gui/widgets/../../graphics.h: + +/usr/include/guichan/sdl/sdlgraphics.hpp: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/strings.h: + +/usr/include/inttypes.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +/usr/include/guichan/color.hpp: + +/usr/include/guichan/graphics.hpp: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/stack: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/deque: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_deque.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/deque.tcc: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_stack.h: + +/usr/include/guichan/cliprectangle.hpp: + +/usr/include/guichan/platform.hpp: + +gui/widgets/../../graphic/imagerect.h: + +gui/widgets/../../resources/image.h: + +gui/widgets/../../resources/../main.h: + +gui/widgets/../../resources/../../config.h: + +/usr/include/SDL/SDL.h: + +gui/widgets/../../resources/resource.h: + +gui/widgets/../../resources/resourcemanager.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/map: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h: + +gui/widgets/../../utils/dtor.h: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/functional: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/utility: + +/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h: diff --git a/src/gui/widgets/.dirstamp b/src/gui/widgets/.dirstamp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/gui/widgets/.dirstamp diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp new file mode 100644 index 00000000..34c6b93a --- /dev/null +++ b/src/gui/widgets/dropdown.cpp @@ -0,0 +1,191 @@ +/* + * 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 + * + * $Id$ + */ + +#include "dropdown.h" + +#include "../../graphics.h" + +#include "../../graphic/imagerect.h" + +#include "../../resources/image.h" +#include "../../resources/resourcemanager.h" + +#include "../../utils/dtor.h" + +int DropDown::instances = 0; +Image *DropDown::buttons[2][2]; +ImageRect DropDown::skin; + +DropDown::DropDown(gcn::ListModel *listModel, + gcn::ScrollArea *scrollArea, + gcn::ListBox *listBox): + gcn::DropDown::DropDown(listModel, + scrollArea, listBox) +{ + setBorderSize(2); + + // Initialize graphics + if (instances == 0) + { + // Load the background skin + ResourceManager *resman = ResourceManager::getInstance(); + + // Get the button skin + buttons[1][0] = + resman->getImage("graphics/gui/vscroll_up_default.png"); + buttons[0][0] = + resman->getImage("graphics/gui/vscroll_down_default.png"); + buttons[1][1] = + resman->getImage("graphics/gui/vscroll_up_pressed.png"); + buttons[0][1] = + resman->getImage("graphics/gui/vscroll_down_pressed.png"); + + // get the border skin + Image *boxBorder = resman->getImage("graphics/gui/deepbox.png"); + int gridx[4] = {0, 3, 28, 31}; + int gridy[4] = {0, 3, 28, 31}; + int a = 0, x, y; + + for (y = 0; y < 3; y++) { + for (x = 0; x < 3; x++) { + skin.grid[a] = boxBorder->getSubImage( + gridx[x], gridy[y], + gridx[x + 1] - gridx[x] + 1, + gridy[y + 1] - gridy[y] + 1); + a++; + } + } + + boxBorder->decRef(); + } + + instances++; +} + +DropDown::~DropDown() +{ + instances--; + // Free images memory + if (instances == 0) + { + buttons[0][0]->decRef(); + buttons[0][1]->decRef(); + buttons[1][0]->decRef(); + buttons[1][1]->decRef(); + + for_each(skin.grid, skin.grid + 9, dtor<Image*>()); + } +} + +void DropDown::draw(gcn::Graphics* graphics) +{ + int h; + + if (mDroppedDown) + { + h = mOldH; + } + else + { + h = getHeight(); + } + + int alpha = getBaseColor().a; + gcn::Color faceColor = getBaseColor(); + faceColor.a = alpha; + gcn::Color highlightColor = faceColor + 0x303030; + highlightColor.a = alpha; + gcn::Color shadowColor = faceColor - 0x303030; + shadowColor.a = alpha; + + + graphics->setColor(getBackgroundColor()); + graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), h)); + + graphics->setColor(getForegroundColor()); + graphics->setFont(getFont()); + + if (mListBox->getListModel() && mListBox->getSelected() >= 0) + { + graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0); + } + + if (isFocused()) + { + graphics->setColor(highlightColor); + graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h)); + } + + drawButton(graphics); + + if (mDroppedDown) + { + drawChildren(graphics); + + // Draw two lines separating the ListBox with se selected + // element view. + graphics->setColor(highlightColor); + graphics->drawLine(0, h, getWidth(), h); + graphics->setColor(shadowColor); + graphics->drawLine(0, h + 1,getWidth(),h + 1); + } +} + +void DropDown::drawBorder(gcn::Graphics *graphics) +{ + int w, h, bs; + bs = getBorderSize(); + w = getWidth() + bs * 2; + h = getHeight() + bs * 2; + + dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin); +} + +void DropDown::drawButton(gcn::Graphics *graphics) +{ + + unsigned short state = 0; + unsigned short dir = 0; + gcn::Rectangle dim; + + if (mPushed) + state = 1; + + if (mDroppedDown) + dir = 1; + + int height; + if (mDroppedDown) + { + height = mOldH; + } + else + { + height = getHeight(); + } + int x = getWidth() - height; + int y = 0; + + dynamic_cast<Graphics*>(graphics)->drawImage( + buttons[dir][state], x, y + 1); +} diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h new file mode 100644 index 00000000..37e754af --- /dev/null +++ b/src/gui/widgets/dropdown.h @@ -0,0 +1,85 @@ +/* + * 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 + * + * $Id$ + */ + +#ifndef DROPDOWN_H +#define DROPDOWN_H + +#include <iosfwd> + +#include <guichan/widgets/dropdown.hpp> +#include "../scrollarea.h" +#include "../listbox.h" + +class Image; +class ImageRect; + + /** + * A drop down box from which you can select different values. It is one of + * the most complicated Widgets you will find in Guichan. For drawing the + * DroppedDown box it uses one ScrollArea and one ListBox. It also uses an + * internal FocusHandler to handle the focus of the internal ScollArea and + * ListBox. DropDown uses a ListModel to handle the list. To be able to use + * DropDown you must give DropDown an implemented ListModel which represents + * your list. + */ +class DropDown : public gcn::DropDown +{ + public: + /** + * Contructor. + * + * @param listModel the ListModel to use. + * @param scrollArea the ScrollArea to use. + * @param listBox the listBox to use. + * @see ListModel, ScrollArea, ListBox. + */ + DropDown(gcn::ListModel *listModel = NULL, + gcn::ScrollArea *scrollArea = NULL, + gcn::ListBox *listBox = NULL); + + /** + * Destructor. + */ + ~DropDown(); + + void draw(gcn::Graphics* graphics); + + void drawBorder(gcn::Graphics* graphics); + + + protected: + /** + * Draws the button with the little down arrow. + * + * @param graphics a Graphics object to draw with. + */ + void drawButton(gcn::Graphics *graphics); + + // Add own Images. + static int instances; + static Image *buttons[2][2]; + static ImageRect skin; +}; + +#endif // end DROPDOWN_H + |