summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/ui/sidebarwidget.c40
-rw-r--r--src/ui/sidebarwidget.h17
3 files changed, 59 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a78f16e..8992e87f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,8 @@ set (SOURCES
69 src/ui/paint.h 69 src/ui/paint.h
70 src/ui/scrollwidget.c 70 src/ui/scrollwidget.c
71 src/ui/scrollwidget.h 71 src/ui/scrollwidget.h
72 src/ui/sidebarwidget.c
73 src/ui/sidebarwidget.h
72 src/ui/text.c 74 src/ui/text.c
73 src/ui/text.h 75 src/ui/text.h
74 src/ui/util.c 76 src/ui/util.c
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
new file mode 100644
index 00000000..c234c934
--- /dev/null
+++ b/src/ui/sidebarwidget.c
@@ -0,0 +1,40 @@
1#include "sidebarwidget.h"
2#include "scrollwidget.h"
3#include "paint.h"
4
5struct Impl_SidebarWidget {
6 iWidget widget;
7 enum iSidebarMode mode;
8 iScrollWidget *scroll;
9};
10
11iDefineObjectConstruction(SidebarWidget)
12
13void init_SidebarWidget(iSidebarWidget *d) {
14 iWidget *w = as_Widget(d);
15 init_Widget(w);
16 d->mode = documentOutline_SidebarMode;
17 addChild_Widget(w, iClob(d->scroll = new_ScrollWidget()));
18 w->rect.size.x = 60 * gap_UI;
19 setFlags_Widget(w, fixedWidth_WidgetFlag, iTrue);
20 setBackgroundColor_Widget(w, red_ColorId);
21}
22
23void deinit_SidebarWidget(iSidebarWidget *d) {
24 iUnused(d);
25}
26
27static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) {
28 iWidget *w = as_Widget(d);
29 return processEvent_Widget(w, ev);
30}
31
32static void draw_SidebarWidget_(const iSidebarWidget *d) {
33 const iWidget *w = constAs_Widget(d);
34 draw_Widget(w);
35}
36
37iBeginDefineSubclass(SidebarWidget, Widget)
38 .processEvent = (iAny *) processEvent_SidebarWidget_,
39 .draw = (iAny *) draw_SidebarWidget_,
40iEndDefineSubclass(SidebarWidget)
diff --git a/src/ui/sidebarwidget.h b/src/ui/sidebarwidget.h
new file mode 100644
index 00000000..3fd956a4
--- /dev/null
+++ b/src/ui/sidebarwidget.h
@@ -0,0 +1,17 @@
1#pragma once
2
3#include "widget.h"
4
5enum iSidebarMode {
6 bookmarks_SidebarMode,
7 history_SidebarMode,
8 documentOutline_SidebarMode,
9 identities_SidebarMode,
10};
11
12iDeclareWidgetClass(SidebarWidget)
13iDeclareObjectConstruction(SidebarWidget)
14
15void setMode_SidebarWidget (iSidebarWidget *, enum iSidebarMode mode);
16
17enum iSidebarMode mode_SidebarWidget(const iSidebarWidget *);