Remove extra 3 pixel offset when the size is below a certain amount;

instead, use a constant +1 offset.

Add another bit to flags_, VISIBLE_FOCUS, which provides
per-widget keyboard focus control.  The default is for all
widgets to participate in keyboard focus navigation.  Use the
set_visible_focus(), clear_visible_focus(), and visible_focus()
methods on Fl_Widget to control this.

Clean up the Fl_Widget documentation and add missing stuff.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2543 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2002-07-23 15:07:33 +00:00
parent c22732b9e0
commit 57cef6a4bd
6 changed files with 340 additions and 256 deletions
+3
View File
@@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.0rc5
- Added new visible focus flag bit and methods to
Fl_Widget, so it is now possible to do both global and
per-widget keyboard focus control.
- Removed extra 3 pixel border around input fields.
- No longer quote characters from 0x80 to 0x9f in input
fields.
+8 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget.H,v 1.6.2.4.2.14 2002/05/13 05:05:11 spitzak Exp $"
// "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
@@ -85,7 +85,8 @@ protected:
int flags() const {return flags_;}
void set_flag(int c) {flags_ |= c;}
void clear_flag(int c) {flags_ &= ~c;}
enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64, CHANGED=128};
enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64,
CHANGED=128, VISIBLE_FOCUS=512};
FL_EXPORT void draw_box() const;
FL_EXPORT void draw_box(Fl_Boxtype, Fl_Color) const;
@@ -174,6 +175,10 @@ public:
void set_changed() {flags_ |= CHANGED;}
void clear_changed() {flags_ &= ~CHANGED;}
FL_EXPORT int take_focus();
void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
int visible_focus() { return flags_ & VISIBLE_FOCUS; }
FL_EXPORT static void default_callback(Fl_Widget*, void*);
void do_callback() {callback_(this,user_data_);}
@@ -207,5 +212,5 @@ public:
#endif
//
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.14 2002/05/13 05:05:11 spitzak Exp $".
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $".
//
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl.cxx,v 1.24.2.41.2.42 2002/07/11 01:10:15 matthiaswm Exp $"
// "$Id: Fl.cxx,v 1.24.2.41.2.43 2002/07/23 15:07:33 easysw Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -419,6 +419,7 @@ static int send_handlers(int event) {
Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
void Fl::focus(Fl_Widget *o) {
if (o && !o->visible_focus()) return;
if (grab()) return; // don't do anything while grab is on
Fl_Widget *p = focus_;
if (o != p) {
@@ -948,5 +949,5 @@ void Fl_Window::flush() {
}
//
// End of "$Id: Fl.cxx,v 1.24.2.41.2.42 2002/07/11 01:10:15 matthiaswm Exp $".
// End of "$Id: Fl.cxx,v 1.24.2.41.2.43 2002/07/23 15:07:33 easysw Exp $".
//
+3 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.13 2002/07/20 05:56:44 easysw Exp $"
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.14 2002/07/23 15:07:33 easysw Exp $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
@@ -233,7 +233,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
p = value();
// visit each line and draw it:
int desc = height-fl_descent();
int xpos = X-xscroll_; if (W > 12) xpos += 3;
int xpos = X - xscroll_ + 1;
int ypos = -yscroll_;
for (; ypos < H;) {
@@ -872,5 +872,5 @@ Fl_Input_::~Fl_Input_() {
}
//
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.13 2002/07/20 05:56:44 easysw Exp $".
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.14 2002/07/23 15:07:33 easysw Exp $".
//
+4 -3
View File
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.18 2002/06/02 17:52:36 easysw Exp $"
// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.19 2002/07/23 15:07:33 easysw Exp $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
@@ -89,7 +89,7 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
callback_ = default_callback;
user_data_ = 0;
type_ = 0;
flags_ = 0;
flags_ = VISIBLE_FOCUS;
damage_ = 0;
box_ = FL_NO_BOX;
color_ = FL_GRAY;
@@ -115,6 +115,7 @@ int Fl_Widget::damage_resize(int X, int Y, int W, int H) {
int Fl_Widget::take_focus() {
if (!takesevents()) return 0;
if (!visible_focus()) return 0;
if (!handle(FL_FOCUS)) return 0; // see if it wants it
if (contains(Fl::focus())) return 1; // it called Fl::focus for us
Fl::focus(this);
@@ -241,5 +242,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
}
//
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.18 2002/06/02 17:52:36 easysw Exp $".
// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.19 2002/07/23 15:07:33 easysw Exp $".
//