annotate src/ui.hh @ 1813:6a203275d317

a bit of src/ui
author corvid <corvid@lavabit.com>
date Fri, 07 Jan 2011 12:32:16 +0000
parents 3c683905dbe3
children a0ed332132e1
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
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
6 #include <FL/Fl_Window.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
7 #include <FL/Fl_Widget.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
8 #include <FL/Fl_Button.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
9 #include <FL/Fl_Input.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
10 #include <FL/Fl_Pack.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
11 #include <FL/Fl_Output.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
12 #include <FL/Fl_Image.H>
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
13 #include <FL/Fl_Tabs.H>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
14
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 217
diff changeset
15 #include "findbar.hh"
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 217
diff changeset
16
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
17 typedef enum {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
18 UI_BACK = 0,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19 UI_FORW,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
20 UI_HOME,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
21 UI_RELOAD,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
22 UI_SAVE,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
23 UI_STOP,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
24 UI_BOOK,
827
d513abcd4949 Implemented the tools button with CSS options. Also removed nav.h from html.cc
Jorge Arellano Cid <jcid@dillo.org>
parents: 438
diff changeset
25 UI_TOOLS,
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26 UI_CLEAR,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27 UI_SEARCH
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
28 } UIButton;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
29
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
30 typedef enum {
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
31 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
32 UI_HIDDEN = 1,
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
33 UI_TEMPORARILY_SHOW_PANELS
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
34 } UIPanelmode;
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
35
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
36 // Private classes
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
37 class CustProgressBox;
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
38 class CustTabGroup;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
39
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
40 //
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41 // UI class definition -------------------------------------------------------
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 //
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
43 class UI : public Fl_Group {
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
44 CustTabGroup *Tabs;
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
45 char *TabTooltip;
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
46
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
47 Fl_Group *TopGroup;
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
48 Fl_Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools,
1525
3c683905dbe3 Added a help button. It tries a local help file then dillo.org's one.
corvid, jcid
parents: 1347
diff changeset
49 *Clear, *Search, *Help, *FullScreen, *BugMeter, *FileButton;
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
50 Fl_Input *Location;
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
51 Fl_Pack *ProgBox;
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
52 CustProgressBox *PProg, *IProg;
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
53 Fl_Group *Panel, *StatusPanel;
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
54 Fl_Widget *Main;
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
55 Fl_Output *Status;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
56
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
57 int MainIdx;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
58 // Panel customization variables
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
59 int PanelSize, CuteColor, Small_Icons;
75
4dfc78307039 Made progress bars resize automatically.
jcid
parents: 72
diff changeset
60 int xpos, bw, bh, fh, lh, lbl;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
61
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
62 UIPanelmode Panelmode;
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 217
diff changeset
63 Findbar *findbar;
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 404
diff changeset
64 int PointerOnLink;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
65
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
66 Fl_Pack *make_toolbar(int tw, int th);
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
67 Fl_Pack *make_location();
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
68 Fl_Pack *make_progress_bars(int wide, int thin_up);
314
cf1216d236d4 - Reimplemented the menubar in a more ortodox way.
jcid
parents: 301
diff changeset
69 void make_menubar(int x, int y, int w, int h);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
70 Fl_Widget *make_filemenu_button();
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
71 Fl_Group *make_panel(int ww);
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
72 Fl_Group *make_status_panel(int ww);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
73
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
74 public:
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
75
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
76 UI(int x,int y,int w,int h, const char* label = 0, const UI *cur_ui=NULL);
301
da2c1fb876c8 - implemented UI's destructor (i.e. UI::~UI())
jcid
parents: 224
diff changeset
77 ~UI();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
78
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
79 // To manage what events to catch and which to let pass
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
80 int handle(int event);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
81
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
82 const char *get_location();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
83 void set_location(const char *str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
84 void focus_location();
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
85 void focus_main();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
86 void set_status(const char *str);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
87 void set_page_prog(size_t nbytes, int cmd);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
88 void set_img_prog(int n_img, int t_img, int cmd);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
89 void set_bug_prog(int n_bug);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
90 void set_render_layout(Fl_Widget &nw);
1101
73a85563d3a9 Fix: don't update window title for background tabs
Jorge Arellano Cid <jcid@dillo.org>
parents: 946
diff changeset
91 void set_tab_title(const char *label);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
92 void customize(int flags);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
93 void button_set_sens(UIButton btn, int sens);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
94 void paste_url();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
95 void set_panelmode(UIPanelmode mode);
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
96 UIPanelmode get_panelmode();
224
07d1e0d8463c - Replaced the findtext dialog with an in-window widget!
jcid
parents: 217
diff changeset
97 void set_findbar_visibility(bool visible);
1813
6a203275d317 a bit of src/ui
corvid <corvid@lavabit.com>
parents: 1525
diff changeset
98 Fl_Widget *fullscreen_button() { return FullScreen; }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
99 void fullscreen_toggle() { FullScreen->do_callback(); }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
100
350
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
101 CustTabGroup *tabs() { return Tabs; }
118fe0444e08 - Added the "middle_click_opens_new_tab" option to dillo2rc.
jcid
parents: 341
diff changeset
102 void tabs(CustTabGroup *tabs) { Tabs = tabs; }
438
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 404
diff changeset
103 int pointerOnLink() { return PointerOnLink; }
29c514f5ce00 - Added the "middle_click_drags_page" dillorc option.
jcid
parents: 404
diff changeset
104 void pointerOnLink(int flag) { PointerOnLink = flag; }
341
215da0caf90b - Implemented tabbed browsing.
jcid
parents: 333
diff changeset
105
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
106 // Hooks to method callbacks
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
107 void panel_cb_i();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
108 void color_change_cb_i();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
109 void toggle_cb_i();
217
a27eafd634d1 - Made CTRL-l focus the location bar instead of popping up a dialog.
jcid
parents: 96
diff changeset
110 void panelmode_cb_i();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
111 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
112
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
113 #endif // __UI_HH__