annotate src/ui.hh @ 217:a27eafd634d1

- Made CTRL-l focus the location bar instead of popping up a dialog.
author jcid
date Mon, 19 May 2008 22:10:17 +0200
parents d6ee459f4403
children 07d1e0d8463c
rev   line source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1 #ifndef __UI_HH__
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
2 #define __UI_HH__
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
3
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
4 // UI for dillo --------------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
5
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
6 #include <fltk/Window.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
7 #include <fltk/Widget.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
8 #include <fltk/Button.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
9 #include <fltk/Input.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
10 #include <fltk/PackedGroup.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
11 #include <fltk/Output.h>
96
d6ee459f4403 includes cleanup in ui.cc
jcid
parents: 86
diff changeset
12 #include <fltk/Image.h>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
13
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
14 using namespace fltk;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
15
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
16 typedef enum {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
17 UI_BACK = 0,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
18 UI_FORW,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19 UI_HOME,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
20 UI_RELOAD,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
21 UI_SAVE,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
22 UI_STOP,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
23 UI_BOOK,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
24 UI_CLEAR,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
25 UI_SEARCH
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26 } UIButton;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
28 typedef enum {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
29 UI_NORMAL = 0, /* make sure it's compatible with bool */
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
30 UI_HIDDEN = 1,
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
31 UI_TEMPORARILY_SHOW_PANELS
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
32 } UIPanelmode;
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
33
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
34 // Private class
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
35 class NewProgressBox;
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
36
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
37 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
38 // UI class definition -------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
39 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
40 class UI : public fltk::Window {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41 Group *TopGroup;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks,
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 0
diff changeset
43 *Clear, *Search, *FullScreen, *ImageLoad, *BugMeter;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
44 Input *Location;
32
90c545de7201 - Enabled hiding widgets of the control panel from dillorc2.
jcid
parents: 22
diff changeset
45 PackedGroup *ProgBox;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
46 NewProgressBox *PProg, *IProg;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
47 Image *ImgLeftIns, *ImgLeftSens, *ImgRightIns, *ImgRightSens,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
48 *ImgStopIns, *ImgStopSens, *ImgFullScreenOn, *ImgFullScreenOff,
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 0
diff changeset
49 *ImgImageLoadOn, *ImgImageLoadOff, *ImgMeterOK, *ImgMeterBug;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
50 Group *Panel, *StatusPanel;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
51 Widget *Main;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
52 Output *Status;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
53
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
54 int MainIdx;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
55 // Panel customization variables
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
56 int PanelSize, CuteColor, Small_Icons;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
57 int xpos, bw, bh, fh, lh, lbl;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
58
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
59 UIPanelmode Panelmode;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
60
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
61 PackedGroup *make_toolbar(int tw, int th);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
62 PackedGroup *make_location();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
63 PackedGroup *make_progress_bars(int wide, int thin_up);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
64 Group *make_menu(int tiny);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
65 Group *make_panel(int ww);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
66
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
67
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
68 public:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
69
72
fbda2a94d998 - Made "New browser window" inherit the panel style of its parent.
jcid
parents: 32
diff changeset
70 UI(int w, int h, const char* label = 0, const UI *cur_ui = NULL);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
71 ~UI() {} // TODO: implement destructor
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
72
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
73 // To manage what events to catch and which to let pass
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
74 int handle(int event);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
75
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
76 const char *get_location();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
77 void set_location(const char *str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
78 void focus_location();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
79 void set_status(const char *str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
80 void set_page_prog(size_t nbytes, int cmd);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
81 void set_img_prog(int n_img, int t_img, int cmd);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
82 void set_bug_prog(int n_bug);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
83 void set_render_layout(Widget &nw);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
84 void set_page_title(const char *label);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
85 void customize(int flags);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
86 void button_set_sens(UIButton btn, int sens);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
87 void paste_url();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
88 void set_panelmode(UIPanelmode mode);
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
89 UIPanelmode get_panelmode();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
90
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
91 Widget *fullscreen_button() { return FullScreen; }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
92 void fullscreen_toggle() { FullScreen->do_callback(); }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
93
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
94 // Hooks to method callbacks
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
95 void panel_cb_i();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
96 void color_change_cb_i();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
97 void toggle_cb_i();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
98 void panelmode_cb_i();
22
571f09e42ab6 - Hooked "Activate" to the form_receiver.
jcid
parents: 0
diff changeset
99 void imageload_toggle();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
100 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
101
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
102 #endif // __UI_HH__