aboutsummaryrefslogtreecommitdiff
path: root/dpi/downloads.cc
diff options
context:
space:
mode:
authorJeremy Henty <onepoint@starurchin.org>2011-10-17 21:09:52 +0100
committerJeremy Henty <onepoint@starurchin.org>2011-10-17 21:09:52 +0100
commitfd7d2e9a678c76f6f18e9dcf820546e261261421 (patch)
tree4d67b9562e51ae8feb8107e75378c0095985fb6f /dpi/downloads.cc
parent658b771be04003785d7450bfbce30c6a682fd1ea (diff)
downloads DPI: make the download items resize horizontally with the main window.
Diffstat (limited to 'dpi/downloads.cc')
-rw-r--r--dpi/downloads.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/dpi/downloads.cc b/dpi/downloads.cc
index 5599b6e9..d9ccb380 100644
--- a/dpi/downloads.cc
+++ b/dpi/downloads.cc
@@ -1087,6 +1087,29 @@ void DLWin::abort_all()
}
/*
+ * A Scroll class that resizes its resizable widget to its width.
+ * see http://seriss.com/people/erco/fltk/#ScrollableWidgetBrowser
+ */
+class DlScroll : public Fl_Scroll
+{
+public:
+ void resize(int x_, int y_, int w_, int h_)
+ {
+ Fl_Widget *resizable_ = resizable();
+ if (resizable_)
+ resizable_->resize(resizable_->x(),
+ resizable_->y(),
+ w() - scrollbar_size(),
+ resizable_->h());
+ Fl_Scroll::resize(x_, y_, w_, h_);
+ }
+ DlScroll(int x, int y, int w, int h, const char *l = 0)
+ : Fl_Scroll(x, y, w, h, l)
+ {
+ }
+};
+
+/*
* Create the main window and an empty list of requests.
*/
DLWin::DLWin(int ww, int wh) {
@@ -1097,12 +1120,13 @@ DLWin::DLWin(int ww, int wh) {
// Create the empty main window
mWin = new Fl_Window(ww, wh, "Downloads:");
mWin->begin();
- mScroll = new Fl_Scroll(0,0,ww,wh);
+ mScroll = new DlScroll(0,0,ww,wh);
mScroll->begin();
mPG = new Fl_Pack(0,0,ww-18,wh);
mPG->end();
mScroll->end();
mScroll->type(Fl_Scroll::VERTICAL);
+ mScroll->resizable(mPG);
mWin->end();
mWin->resizable(mScroll);
mWin->callback(dlwin_esc_cb, NULL);