Better layout of browser, fix hiding

This commit is contained in:
Vedran Ljubovic 2007-08-17 11:15:19 +00:00
parent 25b80eaffa
commit 3fa8a90a96
2 changed files with 12 additions and 4 deletions

View File

@ -217,7 +217,7 @@ static void scroll_cb(Fl_Widget* w, void*) {
EDE_Browser::EDE_Browser(int X,int Y,int W,int H,const char *L) : Fl_Icon_Browser(X,Y,W,H), EDE_Browser::EDE_Browser(int X,int Y,int W,int H,const char *L) : Fl_Icon_Browser(X,Y,W,H),
totalwidth_(0), column_header_(0), sort_column(0), sort_type(NO_SORT), sort_direction(false) { totalwidth_(0), column_header_(0), sort_column(0), sort_type(NO_SORT), sort_direction(false) {
Fl_Group* thegroup = new Fl_Group(X,Y,W,H); thegroup = new Fl_Group(X,Y,W,H);
thegroup->begin(); thegroup->begin();
heading = new Heading(0,0,W,buttonheight); heading = new Heading(0,0,W,buttonheight);
heading->box(FL_FLAT_BOX); // draw heading background heading->box(FL_FLAT_BOX); // draw heading background
@ -226,7 +226,7 @@ EDE_Browser::EDE_Browser(int X,int Y,int W,int H,const char *L) : Fl_Icon_Browse
heading->hide(); heading->hide();
heading->parent(this); // for callback heading->parent(this); // for callback
hscrollbar = new Fl_Scrollbar(1, H-Fl::scrollbar_size()-2, W-Fl::scrollbar_size()-3, Fl::scrollbar_size()); // take account for edges hscrollbar = new Fl_Scrollbar(1, H-Fl::scrollbar_size(), W-Fl::scrollbar_size()-3, Fl::scrollbar_size()); // take account for edges
hscrollbar->type(FL_HORIZONTAL); hscrollbar->type(FL_HORIZONTAL);
hscrollbar->hide(); hscrollbar->hide();
hscrollbar->parent(this); // for callback hscrollbar->parent(this); // for callback
@ -407,11 +407,11 @@ void EDE_Browser::resize(int X, int Y, int W, int H) {
// show scrollbar // show scrollbar
hscrollbar->value(hscrollbar->value(), W, 0, totalwidth_); hscrollbar->value(hscrollbar->value(), W, 0, totalwidth_);
if (!hscrollbar->visible()) { if (!hscrollbar->visible()) {
hscrollbar->resize(X+1, Y+H-fsbs-2, W-fsbs-3, fsbs); hscrollbar->resize(X+1, Y+H-fsbs, W-fsbs-3, fsbs);
hscrollbar->show(); hscrollbar->show();
H -= fsbs; H -= fsbs;
} else { } else {
hscrollbar->resize(X+1, Y+H-2, W-fsbs-3, fsbs); hscrollbar->resize(X+1, Y+H, W-fsbs-3, fsbs);
hscrollbar->redraw(); hscrollbar->redraw();
} }
} }

View File

@ -95,6 +95,8 @@ private:
void mqsort(char *labels[], int beg, int end, SortType type); // my implementation of qsort void mqsort(char *labels[], int beg, int end, SortType type); // my implementation of qsort
bool sortfn(char *,char*,SortType); // sort function, per type bool sortfn(char *,char*,SortType); // sort function, per type
Fl_Group* thegroup;
public: public:
EDE_Browser(int X,int Y,int W,int H,const char *L=0); EDE_Browser(int X,int Y,int W,int H,const char *L=0);
@ -193,6 +195,12 @@ public:
} }
Fl_Icon_Browser::hposition(X); Fl_Icon_Browser::hposition(X);
} }
void hide() {
heading->hide();
thegroup->hide(); /* group */
Fl_Widget::hide();
}
}; };
#endif #endif