aboutsummaryrefslogtreecommitdiff
path: root/lib/gui
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gui')
-rw-r--r--lib/gui/elistbox.cpp16
-rw-r--r--lib/gui/elistbox.h14
-rw-r--r--lib/gui/ewidget.h2
-rw-r--r--lib/gui/ewindowstyle.cpp28
4 files changed, 49 insertions, 11 deletions
diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp
index 361d7b99..1dae137f 100644
--- a/lib/gui/elistbox.cpp
+++ b/lib/gui/elistbox.cpp
@@ -1,9 +1,22 @@
#include <lib/gui/elistbox.h>
#include <lib/gui/elistboxcontent.h>
+#include <lib/actions/action.h>
eListbox::eListbox(eWidget *parent): eWidget(parent)
{
setContent(new eListboxStringContent());
+
+ ePtr<eActionMap> ptr;
+ eActionMap::getInstance(ptr);
+
+ ptr->bindAction("ListboxActions", 0, 0, this);
+}
+
+eListbox::~eListbox()
+{
+ ePtr<eActionMap> ptr;
+ eActionMap::getInstance(ptr);
+ ptr->unbindAction(this, 0);
}
void eListbox::setContent(iListboxContent *content)
@@ -108,6 +121,9 @@ int eListbox::event(int event, void *data, void *data2)
return 0;
}
+ case evtAction:
+ moveSelection((int)data2);
+ return 1;
default:
return eWidget::event(event, data, data2);
}
diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h
index 9ec94665..78e0fbe9 100644
--- a/lib/gui/elistbox.h
+++ b/lib/gui/elistbox.h
@@ -50,14 +50,26 @@ class eListbox: public eWidget
{
public:
eListbox(eWidget *parent);
+ ~eListbox();
void setContent(iListboxContent *content);
+/* enum Movement {
+ moveUp,
+ moveDown,
+ moveTop,
+ moveEnd,
+ justCheck
+ }; */
+
void moveSelection(int how);
- enum {
+
+ enum ListboxActions {
moveUp,
moveDown,
moveTop,
moveEnd,
+ pageUp,
+ pageDown,
justCheck
};
protected:
diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h
index fa8cd8ca..12d2e743 100644
--- a/lib/gui/ewidget.h
+++ b/lib/gui/ewidget.h
@@ -73,6 +73,8 @@ public:
evtWillChangePosition, /* new size is eRect *data */
evtWillChangeSize,
+ evtAction,
+
evtUserWidget,
};
virtual int event(int event, void *data = 0, void *data2 = 0);
diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp
index a5ace37a..ccf7299f 100644
--- a/lib/gui/ewindowstyle.cpp
+++ b/lib/gui/ewindowstyle.cpp
@@ -10,16 +10,16 @@ DEFINE_REF(eWindowStyleSimple);
eWindowStyleSimple::eWindowStyleSimple()
{
- m_border_left = m_border_right = m_border_bottom = 1;
+ m_border_left = m_border_right = m_border_bottom = 2;
m_border_top = 30;
m_fnt = new gFont("Arial", 25);
- m_border_color_tl = gColor(0x14);
- m_border_color_br = gColor(0x1c);
+ m_border_color_tl = gColor(0x1f);
+ m_border_color_br = gColor(0x14);
m_title_color_back = gColor(0x20);
m_title_color = gColor(0x2f);
- m_background_color = gColor(0x18);
+ m_background_color = gColor(0x19);
}
void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size)
@@ -36,19 +36,27 @@ void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size)
void eWindowStyleSimple::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title)
{
+ painter.setForegroundColor(m_title_color_back);
+ painter.fill(eRect(2, 2, wnd->size().width() - 4, m_border_top - 4));
painter.setBackgroundColor(m_title_color_back);
painter.setForegroundColor(m_title_color);
- painter.clear();
painter.setFont(m_fnt);
- painter.renderText(eRect(1, 1, wnd->size().width() - 2, m_border_top - 2), title);
+ painter.renderText(eRect(3, 3, wnd->size().width() - 6, m_border_top - 6), title);
eRect frame(ePoint(0, 0), wnd->size());
- painter.setForegroundColor(m_border_color_tl);
+
+ painter.setForegroundColor(m_background_color);
painter.line(frame.topLeft1(), frame.topRight1());
- painter.line(frame.topRight1(), frame.bottomRight1());
+ painter.line(frame.topLeft1(), frame.bottomLeft1());
+ painter.setForegroundColor(m_border_color_tl);
+ painter.line(frame.topLeft1()+eSize(1,1), frame.topRight1()+eSize(0,1));
+ painter.line(frame.topLeft1()+eSize(1,1), frame.bottomLeft1()+eSize(1,0));
+
painter.setForegroundColor(m_border_color_br);
- painter.line(frame.bottomRight1(), frame.bottomLeft1());
- painter.line(frame.bottomLeft1(), frame.topLeft1());
+ painter.line(frame.bottomLeft()+eSize(1,-1), frame.bottomRight()+eSize(0,-1));
+ painter.line(frame.topRight1()+eSize(-1,1), frame.bottomRight1()+eSize(-1, 0));
+ painter.line(frame.bottomLeft()+eSize(1,-2), frame.bottomRight()+eSize(0,-2));
+ painter.line(frame.topRight1()+eSize(-0,1), frame.bottomRight1()+eSize(-0, 0));
}
void eWindowStyleSimple::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size)