changeset 946:f06d5c581f58

Moved creation of the UI's status panel into a function.
author corvid <corvid@lavabit.com>
date Sun, 15 Feb 2009 09:06:21 -0300
parents 9f5c99b18c69
children be8491f4d66a 691053e40394
files src/ui.cc src/ui.hh
diffstat 2 files changed, 34 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.cc	Fri Feb 13 18:16:50 2009 -0300
+++ b/src/ui.cc	Sun Feb 15 09:06:21 2009 -0300
@@ -625,13 +625,43 @@
 }
 
 /*
+ * Create the status panel
+ */
+Group *UI::make_status_panel(int ww)
+{
+   const int s_h = 20, bm_w = 16;
+   Group *g = new Group(0, 0, ww, s_h, 0);
+
+   // Status box
+   Status = new Output(0, 0, ww-bm_w, s_h, 0);
+   Status->value("");
+   Status->box(THIN_DOWN_BOX);
+   Status->clear_click_to_focus();
+   Status->clear_tab_to_focus();
+   Status->color(GRAY80);
+   g->add(Status);
+   //Status->throw_focus();
+
+   // Bug Meter
+   BugMeter = new HighlightButton(ww-bm_w,0,bm_w,s_h,0);
+   BugMeter->image(icons->ImgMeterOK);
+   BugMeter->box(THIN_DOWN_BOX);
+   BugMeter->align(ALIGN_INSIDE|ALIGN_CLIP|ALIGN_LEFT);
+   BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
+   BugMeter->callback(bugmeter_cb, this);
+   BugMeter->clear_tab_to_focus();
+   g->add(BugMeter);
+
+   g->resizable(Status);
+   return g;
+}
+
+/*
  * User Interface constructor
  */
 UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) :
   Group(x, y, ww, wh, label)
 {
-   int s_h = 20;
-
    PointerOnLink = FALSE;
 
    Tabs = NULL;
@@ -655,12 +685,10 @@
      Panelmode = (UIPanelmode) prefs.fullwindow_start;
    }
 
-
    // Control panel
    Panel = make_panel(ww);
    TopGroup->add(Panel);
 
-
    // Render area
    Main = new Widget(0,0,1,1,"Welcome...");
    Main->box(FLAT_BOX);
@@ -678,30 +706,7 @@
    TopGroup->add(findbar);
 
    // Status Panel
-   StatusPanel = new Group(0, 0, ww, s_h, 0);
-   // Status box
-   int bm_w = 16;
-   Status = new Output(0, 0, ww-bm_w, s_h, 0);
-   Status->value("");
-   Status->box(THIN_DOWN_BOX);
-   Status->clear_click_to_focus();
-   Status->clear_tab_to_focus();
-   Status->color(GRAY80);
-   StatusPanel->add(Status);
-   //Status->throw_focus();
-
-   // Bug Meter
-   BugMeter = new HighlightButton(ww-bm_w,0,bm_w,s_h,0);
-   BugMeter->image(icons->ImgMeterOK);
-   BugMeter->box(THIN_DOWN_BOX);
-   BugMeter->align(ALIGN_INSIDE|ALIGN_CLIP|ALIGN_LEFT);
-   BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
-   BugMeter->callback(bugmeter_cb, this);
-   BugMeter->clear_tab_to_focus();
-   StatusPanel->add(BugMeter);
-
-   StatusPanel->resizable(Status);
-
+   StatusPanel = make_status_panel(ww);
    TopGroup->add(StatusPanel);
 
    // Make the full screen button (to be attached to the viewport later)
@@ -717,8 +722,6 @@
       Panel->hide();
       StatusPanel->hide();
    }
-
-   //show();
 }
 
 /*
--- a/src/ui.hh	Fri Feb 13 18:16:50 2009 -0300
+++ b/src/ui.hh	Sun Feb 15 09:06:21 2009 -0300
@@ -73,6 +73,7 @@
    void make_menubar(int x, int y, int w, int h);
    Widget *make_filemenu_button();
    Group *make_panel(int ww);
+   Group *make_status_panel(int ww);
 
 public: