Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-09-17 15:19:34 +0000
committerStijn Buys <ingar@osirion.org>2010-09-17 15:19:34 +0000
commitc62fe609a69058e2e30f757e9a06f72a98464232 (patch)
tree53f6a671bd84924ddf7d278cf10a3e527670088e /src/ui
parent0c509866a37ab47ff0e48d357ca55e31658c37c2 (diff)
Bump network protocol version to 19, menudescriptions use the info infrastructure, client-side lazy info update requests.
Updated ROADMAP
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/Makefile.am4
-rw-r--r--src/ui/button.cc3
-rw-r--r--src/ui/listview.cc2
-rwxr-xr-xsrc/ui/modelview.cc4
-rw-r--r--src/ui/widget.cc2
-rw-r--r--src/ui/widget.h16
6 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 98c8dab..d12571d 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -8,12 +8,12 @@ noinst_LTLIBRARIES = libui.la
endif
noinst_HEADERS = bitmap.h button.h console.h container.h definitions.h font.h \
- iconbutton.h inputbox.h label.h listview.h menu.h modelview.h paint.h \
+ iconbutton.h inputbox.h label.h listitem.h listview.h menu.h modelview.h paint.h \
palette.h scrollpane.h toolbar.h ui.h widget.h \
window.h
libui_la_SOURCES = bitmap.cc button.cc console.cc container.cc \
- font.cc iconbutton.cc inputbox.cc label.cc listview.cc \
+ font.cc iconbutton.cc inputbox.cc label.cc listitem.cc listview.cc \
menu.cc modelview.cc paint.cc palette.cc scrollpane.cc \
toolbar.cc ui.cc widget.cc window.cc
libui_la_LDFLAGS = -avoid-version -no-undefined
diff --git a/src/ui/button.cc b/src/ui/button.cc
index 85cad7e..9196b90 100644
--- a/src/ui/button.cc
+++ b/src/ui/button.cc
@@ -81,6 +81,9 @@ bool Button::on_keypress(const int key, const unsigned int modifier)
if (key == 512 + SDL_BUTTON_LEFT) {
core::cmd() << button_command << std::endl;
audio::play("ui/button");
+
+ emit(EventButtonClicked);
+
return true;
}
diff --git a/src/ui/listview.cc b/src/ui/listview.cc
index 56fa324..da320c5 100644
--- a/src/ui/listview.cc
+++ b/src/ui/listview.cc
@@ -13,6 +13,8 @@ ListView::ListView(Widget *parent) : Widget(parent)
{
set_label("listview");
set_border(true);
+
+ listview_scroll = 0.0f;
}
ListView::~ListView()
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index f247e5b..18cc091 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -83,9 +83,9 @@ void ModelView::draw()
}
paint::color(1.0f, 1.0f, 1.0f);
- model::Model *model = model::Model::find(modelview_modelname);
+ model::Model *model = model::Model::load(modelview_modelname);
if (!model) {
- paint::bitmap(global_location(), size(), "bitmap/notex");
+ paint::bitmap(global_location(), size(), "bitmaps/notex");
return;
}
diff --git a/src/ui/widget.cc b/src/ui/widget.cc
index 39fbe98..5fe6f17 100644
--- a/src/ui/widget.cc
+++ b/src/ui/widget.cc
@@ -327,7 +327,7 @@ bool Widget::event_emit(Widget *sender, const Event event, void *data)
if (on_emit(sender, event, data)) {
return true;
} else if (parent()) {
- return (parent()->on_emit(sender, event, data));
+ return (parent()->event_emit(sender, event, data));
} else {
return false;
}
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 50678fa..856fca0 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -28,7 +28,7 @@ class Widget
public:
/// types of custom events a widget can emit
- enum Event {EventNone = 0, EventSelected = 1};
+ enum Event {EventNone = 0, EventButtonClicked, EventListItemClicked};
/// create a new widget
Widget(Widget *parent = 0);
@@ -202,9 +202,6 @@ public:
/// enable or disable widget background
void set_background(bool background = true);
- /// emit a custom event
- void emit(const Event event, const void *data=0);
-
/* -- event distributors --------------------------------------- */
/**
@@ -239,6 +236,14 @@ public:
**/
bool event_emit(Widget *sender, const Event event, void *data = 0);
+ /// emit a custom event
+ inline void emit(const Event event, void *data=0) {
+ event_emit(this, event, data);
+ }
+
+ /// remove all child widgets
+ virtual void remove_children();
+
protected:
/// type definition for child widgets
typedef std::list<Widget *> Children;
@@ -339,9 +344,6 @@ protected:
/// remove a child widget
virtual void remove_child(Widget *child);
- /// remove all child widgets
- virtual void remove_children();
-
private:
void draw_debug_border();