New Fl_Widget::redraw_label() method to cleanly redraw the label of a
widget (this should eliminate the extra flicker some users have complained about...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2652 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
3a0dd9fe23
commit
8d552439c7
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
CHANGES IN FLTK 1.1.0
|
||||
|
||||
- Documentation updates.
|
||||
- Added a Fl_Widget::redraw_label() method which flags a
|
||||
redraw of the appropriate area. This helps to
|
||||
eliminate flicker when updating the value of a widget.
|
||||
- Fl_Wizard::value() now resets the mouse cursor to the
|
||||
window's default cursor.
|
||||
- Fl_File_Chooser::type() didn't enable/disable the new
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget.H,v 1.6.2.4.2.18 2002/08/14 17:05:38 easysw Exp $"
|
||||
// "$Id: Fl_Widget.H,v 1.6.2.4.2.19 2002/10/04 15:59:28 easysw Exp $"
|
||||
//
|
||||
// Widget header file for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -131,7 +131,7 @@ public:
|
||||
void selection_color(unsigned a) {color2_ = a;}
|
||||
void color(unsigned a, unsigned b) {color_=a; color2_=b;}
|
||||
const char* label() const {return label_.value;}
|
||||
void label(const char* a) {label_.value=a;}
|
||||
void label(const char* a) {label_.value=a; redraw_label();}
|
||||
void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
|
||||
Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
|
||||
void labeltype(Fl_Labeltype a) {label_.type = a;}
|
||||
@ -194,6 +194,7 @@ public:
|
||||
int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
|
||||
|
||||
void redraw();
|
||||
void redraw_label();
|
||||
uchar damage() const {return damage_;}
|
||||
void clear_damage(uchar c = 0) {damage_ = c;}
|
||||
void damage(uchar c);
|
||||
@ -216,5 +217,5 @@ public:
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.18 2002/08/14 17:05:38 easysw Exp $".
|
||||
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.19 2002/10/04 15:59:28 easysw Exp $".
|
||||
//
|
||||
|
@ -75,6 +75,7 @@ to call <TT>redraw()</TT> after these. </P>
|
||||
<LI><A href=#Fl_Widget.parent>parent</A></LI>
|
||||
<LI><A href=#Fl_Widget.position>position</A></LI>
|
||||
<LI><A href=#Fl_Widget.redraw>redraw</A></LI>
|
||||
<LI><A href=#Fl_Widget.redraw_label>redraw_label</A></LI>
|
||||
<LI><A href=#Fl_Widget.resize>resize</A></LI>
|
||||
<LI><A href=#Fl_Widget.selection_color>selection_color</A></LI>
|
||||
<LI><A href=#Fl_Widget.set_changed>set_changed</A></LI>
|
||||
@ -386,6 +387,12 @@ HREF="Fl_Window.html#Fl_Window"><tt>Fl_Window</tt></a>. Returns
|
||||
HREF="subclassing.html#draw"><TT>draw()</TT></A> routine called.
|
||||
|
||||
|
||||
<H4><A name=Fl_Widget.redraw_label>void Fl_Widget::redraw_label()</A></H4>
|
||||
|
||||
<P>Marks the widget or the parent as needing a redraw for the
|
||||
label area of a widget.
|
||||
|
||||
|
||||
<H4><A name=Fl_Widget.resize>virtual void
|
||||
Fl_Widget::resize(int x, int y, int w, int h)</A>
|
||||
<BR><A name=Fl_Widget.position>void Fl_Widget::position(short x, short y)</A>
|
||||
|
@ -332,7 +332,7 @@ sign. Figure 3-4 shows the available symbols.</P>
|
||||
<I>Figure 3-4: FLTK label symbols</I></A></P>
|
||||
|
||||
<P>The @ sign may also be followed by the following optional
|
||||
"formatting" characters, in this order:</P>
|
||||
"formatting" characters, in this order:</P>
|
||||
|
||||
<UL>
|
||||
|
||||
@ -342,12 +342,15 @@ sign. Figure 3-4 shows the available symbols.</P>
|
||||
<LI>+[1-9] or -[1-9] tweaks the scaling a little bigger
|
||||
or smaller.</LI>
|
||||
|
||||
<LI>[1-9] - rotates by a multiple of 45 degrees. '6'
|
||||
does nothing, the others point in the direction of
|
||||
that key on a numeric keypad.</LI>
|
||||
<LI>[1-9] - rotates by a multiple of 45 degrees. '5' and
|
||||
'6' do no rotation while the others point in the
|
||||
direction of that key on a numeric keypad.</LI>
|
||||
|
||||
</UL>
|
||||
|
||||
<P>Thus, to show a very large arrow pointing downward you would use the
|
||||
label string "@+92->".
|
||||
|
||||
<H3>align()</H3>
|
||||
|
||||
<P>The <TT>align()</TT> method positions the label. The following
|
||||
|
11
src/Fl.cxx
11
src/Fl.cxx
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl.cxx,v 1.24.2.41.2.53 2002/09/20 17:56:56 easysw Exp $"
|
||||
// "$Id: Fl.cxx,v 1.24.2.41.2.54 2002/10/04 15:59:28 easysw Exp $"
|
||||
//
|
||||
// Main event handling code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -855,7 +855,9 @@ void Fl::paste(Fl_Widget &receiver) {
|
||||
|
||||
void Fl_Widget::redraw() {
|
||||
damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
|
||||
void Fl_Widget::redraw_label() {
|
||||
if (window()) {
|
||||
if (box() == FL_NO_BOX) {
|
||||
// Widgets with the FL_NO_BOX boxtype need a parent to
|
||||
@ -880,7 +882,12 @@ void Fl_Widget::redraw() {
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h());
|
||||
} else if (align() & FL_ALIGN_RIGHT) {
|
||||
window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h());
|
||||
} else {
|
||||
damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
} else {
|
||||
// The label is inside the widget, so just redraw the widget itself...
|
||||
damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -960,5 +967,5 @@ void Fl_Window::flush() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.53 2002/09/20 17:56:56 easysw Exp $".
|
||||
// End of "$Id: Fl.cxx,v 1.24.2.41.2.54 2002/10/04 15:59:28 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.19 2002/07/23 15:07:33 easysw Exp $"
|
||||
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.20 2002/10/04 15:59:29 easysw Exp $"
|
||||
//
|
||||
// Base widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -182,6 +182,7 @@ void Fl_Widget::activate() {
|
||||
clear_flag(INACTIVE);
|
||||
if (active_r()) {
|
||||
redraw();
|
||||
redraw_label();
|
||||
handle(FL_ACTIVATE);
|
||||
if (inside(Fl::focus())) Fl::focus()->take_focus();
|
||||
}
|
||||
@ -192,6 +193,7 @@ void Fl_Widget::deactivate() {
|
||||
if (active_r()) {
|
||||
set_flag(INACTIVE);
|
||||
redraw();
|
||||
redraw_label();
|
||||
handle(FL_DEACTIVATE);
|
||||
fl_throw_focus(this);
|
||||
} else {
|
||||
@ -210,6 +212,7 @@ void Fl_Widget::show() {
|
||||
clear_flag(INVISIBLE);
|
||||
if (visible_r()) {
|
||||
redraw();
|
||||
redraw_label();
|
||||
handle(FL_SHOW);
|
||||
if (inside(Fl::focus())) Fl::focus()->take_focus();
|
||||
}
|
||||
@ -242,5 +245,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.19 2002/07/23 15:07:33 easysw Exp $".
|
||||
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.20 2002/10/04 15:59:29 easysw Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user