Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
ui.hh
Go to the documentation of this file.
1#ifndef __UI_HH__
2#define __UI_HH__
3
4// UI for dillo --------------------------------------------------------------
5
6#include <FL/Fl_Window.H>
7#include <FL/Fl_Widget.H>
8#include <FL/Fl_Button.H>
9#include <FL/Fl_Input.H>
10#include <FL/Fl_Output.H>
11#include <FL/Fl_Image.H>
12#include <FL/Fl_Tabs.H>
13
14#include "tipwin.hh"
15#include "findbar.hh"
16
29
30typedef enum {
32 UI_HIDDEN = 1
34
35
36// Min size to fit the full UI
37#define UI_MIN_W 600
38#define UI_MIN_H 200
39
40// Private classes
41class CustProgressBox;
42class CustTabs;
43
44
45// Class definitions ---------------------------------------------------------
51class CustGroupHorizontal : public Fl_Group {
52 Fl_Widget *rsz;
53public:
54 CustGroupHorizontal(int x,int y,int w ,int h,const char *l = 0) :
55 Fl_Group(x,y,w,h,l) { };
56
57 void rearrange() {
58 Fl_Widget*const* a = array();
59 int sum = 0, _x = x();
60 int children_ = children();
61
62 if (resizable())
63 rsz = resizable();
64
65 for (int i=0; i < children_; i++)
66 if (a[i] != resizable() && a[i]->visible())
67 sum += a[i]->w();
68
69 for (int i=0; i < children_; i++) {
70 if (a[i] == rsz) {
71 if (w() > sum) {
72 a[i]->resize(_x, y(), w()-sum, h());
73 if (!resizable())
74 resizable(rsz);
75 } else {
76 /* widgets overflow width */
77 a[i]->resize(_x, y(), 0, h());
78 resizable(NULL);
79 }
80 } else {
81 a[i]->resize(_x, y(), a[i]->w(), h());
82 }
83 if (a[i]->visible())
84 _x += a[i]->w();
85 }
86 init_sizes();
87 redraw();
88 }
89};
90
91class CustGroupVertical : public Fl_Group {
92public:
93 CustGroupVertical(int x,int y,int w ,int h,const char *l = 0) :
94 Fl_Group(x,y,w,h,l) { };
95
96 void rearrange() {
97 Fl_Widget*const* a = array();
98 int sum = 0, _y = y();
99 int children_ = children();
100
101 for (int i=0; i < children_; i++)
102 if (a[i] != resizable() && a[i]->visible())
103 sum += a[i]->h();
104
105 for (int i=0; i < children_; i++) {
106 if (a[i] == resizable()) {
107 a[i]->resize(x(), _y, w(), h() - sum);
108 } else {
109 a[i]->resize(x(), _y, w(), a[i]->h());
110 }
111 if (a[i]->visible())
112 _y += a[i]->h();
113 }
114 init_sizes();
115 redraw();
116 }
117};
118
119
120//
121// UI class definition -------------------------------------------------------
122//
123class UI : public CustGroupVertical {
124 CustTabs *Tabs;
125
130 Fl_Input *Location;
131 CustProgressBox *PProg, *IProg;
132 Fl_Group *Panel, *Main, *LocationGroup;
133 Fl_Output *StatusOutput;
135
137 // Panel customization variables
139 int p_xpos, p_ypos, bw, bh, mh, lh, nh, fh, sh, pw, lbl;
141
143 CustButton *make_button(const char *label, Fl_Image *img, Fl_Image*deimg,
144 int b_n, int start = 0);
145 void make_toolbar(int tw, int th);
146 void make_location(int ww);
147 void make_progress_bars(int wide, int thin_up);
148 void make_menubar(int x, int y, int w, int h);
150 void make_panel(int ww);
151 void make_status_bar(int ww, int wh);
152
153public:
154
155 UI(int x,int y,int w,int h, const char* label = 0, const UI *cur_ui=NULL);
156 ~UI();
157
159 int handle(int event);
160
161 const char *get_location();
162 void set_location(const char *str);
163 void focus_location();
164 void focus_main();
165 void set_status(const char *str);
166 void set_page_prog(size_t nbytes, int cmd);
167 void set_img_prog(int n_img, int t_img, int cmd);
168 void set_bug_prog(int n_bug);
169 void set_render_layout(Fl_Group *nw);
170 void customize();
171 void button_set_sens(UIButton btn, int sens);
172 void paste_url();
173 int get_panelsize() { return PanelSize; }
174 int get_smallicons() { return Small_Icons; }
175 void change_panel(int new_size, int small_icons);
176 void findbar_toggle(bool add);
177 void panels_toggle();
178
179 CustTabs *tabs() { return Tabs; }
180 void tabs(CustTabs *tabs) { Tabs = tabs; }
182 void temporaryPanels(bool val) { PanelTemporary = val; }
183
184 // Hooks to method callbacks
187};
188
189#endif // __UI_HH__
A button that highlights on mouse over.
Definition tipwin.hh:49
Used to reposition group's widgets when some of them are hidden.
Definition ui.hh:51
Fl_Widget * rsz
Definition ui.hh:52
CustGroupHorizontal(int x, int y, int w, int h, const char *l=0)
Definition ui.hh:54
void rearrange()
Definition ui.hh:57
void rearrange()
Definition ui.hh:96
CustGroupVertical(int x, int y, int w, int h, const char *l=0)
Definition ui.hh:93
Searchbar to find text in page.
Definition findbar.hh:16
Definition ui.hh:123
int sh
Definition ui.hh:139
void tabs(CustTabs *tabs)
Definition ui.hh:180
int mh
Definition ui.hh:139
void set_img_prog(int n_img, int t_img, int cmd)
Set the image progress text.
Definition ui.cc:902
void make_menubar(int x, int y, int w, int h)
bool PanelTemporary
Definition ui.hh:140
CustButton * Bookmarks
Definition ui.hh:127
CustButton * Search
Definition ui.hh:128
void button_set_sens(UIButton btn, int sens)
Set button sensitivity (Back/Forw/Stop)
Definition ui.cc:1031
~UI()
UI destructor.
Definition ui.cc:709
void customize()
Customize the UI's panel (show/hide buttons)
Definition ui.cc:945
void temporaryPanels(bool val)
Definition ui.hh:182
int get_panelsize()
Definition ui.hh:173
Fl_Group * LocationGroup
Definition ui.hh:132
int p_xpos
Definition ui.hh:139
CustGroupHorizontal * LocBar
Definition ui.hh:129
int nh
Definition ui.hh:139
CustButton * make_button(const char *label, Fl_Image *img, Fl_Image *deimg, int b_n, int start=0)
Make a generic navigation button.
Definition ui.cc:388
CustButton * Stop
Definition ui.hh:127
void findbar_toggle(bool add)
Adjust space for the findbar (if necessary) and show or remove it.
Definition ui.cc:1059
void set_render_layout(Fl_Group *nw)
Set 'nw' as the main render area widget.
Definition ui.cc:1016
CustButton * Save
Definition ui.hh:127
Fl_Output * StatusOutput
Definition ui.hh:133
void focus_main()
Focus Main area.
Definition ui.cc:853
int fh
Definition ui.hh:139
int pw
Definition ui.hh:139
const char * get_location()
Get the text from the location input-box.
Definition ui.cc:820
void make_toolbar(int tw, int th)
Create the archetipic browser buttons.
Definition ui.cc:411
void change_panel(int new_size, int small_icons)
On-the-fly panel style change.
Definition ui.cc:985
bool temporaryPanels()
Definition ui.hh:181
int lh
Definition ui.hh:139
int bw
Definition ui.hh:139
CustProgressBox * PProg
Definition ui.hh:131
void focus_location()
Focus location entry.
Definition ui.cc:839
int bh
Definition ui.hh:139
int p_ypos
Definition ui.hh:139
int Small_Icons
Definition ui.hh:138
CustButton * Home
Definition ui.hh:127
int handle(int event)
To manage what events to catch and which to let pass.
Definition ui.cc:717
void make_status_bar(int ww, int wh)
Create the status panel.
Definition ui.cc:621
void make_progress_bars(int wide, int thin_up)
Create the progress bars.
Definition ui.cc:495
CustButton * Back
Definition ui.hh:127
CustTabs * tabs()
Definition ui.hh:179
void color_change_cb_i()
int get_smallicons()
Definition ui.hh:174
CustGroupVertical * TopGroup
Definition ui.hh:126
int MainIdx
Definition ui.hh:136
CustGroupHorizontal * NavBar
Definition ui.hh:129
CustButton * Tools
Definition ui.hh:128
void make_location(int ww)
Create the location box (Clear/Input/Search)
Definition ui.cc:450
CustButton * FileButton
Definition ui.hh:128
Fl_Group * Main
Definition ui.hh:132
CustButton * Reload
Definition ui.hh:127
CustTabs * Tabs
Definition ui.hh:124
CustButton * Help
Definition ui.hh:128
CustProgressBox * IProg
Definition ui.hh:131
void set_bug_prog(int n_bug)
Set the bug meter progress text.
Definition ui.cc:923
Fl_Input * Location
Definition ui.hh:130
CustGroupHorizontal * StatusBar
Definition ui.hh:129
Fl_Group * Panel
Definition ui.hh:132
void panels_toggle()
Make panels disappear growing the render area.
Definition ui.cc:1090
CustButton * BugMeter
Definition ui.hh:128
void set_status(const char *str)
Set a new message in the status bar.
Definition ui.cc:861
void paste_url()
Paste a middle-click-selection into "Clear" button as URL.
Definition ui.cc:1051
void toggle_cb_i()
void make_panel(int ww)
Create the control panel.
Definition ui.cc:541
CustButton * Forw
Definition ui.hh:127
void set_location(const char *str)
Set a new URL in the location input-box.
Definition ui.cc:828
CustButton * Clear
Definition ui.hh:128
int PanelSize
Definition ui.hh:138
Findbar * FindBar
Definition ui.hh:134
UIPanelmode Panelmode
Definition ui.hh:142
int lbl
Definition ui.hh:139
void make_filemenu_button()
Create the "File" menu.
Definition ui.cc:514
void set_page_prog(size_t nbytes, int cmd)
Set the page progress text.
Definition ui.cc:870
static struct iconset small_icons
Definition ui.cc:65
UIPanelmode
Definition ui.hh:30
@ UI_HIDDEN
Definition ui.hh:32
@ UI_NORMAL
make sure it's compatible with bool
Definition ui.hh:31
UIButton
Definition ui.hh:17
@ UI_BOOK
Definition ui.hh:24
@ UI_RELOAD
Definition ui.hh:21
@ UI_SAVE
Definition ui.hh:22
@ UI_TOOLS
Definition ui.hh:25
@ UI_SEARCH
Definition ui.hh:27
@ UI_FORW
Definition ui.hh:19
@ UI_HOME
Definition ui.hh:20
@ UI_BACK
Definition ui.hh:18
@ UI_CLEAR
Definition ui.hh:26
@ UI_STOP
Definition ui.hh:23