diff options
author | Ira Rice <irarice@gmail.com> | 2008-09-25 00:20:43 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-09-25 00:20:43 +0000 |
commit | c6db9aaac28138dcd6bdfb49fdc98afb36cb9c54 (patch) | |
tree | 6addf03eed4042a3d3213134835c38d31445a51f | |
parent | 489a429bea6739dfa25503b9329bd9e33bffb856 (diff) | |
download | mana-c6db9aaac28138dcd6bdfb49fdc98afb36cb9c54.tar.gz mana-c6db9aaac28138dcd6bdfb49fdc98afb36cb9c54.tar.bz2 mana-c6db9aaac28138dcd6bdfb49fdc98afb36cb9c54.tar.xz mana-c6db9aaac28138dcd6bdfb49fdc98afb36cb9c54.zip |
Forgot to merge in the new files and resources into trunk.
-rw-r--r-- | data/graphics/gui/Makefile.in | 385 | ||||
-rw-r--r-- | data/graphics/gui/default.png | bin | 0 -> 1461 bytes | |||
-rw-r--r-- | data/graphics/gui/gui.xml | 18 | ||||
-rw-r--r-- | data/graphics/gui/speech_bubble.png | bin | 0 -> 2031 bytes | |||
-rw-r--r-- | data/graphics/gui/speechbubble.xml | 18 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 115 | ||||
-rw-r--r-- | src/gui/itempopup.h | 53 | ||||
-rw-r--r-- | src/gui/speechbubble.cpp | 92 | ||||
-rw-r--r-- | src/gui/speechbubble.h | 47 |
9 files changed, 728 insertions, 0 deletions
diff --git a/data/graphics/gui/Makefile.in b/data/graphics/gui/Makefile.in new file mode 100644 index 00000000..1b14bfc1 --- /dev/null +++ b/data/graphics/gui/Makefile.in @@ -0,0 +1,385 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = data/graphics/gui +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(guidir)" +guiDATA_INSTALL = $(INSTALL_DATA) +DATA = $(gui_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSDL_CFLAGS = @LIBSDL_CFLAGS@ +LIBSDL_CONFIG = @LIBSDL_CONFIG@ +LIBSDL_LIBS = @LIBSDL_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +guidir = $(pkgdatadir)/data/graphics/gui +gui_DATA = \ + bg_quad_dis.png \ + browserfont.png \ + button.png \ + button_disabled.png \ + buttonhi.png \ + buttonpress.png \ + checkbox.png \ + close_button.png \ + deepbox.png \ + default.png \ + emotions.png \ + fixedfont.png \ + gui.xml \ + hits_blue.png \ + hits_red.png \ + hits_yellow.png \ + hscroll_left_default.png \ + hscroll_left_highlight.png \ + hscroll_left_pressed.png \ + hscroll_right_default.png \ + hscroll_right_highlight.png \ + hscroll_right_pressed.png \ + item_shortcut_bgr.png \ + mouse.png \ + menuitemD.png \ + menuitemF.png \ + menuitemN.png \ + menuitemP.png \ + radioin.png \ + radioout.png \ + resize.png \ + rpgfont_wider.png \ + selection.png \ + sansserif8.png \ + slider.png \ + speech_bubble.png \ + speechbubble.xml \ + target-cursor-blue-l.png \ + target-cursor-blue-m.png \ + target-cursor-blue-s.png \ + target-cursor-red-l.png \ + target-cursor-red-m.png \ + target-cursor-red-s.png \ + thickborder.png \ + unknown-item.png \ + vscroll_blue.png \ + vscroll_down_default.png \ + vscroll_down_highlight.png \ + vscroll_down_pressed.png \ + vscroll_grey.png \ + vscroll_red.png \ + vscroll_up_default.png \ + vscroll_up_highlight.png \ + vscroll_up_pressed.png + +EXTRA_DIST = \ + $(gui_DATA) + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/graphics/gui/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu data/graphics/gui/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-guiDATA: $(gui_DATA) + @$(NORMAL_INSTALL) + test -z "$(guidir)" || $(MKDIR_P) "$(DESTDIR)$(guidir)" + @list='$(gui_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(guiDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(guidir)/$$f'"; \ + $(guiDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(guidir)/$$f"; \ + done + +uninstall-guiDATA: + @$(NORMAL_UNINSTALL) + @list='$(gui_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(guidir)/$$f'"; \ + rm -f "$(DESTDIR)$(guidir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(guidir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-guiDATA + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-guiDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-guiDATA \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-guiDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/data/graphics/gui/default.png b/data/graphics/gui/default.png Binary files differnew file mode 100644 index 00000000..29353df8 --- /dev/null +++ b/data/graphics/gui/default.png diff --git a/data/graphics/gui/gui.xml b/data/graphics/gui/gui.xml new file mode 100644 index 00000000..fe62528e --- /dev/null +++ b/data/graphics/gui/gui.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="default.png"> + <widget type="Window"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" /> + <part type="top-edge" xpos="4" ypos="0" width="3" height="4" /> + <part type="top-right-corner" xpos="7" ypos="0" width="4" height="4" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="4" height="10" /> + <part type="bg-quad" xpos="11" ypos="0" width="32" height="32" /> + <part type="right-edge" xpos="7" ypos="4" width="4" height="10" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="15" width="4" height="4" /> + <part type="bottom-edge" xpos="4" ypos="15" width="3" height="4" /> + <part type="bottom-right-corner" xpos="7" ypos="15" width="4" height="4" /> + </widget> +</skinset>
\ No newline at end of file diff --git a/data/graphics/gui/speech_bubble.png b/data/graphics/gui/speech_bubble.png Binary files differnew file mode 100644 index 00000000..3e678099 --- /dev/null +++ b/data/graphics/gui/speech_bubble.png diff --git a/data/graphics/gui/speechbubble.xml b/data/graphics/gui/speechbubble.xml new file mode 100644 index 00000000..1b11ea85 --- /dev/null +++ b/data/graphics/gui/speechbubble.xml @@ -0,0 +1,18 @@ +<skinset name="SpeechBubble" image="speech_bubble.png"> + <widget type="Window"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="14" height="14" /> + <part type="top-edge" xpos="15" ypos="0" width="1" height="14" /> + <part type="top-right-corner" xpos="17" ypos="0" width="17" height="14" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="15" width="14" height="1" /> + <part type="bg-quad" xpos="34" ypos="0" width="32" height="32" /> + <part type="right-edge" xpos="17" ypos="15" width="17" height="1" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="17" width="14" height="17" /> + <part type="bottom-edge" xpos="15" ypos="17" width="1" height="17" /> + <part type="bottom-right-corner" xpos="17" ypos="17" width="17" height="17" /> + </widget> +</skinset>
\ No newline at end of file diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp new file mode 100644 index 00000000..aab9fd9d --- /dev/null +++ b/src/gui/itempopup.cpp @@ -0,0 +1,115 @@ +/* + * The Legend of Mazzeroth + * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * + * This file is part of The Legend of Mazzeroth based on original code + * from The Mana World. + * + * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "itempopup.h" +#include <guichan/widgets/label.hpp> +#include "widgets/layout.h" + +#include "gui.h" + +#include "../resources/image.h" +#include "../resources/resourcemanager.h" +#include "../resources/iteminfo.h" +#include "../utils/gettext.h" +#include "../utils/strprintf.h" + + +ItemPopup::ItemPopup() +{ + + setResizable(false); + setTitleBarHeight(0); + + // Item Name + mItemName = new gcn::Label("Label"); + mItemName->setFont(gui->getFont()); + mItemName->setPosition(2, 2); + mItemName->setWidth(getWidth() - 4); + + // Item Description + mItemDesc = new TextBox(); + mItemDesc->setEditable(false); + mItemDescScroll = new ScrollArea(mItemDesc); + + mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mItemDescScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, 14)); + mItemDescScroll->setOpaque(false); + mItemDescScroll->setPosition(2, 15); + + // Item Effect + mItemEffect = new TextBox(); + mItemEffect->setEditable(false); + mItemEffectScroll = new ScrollArea(mItemEffect); + + mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, 14)); + mItemEffectScroll->setOpaque(false); + mItemEffectScroll->setPosition(2, 35); + + add(mItemName); + add(mItemDescScroll); + add(mItemEffectScroll); + + setLocationRelativeTo(getParent()); + + // LEEOR / TODO: This causes an exception error. + //moveToBottom(getParent()); + + mItemDesc->setTextWrapped( "" ); + mItemEffect->setTextWrapped( "" ); +} + +void ItemPopup::setItem(Item *item) +{ + + ItemInfo const *info = item ? &item->getInfo() : NULL; + + mItemName->setCaption(info->getName()); + mItemDesc->setTextWrapped( info->getDescription() ); + mItemEffect->setTextWrapped( info->getEffect() ); + + int numRowsDesc = mItemDesc->getNumberOfRows(); + int numRowsEffect = mItemEffect->getNumberOfRows(); + + if(info->getEffect() == "") + { + setContentSize(200, (numRowsDesc * 14) + 30); + } else { + setContentSize(200, (numRowsDesc * 14) + (numRowsEffect*14) + 30); + } + + mItemDescScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsDesc * 14)); + + mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsEffect * 14)); + + mItemDescScroll->setPosition(2, 20); + mItemEffectScroll->setPosition(2, (numRowsDesc * 15) + 25); +} + +unsigned int ItemPopup::getNumRows() +{ + return mItemDesc->getNumberOfRows(), mItemEffect->getNumberOfRows(); +} diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h new file mode 100644 index 00000000..499b2e0a --- /dev/null +++ b/src/gui/itempopup.h @@ -0,0 +1,53 @@ +/* +* + * The Legend of Mazzeroth + * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * + * This file is part of The Legend of Mazzeroth based on original code + * from The Mana World. + * + * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _LOM_ITEMPOPUP_H__ +#define _LOM_ITEMPOPUP_H__ + +#include "textbox.h" +#include "scrollarea.h" +#include "window.h" + +#include "../item.h" + +class ItemPopup : public Window + { + public: + + ItemPopup(); + + void setItem(Item *item); + unsigned int getNumRows(); + + private: + gcn::Label *mItemName; + TextBox *mItemDesc; + TextBox *mItemEffect; + ScrollArea *mItemDescScroll; + ScrollArea *mItemEffectScroll; + + }; + +#endif diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp new file mode 100644 index 00000000..d71ceedf --- /dev/null +++ b/src/gui/speechbubble.cpp @@ -0,0 +1,92 @@ +/* + * The Legend of Mazzeroth + * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * + * This file is part of The Legend of Mazzeroth based on original code + * from The Mana World. + * + * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include <guichan/font.hpp> + +#include "speechbubble.h" + +#include "../resources/image.h" +#include "../resources/resourcemanager.h" + +// TODO: Fix windows so that they can each load their own skins without the +// other windows overriding another window's skin. +SpeechBubble::SpeechBubble()//: +// Window("Message", false, NULL, "graphics/gui/speechbubble.xml") +{ + mSpeechBox = new TextBox(); + mSpeechBox->setEditable(false); + mSpeechBox->setOpaque(false); + + mSpeechArea = new ScrollArea(mSpeechBox); + + // Height == Top Graphic (14px) + 1 Row of Text (15px) + Bottom Graphic (17px) + setContentSize(140, 46); + setTitleBarHeight(5); + + mSpeechArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mSpeechArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mSpeechArea->setDimension(gcn::Rectangle(4, 15, 130, 28)); + mSpeechArea->setOpaque(false); + + add(mSpeechArea); + + setLocationRelativeTo(getParent()); + + // LEEOR / TODO: This causes an exception error. + //moveToBottom(getParent()); + + mSpeechBox->setTextWrapped( "" ); +} + +void SpeechBubble::setText(const std::string mText) +{ + mSpeechBox->setTextWrapped( mText ); + mSpeechBox->setMinWidth(140); + + int numRows = mSpeechBox->getNumberOfRows(); + + if (numRows > 1) + { + // 15 == height of each line of text (based on font heights) + // 14 == speechbubble Top + Bottom graphic pixel heights + setContentSize(mSpeechBox->getMinWidth() + 15, 15 + (numRows * 15)); + mSpeechArea->setDimension(gcn::Rectangle(4, 15, mSpeechBox->getMinWidth() + 5, + 3 +(numRows * 14))); + } + else + { + int width; + if (this->getCaption().length() > mText.length()) + width = getFont()->getWidth(this->getCaption()); + else + width = getFont()->getWidth(mText); + setContentSize(width + 15, 30); + mSpeechArea->setDimension(gcn::Rectangle(4, 15, width + 5, 17)); + } +} + +unsigned int SpeechBubble::getNumRows() +{ + return mSpeechBox->getNumberOfRows(); +} diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h new file mode 100644 index 00000000..c4ca9109 --- /dev/null +++ b/src/gui/speechbubble.h @@ -0,0 +1,47 @@ +/* + * The Legend of Mazzeroth + * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * + * This file is part of The Legend of Mazzeroth based on original code + * from The Mana World. + * + * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _LOM_SPEECHBUBBLE_H__ +#define _LOM_SPEECHBUBBLE_H__ + +#include "textbox.h" +#include "scrollarea.h" +#include "window.h" + +class SpeechBubble : public Window +{ + public: + + SpeechBubble(); + + void setText(const std::string mText); + void setLocation(int x, int y); + unsigned int getNumRows(); + + private: + TextBox *mSpeechBox; + ScrollArea *mSpeechArea; +}; + +#endif |