Fixed issues with Fl_Scroll inside and Fl_Scroll (STR #265)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6117 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
7f7debce52
commit
5134c0988d
3
CHANGES
3
CHANGES
@ -1,5 +1,8 @@
|
||||
CHANGES IN FLTK 1.3.0
|
||||
|
||||
- added scroll_to() to Fl_Scroll, replacing position()
|
||||
which now behaves as it should (STR #1303)
|
||||
- fixed Fl_Scroll inside Fl_Scroll (STR #265)
|
||||
- hardcoded 1.1 references in src/Makefile to 1.3
|
||||
(STR #1922)
|
||||
- changed font index to 32 bit
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
int xposition() const {return xposition_;}
|
||||
int yposition() const {return yposition_;}
|
||||
void position(int, int);
|
||||
void scroll_to(int, int);
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
||||
@ -52,15 +52,13 @@ space for the scrollbars, as Fluid won't show these either. </P>
|
||||
<P><I>You cannot use <TT>Fl_Window</TT> as a child of this since the
|
||||
clipping is not conveyed to it when drawn, and it will draw over the
|
||||
scrollbars and neighboring objects.</I></P>
|
||||
<P><I><TT>Fl_Scroll</TT> widgets should not be nested. Having an Fl_Scroll
|
||||
inside another Fl_Scroll may result in drawing errors when resizing.</I></P>
|
||||
<H3>Methods</H3>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Scroll.Fl_Scroll>Fl_Scroll</A></LI>
|
||||
<LI><A href=#Fl_Scroll.~Fl_Scroll>~Fl_Scroll</A></LI>
|
||||
<LI><A href=#Fl_Scroll.align>align</A></LI>
|
||||
<LI><A href=#Fl_Scroll.position>position</A></LI>
|
||||
<LI><A href=#Fl_Scroll.type>type</A></LI>
|
||||
<LI><A href=#Fl_Scroll.scroll_to>scroll_to</A></LI>
|
||||
<LI><A href=#Fl_Scroll.xposition>xposition</A></LI>
|
||||
<LI><A href=#Fl_Scroll.yposition>yposition</A></LI>
|
||||
</UL>
|
||||
@ -100,6 +98,8 @@ considered. The flags in <TT>hscrollbar</TT> however are ignored.
|
||||
Gets the current horizontal scrolling position.
|
||||
<H4><A name=Fl_Scroll.yposition>int Fl_Scroll::yposition() const</A></H4>
|
||||
Gets the current vertical scrolling position.
|
||||
<H4><A name=Fl_Scroll.position>void Fl_Scroll::position(int w, int h)</A>
|
||||
</H4>
|
||||
Sets the upper-lefthand corner of the scrolling region. </BODY></HTML>
|
||||
<H4><A name=Fl_Scroll.scroll_to>void Fl_Scroll::scroll_to(int x, int y)</A></H4>
|
||||
Moves the contents of the scroll group to a new position.
|
||||
<H4><A name=Fl_Scroll.position>void Fl_Scroll::position(int x, int y)</A></H4>
|
||||
Moves the scroll group itself to a new position.
|
||||
</BODY></HTML>
|
||||
|
||||
@ -237,17 +237,28 @@ void Fl_Scroll::draw() {
|
||||
}
|
||||
|
||||
void Fl_Scroll::resize(int X, int Y, int W, int H) {
|
||||
int dx = X-x(), dy = Y-y();
|
||||
fix_scrollbar_order();
|
||||
// move all the children:
|
||||
Fl_Widget*const* a = array();
|
||||
for (int i=children()-2; i--;) {
|
||||
Fl_Object* o = *a++;
|
||||
o->position(o->x()+X-x(), o->y()+Y-y());
|
||||
o->position(o->x()+dx, o->y()+dy);
|
||||
}
|
||||
if (w()==W && h()==H) {
|
||||
char pad = (scrollbar.visible() && hscrollbar.visible());
|
||||
char al = (scrollbar.align()&FL_ALIGN_LEFT!=0);
|
||||
char at = (scrollbar.align()&FL_ALIGN_TOP!=0);
|
||||
scrollbar.position(al?X:X+W-scrollbar.w(), (at&&pad)?Y+hscrollbar.h():Y);
|
||||
hscrollbar.position((al&&pad)?X+scrollbar.w():X, at?Y:Y+H-hscrollbar.h());
|
||||
} else {
|
||||
// FIXME recalculation of scrollbars needs to be moved out fo "draw()" (STR #1895)
|
||||
redraw(); // need full recalculation of scrollbars
|
||||
}
|
||||
Fl_Widget::resize(X,Y,W,H);
|
||||
}
|
||||
|
||||
void Fl_Scroll::position(int X, int Y) {
|
||||
void Fl_Scroll::scroll_to(int X, int Y) {
|
||||
int dx = xposition_-X;
|
||||
int dy = yposition_-Y;
|
||||
if (!dx && !dy) return;
|
||||
@ -265,12 +276,12 @@ void Fl_Scroll::position(int X, int Y) {
|
||||
|
||||
void Fl_Scroll::hscrollbar_cb(Fl_Widget* o, void*) {
|
||||
Fl_Scroll* s = (Fl_Scroll*)(o->parent());
|
||||
s->position(int(((Fl_Scrollbar*)o)->value()), s->yposition());
|
||||
s->scroll_to(int(((Fl_Scrollbar*)o)->value()), s->yposition());
|
||||
}
|
||||
|
||||
void Fl_Scroll::scrollbar_cb(Fl_Widget* o, void*) {
|
||||
Fl_Scroll* s = (Fl_Scroll*)(o->parent());
|
||||
s->position(s->xposition(), int(((Fl_Scrollbar*)o)->value()));
|
||||
s->scroll_to(s->xposition(), int(((Fl_Scrollbar*)o)->value()));
|
||||
}
|
||||
|
||||
Fl_Scroll::Fl_Scroll(int X,int Y,int W,int H,const char* L)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user