diff options
Diffstat (limited to 'src/ui.hh')
-rw-r--r-- | src/ui.hh | 101 |
1 files changed, 88 insertions, 13 deletions
@@ -35,18 +35,93 @@ typedef enum { // Private classes class CustProgressBox; -class CustTabGroup; +class CustTabs; + + +// Class definition ---------------------------------------------------------- +/* + * Used to reposition group's widgets when some of them are hidden + */ +class CustGroup : public Fl_Group { +public: + CustGroup(int x,int y,int w ,int h,const char *l = 0) : + Fl_Group(x,y,w,h,l) { }; + void rearrange(void) { + int n = children(), xpos = 0, r_x1, r_i = -1, i; + + init_sizes(); + for (i = 0; i < n; ++i) { + if (child(i) == resizable()) { + r_i = i; + r_x1 = xpos; + break; + } + if (child(i)->visible()) { + child(i)->position(xpos, child(i)->y()); + xpos += child(i)->w(); + } + } + if (r_i < 0) + return; + xpos = w(); + for (i = n - 1; i > r_i; --i) { + if (child(i)->visible()) { + xpos -= child(i)->w(); + child(i)->position(xpos, child(i)->y()); + } + } + child(r_i)->resize(r_x1, child(r_i)->y(), xpos-r_x1, child(r_i)->h()); + redraw(); + } + void rearrange_y(void) { + int n = children(), pos = 0, r_pos, r_i = -1, i; + + printf("children = %d\n", n); + init_sizes(); + for (i = 0; i < n; ++i) { + if (child(i) == resizable()) { + r_i = i; + r_pos = pos; + break; + } + if (child(i)->visible()) { + printf("child[%d] x=%d y=%d w=%d h=%d\n", + i, child(i)->x(), pos, child(i)->w(), child(i)->h()); + child(i)->position(child(i)->x(), pos); + pos += child(i)->h(); + } + } + if (r_i < 0) + return; + pos = h(); + for (i = n - 1; i > r_i; --i) { + if (child(i)->visible()) { + pos -= child(i)->h(); + printf("child[%d] x=%d y=%d w=%d h=%d\n", + i, child(i)->x(), pos, child(i)->w(), child(i)->h()); + child(i)->position(child(i)->x(), pos); + } + } + child(r_i)->resize(child(r_i)->x(), r_pos, child(r_i)->w(), pos-r_pos); + printf("resizable child[%d] x=%d y=%d w=%d h=%d\n", + r_i, child(r_i)->x(), r_pos, child(r_i)->w(), child(r_i)->h()); + child(r_i)->hide(); + redraw(); + } +}; + // // UI class definition ------------------------------------------------------- // -class UI : public Fl_Group { - CustTabGroup *Tabs; +class UI : public Fl_Pack { + CustTabs *Tabs; char *TabTooltip; Fl_Group *TopGroup; Fl_Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools, *Clear, *Search, *Help, *FullScreen, *BugMeter, *FileButton; + CustGroup *LocBar, *NavBar, *StBar; Fl_Input *Location; Fl_Pack *ProgBox; CustProgressBox *PProg, *IProg; @@ -56,19 +131,20 @@ class UI : public Fl_Group { int MainIdx; // Panel customization variables int PanelSize, CuteColor, Small_Icons; - int xpos, bw, bh, fh, lh, lbl; + int p_xpos, p_ypos, bw, bh, fh, lh, nh, sh, pw, lbl; UIPanelmode Panelmode; Findbar *findbar; int PointerOnLink; - - Fl_Pack *make_toolbar(int tw, int th); - Fl_Pack *make_location(); - Fl_Pack *make_progress_bars(int wide, int thin_up); + Fl_Button *make_button(const char *label, Fl_Image *img, + Fl_Image*deimg, int b_n, int start = 0); + void make_toolbar(int tw, int th); + void make_location(int ww); + void make_progress_bars(int wide, int thin_up); void make_menubar(int x, int y, int w, int h); Fl_Widget *make_filemenu_button(); - Fl_Group *make_panel(int ww); - Fl_Group *make_status_panel(int ww); + void make_panel(int ww); + void make_status_panel(int ww); public: @@ -87,7 +163,6 @@ public: void set_img_prog(int n_img, int t_img, int cmd); void set_bug_prog(int n_bug); void set_render_layout(Fl_Group &nw); - void set_tab_title(const char *label); void customize(int flags); void button_set_sens(UIButton btn, int sens); void paste_url(); @@ -97,8 +172,8 @@ public: Fl_Widget *fullscreen_button() { return FullScreen; } void fullscreen_toggle() { FullScreen->do_callback(); } - CustTabGroup *tabs() { return Tabs; } - void tabs(CustTabGroup *tabs) { Tabs = tabs; } + CustTabs *tabs() { return Tabs; } + void tabs(CustTabs *tabs) { Tabs = tabs; } int pointerOnLink() { return PointerOnLink; } void pointerOnLink(int flag) { PointerOnLink = flag; } |