[patch]: download window resizes its contents to its width

Jeremy Henty <onepoint-YprzHiG/[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Purely  cosmetic, but  I dislike  it  when the  contents ignore  their
container, even in only one out of two dimensions.  Comments?

Regards,

Jeremy Henty

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
dlwin_resize_items_to_width (text/plain, 1.5 KB)
# HG changeset patch
# Parent 1a801718e0ab473a3a891f3b79b70ddb29c02eef
downloads DPI: make the download items resize horizontally with the main window.

diff -r 1a801718e0ab dpi/downloads.cc
--- a/dpi/downloads.cc	Thu Oct 06 18:59:52 2011 +0100
+++ b/dpi/downloads.cc	Thu Oct 06 21:42:29 2011 +0100
@@ -1087,6 +1087,29 @@
 }
 
 /*
+ * 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 @@
    // 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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.