summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/fltkviewbase.cc2
-rw-r--r--dw/fltkviewport.cc27
-rw-r--r--dw/layout.cc7
-rw-r--r--dw/view.hh6
4 files changed, 24 insertions, 18 deletions
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc
index d14f866c..10c3fa65 100644
--- a/dw/fltkviewbase.cc
+++ b/dw/fltkviewbase.cc
@@ -297,6 +297,8 @@ int FltkViewBase::handle (int event)
void FltkViewBase::setLayout (core::Layout *layout)
{
theLayout = layout;
+ if (usesViewport())
+ theLayout->viewportSizeChanged(this, w(), h());
}
void FltkViewBase::setCanvasSize (int width, int ascent, int descent)
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc
index c0574dff..135550e8 100644
--- a/dw/fltkviewport.cc
+++ b/dw/fltkviewport.cc
@@ -40,11 +40,13 @@ FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
hscrollbar = new Fl_Scrollbar (x (), y (), 1, 1);
hscrollbar->type(FL_HORIZONTAL);
hscrollbar->callback (hscrollbarCallback, this);
+ hscrollbar->hide();
add (hscrollbar);
vscrollbar = new Fl_Scrollbar (x (), y(), 1, 1);
vscrollbar->type(FL_VERTICAL);
vscrollbar->callback (vscrollbarCallback, this);
+ vscrollbar->hide();
add (vscrollbar);
scrollX = scrollY = scrollDX = scrollDY = 0;
@@ -70,6 +72,7 @@ void FltkViewport::adjustScrollbarsAndGadgetsAllocation ()
int hdiff = 0, vdiff = 0;
int visibility = 0;
+ _MSG(" >>FltkViewport::adjustScrollbarsAndGadgetsAllocation\n");
if (hscrollbar->visible ())
visibility |= 1;
if (vscrollbar->visible ())
@@ -384,18 +387,26 @@ void FltkViewport::setViewportSize (int width, int height,
int hScrollbarThickness,
int vScrollbarThickness)
{
- if (hScrollbarThickness > 0)
- hscrollbar->show ();
- else
- hscrollbar->hide ();
- if (vScrollbarThickness > 0)
- vscrollbar->show ();
- else
- vscrollbar->hide ();
+ int adjustReq =
+ (hscrollbar->visible() ? !hScrollbarThickness : hScrollbarThickness) ||
+ (vscrollbar->visible() ? !vScrollbarThickness : vScrollbarThickness);
+
+ _MSG("FltkViewport::setViewportSize old_w,old_h=%dx%d -> w,h=%dx%d\n"
+ "\t hThick=%d hVis=%d, vThick=%d vVis=%d, adjustReq=%d\n",
+ w(),h(),width,height,
+ hScrollbarThickness,hscrollbar->visible(),
+ vScrollbarThickness,vscrollbar->visible(), adjustReq);
+
+ (hScrollbarThickness > 0) ? hscrollbar->show () : hscrollbar->hide ();
+ (vScrollbarThickness > 0) ? vscrollbar->show () : vscrollbar->hide ();
/* If no scrollbar, go to the beginning */
scroll(hScrollbarThickness ? 0 : -scrollX,
vScrollbarThickness ? 0 : -scrollY);
+
+ /* Adjust when scrollbar visibility changes */
+ if (adjustReq)
+ adjustScrollbarsAndGadgetsAllocation ();
}
void FltkViewport::updateCanvasWidgets (int dx, int dy)
diff --git a/dw/layout.cc b/dw/layout.cc
index b430eaa1..a02c87b7 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -679,10 +679,9 @@ void Layout::resizeIdle ()
}
// Set viewport sizes.
- if (view->usesViewport ())
- view->setViewportSize (viewportWidth, viewportHeight,
- actualHScrollbarThickness,
- actualVScrollbarThickness);
+ view->setViewportSize (viewportWidth, viewportHeight,
+ actualHScrollbarThickness,
+ actualVScrollbarThickness);
}
}
diff --git a/dw/view.hh b/dw/view.hh
index 308e5e31..f2504091 100644
--- a/dw/view.hh
+++ b/dw/view.hh
@@ -92,12 +92,6 @@ public:
* This will normally imply a resize of the UI widget. Width and height are
* the dimensions of the new size, \em including the scrollbar thicknesses.
*
- * \bug The rest of this comment needs to be updated.
- *
- * markerWidthDiff and markerHeightDiff are the respective dimensions of
- * the viewport markers (see dw::core::getMarkerWidthDiff and
- * dw::core::getMarkerHeightDiff), if they are 0, the respective
- * marker should not be shown at all.
*/
virtual void setViewportSize (int width, int height,
int hScrollbarThickness,