Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.cc4
-rw-r--r--src/ui/ui.h4
-rw-r--r--src/ui/widget.h10
-rw-r--r--src/ui/window.cc9
-rw-r--r--src/ui/window.h7
5 files changed, 28 insertions, 6 deletions
diff --git a/src/ui/console.cc b/src/ui/console.cc
index 67d5054..5c15bc5 100644
--- a/src/ui/console.cc
+++ b/src/ui/console.cc
@@ -74,6 +74,7 @@ Console::~Console()
void Console::show()
{
ui::Window::show();
+ raise();
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(SDL_ENABLE);
@@ -83,7 +84,8 @@ void Console::show()
history_pos = history.rbegin();
(*history_pos).clear();
console_input->set_text((*history_pos));
-
+ console_input->set_focus();
+
audio::play("ui/console");
}
diff --git a/src/ui/ui.h b/src/ui/ui.h
index c611a26..fc0ce56 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -93,9 +93,7 @@ public:
void set_pointer(const char *pointerbitmap = 0, const Palette::Color color = Palette::Highlight, const bool animated = false);
static bool ui_debug;
-
-
-
+
static float elementmargin;
static math::Vector2f elementsize;
diff --git a/src/ui/widget.h b/src/ui/widget.h
index cb42ad0..bd1cba5 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -28,7 +28,15 @@ class Widget
public:
/// types of custom events a widget can emit
- enum Event {EventNone = 0, EventButtonClicked, EventListItemClicked, EventListViewChanged, EventSliderChanged};
+ enum Event {
+ EventNone = 0,
+ EventButtonClicked = 1,
+ EventListItemClicked = 2,
+ EventListViewChanged = 3,
+ EventSliderChanged = 4,
+ EventWindowShow = 5,
+ EventWindowHide = 6
+ };
/// create a new widget
Widget(Widget *parent = 0);
diff --git a/src/ui/window.cc b/src/ui/window.cc
index 8571eec..e7b756a 100644
--- a/src/ui/window.cc
+++ b/src/ui/window.cc
@@ -27,12 +27,19 @@ void Window::show()
{
resize();
Widget::show();
- raise();
+ //raise();
Widget *w = this;
while (w && w->visible()) {
w->set_focus();
w = w->parent();
}
+ emit(EventWindowShow);
+}
+
+void Window::hide()
+{
+ Widget::hide();
+ emit(EventWindowHide);
}
void Window::set_previous(Window *previous)
diff --git a/src/ui/window.h b/src/ui/window.h
index 58535ba..401c370 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -23,8 +23,15 @@ public:
/**
* @brief show the window and set input focus
* show() sets focus on the window and all of its parents
+ * The window will emit an EventWindowShow
**/
virtual void show();
+
+ /**
+ * @brief hide the window
+ * The window will emit an EventWindowHide
+ **/
+ virtual void hide();
/// set the label of the previous window
// FIXME should be removed