DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L1915
Version: 2.0-current
Link: http://www.fltk.org/str.php?L1915
Version: 2.0-current
Index: src/ScrollGroup.cxx
===================================================================
--- src/ScrollGroup.cxx (revision 6841)
+++ src/ScrollGroup.cxx (working copy)
@@ -182,6 +182,7 @@
void ScrollGroup::layout() {
int layout_damage = this->layout_damage();
+ uchar type=Widget::type()^GROUP_TYPE;
// handle movement in xy without wasting time:
if (!(layout_damage&(LAYOUT_WH|LAYOUT_DAMAGE|LAYOUT_CHILD))) {
@@ -195,8 +196,8 @@
for (int repeat=0; repeat<2; repeat++) {
layout_damage &= ~LAYOUT_WH;
- if (!(type()&HORIZONTAL)) layout_damage |= LAYOUT_W;
- if (!(type()&VERTICAL)) layout_damage |= LAYOUT_H;
+ if (!(type&HORIZONTAL)) layout_damage |= LAYOUT_W;
+ if (!(type&VERTICAL)) layout_damage |= LAYOUT_H;
Group::layout(rectangle, layout_damage);
// move all the children and accumulate their bounding boxes:
@@ -225,16 +226,16 @@
// widgets to use up the available space.
int newDx = 0;
int newDy = 0;
- if ( type() & VERTICAL ) {
- if ( b < rectangle.b() ) {
+ if (type & VERTICAL) {
+ if (b < rectangle.b()) {
int space = rectangle.b()-b;
int hidden = rectangle.y()-t;
newDy = (space>hidden) ? hidden : space;
newDy = (newDy>0) ? newDy : 0;
}
}
- if ( type() & HORIZONTAL ) {
- if ( r < rectangle.r() ) {
+ if (type & HORIZONTAL) {
+ if (r < rectangle.r()) {
int space = rectangle.r()-r;
int hidden = rectangle.x()-l; // ell
newDx = (space>hidden) ? hidden : space;
@@ -243,7 +244,7 @@
}
// Move the child widgets again if they are to be kept inside.
- if ( newDx || newDy ) {
+ if (newDx || newDy) {
for (int i=0; i < numchildren; i++) {
Widget* o = child(i);
o->position(o->x()+newDx, o->y()+newDy);
@@ -252,8 +253,8 @@
}
// Turn on/off the scrollbars if it fits:
- if ((type() & VERTICAL) &&
- ((type() & ALWAYS_ON) || t < rectangle.y() || b > rectangle.b())) {
+ if ((type & VERTICAL) &&
+ ((type & ALWAYS_ON) || t < rectangle.y() || b > rectangle.b())) {
// turn on the vertical scrollbar
if (!scrollbar.visible()) {
scrollbar.set_visible();
@@ -266,8 +267,8 @@
}
}
- if ((type() & HORIZONTAL) &&
- ((type() & ALWAYS_ON) || l < rectangle.x() || r > rectangle.r())) {
+ if ((type & HORIZONTAL) &&
+ ((type & ALWAYS_ON) || l < rectangle.x() || r > rectangle.r())) {
// turn on the horizontal scrollbar
if (!hscrollbar.visible()) {
hscrollbar.set_visible();
@@ -356,7 +357,7 @@
scrollbar(nogroup(X)+W-SLIDER_WIDTH,Y,SLIDER_WIDTH,H-SLIDER_WIDTH),
hscrollbar(X,Y+H-SLIDER_WIDTH,W-SLIDER_WIDTH,SLIDER_WIDTH)
{
- type(BOTH | GROUP_TYPE);
+ type(BOTH);
xposition_ = 0;
yposition_ = 0;
scrolldx = scrolldy = layoutdx = layoutdy = 0;
Index: test/scroll.cxx
===================================================================
--- test/scroll.cxx (revision 6841)
+++ test/scroll.cxx (working copy)
@@ -84,7 +84,7 @@
void load_menu_choice (Choice* c) {
c->begin();
- new Item("0", 0, type_cb, (void*)0);
+ new Item("None", 0, type_cb, (void*)ScrollGroup::NONE);
new Item("HORIZONTAL", 0, type_cb, (void*)ScrollGroup::HORIZONTAL);
new Item("VERTICAL", 0, type_cb, (void*)ScrollGroup::VERTICAL);
new Item("BOTH", 0, type_cb, (void*)ScrollGroup::BOTH);
@@ -135,7 +135,7 @@
Choice choice(150, 335, 200, 25, "type():");
load_menu_choice(&choice);
- choice.value(3);
+ choice.value(2);
Choice achoice(150, 360, 200, 25, "scrollbar_align():");
load_menu_achoice(&achoice);
Index: fltk/ScrollGroup.h
===================================================================
--- fltk/ScrollGroup.h (revision 6841)
+++ fltk/ScrollGroup.h (working copy)
@@ -67,13 +67,14 @@
ScrollGroup(int x,int y,int w,int h, const char*l=0, bool begin=false);
enum { // values for type()
- HORIZONTAL = 1,
- VERTICAL = 2,
- BOTH = 3,
- ALWAYS_ON = 4,
- HORIZONTAL_ALWAYS = 5,
- VERTICAL_ALWAYS = 6,
- BOTH_ALWAYS = 7
+ NONE = GROUP_TYPE, // Added to avoid using 0 and messing up with RTTI
funcionality.
+ HORIZONTAL = 1 | GROUP_TYPE,
+ VERTICAL = 2 | GROUP_TYPE,
+ BOTH = 3 | GROUP_TYPE,
+ ALWAYS_ON = 4 | GROUP_TYPE,
+ HORIZONTAL_ALWAYS = 5 | GROUP_TYPE,
+ VERTICAL_ALWAYS = 6 | GROUP_TYPE,
+ BOTH_ALWAYS = 7 | GROUP_TYPE
};
int xposition() const {return xposition_;}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs