diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-01 02:15:43 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-01 02:15:43 +0000 |
| commit | 685100b1222821dedec2e0b22f55ca18027a99df (patch) | |
| tree | 8e3d5e0669628a2e39070af76d51bba7f87b98b3 | |
| parent | 063d67de86af0fcdad54f28d49ba9aacca6ae96a (diff) | |
Add default cursor as data the Fl_Window tracks individually (with the
default being the original global default...)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2561 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | FL/Fl_Window.H | 8 | ||||
| -rw-r--r-- | src/Fl_Window.cxx | 8 | ||||
| -rw-r--r-- | src/fl_cursor.cxx | 25 |
4 files changed, 37 insertions, 6 deletions
@@ -1,6 +1,8 @@ CHANGES IN FLTK 1.1.0 - Documentation updates. + - Added image() methods() to Fl_Menu_Item. + - Added default_cursor() method and data to Fl_Window. - Fl_Group would send FL_ENTER events before FL_LEAVE events, causing problems with adjacent widgets. - Fixed filename problems with Fl_File_Chooser - diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index 03f561496..45b25e8ed 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window.H,v 1.12.2.6.2.3 2002/07/14 21:25:39 easysw Exp $" +// "$Id: Fl_Window.H,v 1.12.2.6.2.4 2002/08/01 02:15:41 easysw Exp $" // // Window header file for the Fast Light Tool Kit (FLTK). // @@ -43,6 +43,9 @@ class FL_EXPORT Fl_Window : public Fl_Group { // size_range stuff: short minw, minh, maxw, maxh; uchar dw, dh, aspect, size_range_set; + // cursor stuff + Fl_Cursor cursor_default; + Fl_Color cursor_fg, cursor_bg; FL_EXPORT void size_range_(); // values for flags(): enum { @@ -112,6 +115,7 @@ public: // for back-compatability only: void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); + void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); static void default_callback(Fl_Window*, void* v); }; @@ -119,5 +123,5 @@ public: #endif // -// End of "$Id: Fl_Window.H,v 1.12.2.6.2.3 2002/07/14 21:25:39 easysw Exp $". +// End of "$Id: Fl_Window.H,v 1.12.2.6.2.4 2002/08/01 02:15:41 easysw Exp $". // diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index 3567fc40d..e3cbb37e5 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window.cxx,v 1.6.2.3.2.7 2002/07/14 21:25:39 easysw Exp $" +// "$Id: Fl_Window.cxx,v 1.6.2.3.2.8 2002/08/01 02:15:43 easysw Exp $" // // Window widget class for the Fast Light Tool Kit (FLTK). // @@ -53,6 +53,10 @@ void Fl_Window::_Fl_Window() { Fl_Window::Fl_Window(int X,int Y,int W, int H, const char *l) : Fl_Group(X, Y, W, H, l) { + cursor_default = FL_CURSOR_DEFAULT; + cursor_fg = FL_BLACK; + cursor_bg = FL_WHITE; + _Fl_Window(); set_flag(FL_FORCE_POSITION); } @@ -119,5 +123,5 @@ Fl_Window *Fl_Window::current() { // -// End of "$Id: Fl_Window.cxx,v 1.6.2.3.2.7 2002/07/14 21:25:39 easysw Exp $". +// End of "$Id: Fl_Window.cxx,v 1.6.2.3.2.8 2002/08/01 02:15:43 easysw Exp $". // diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx index 477753e76..026429122 100644 --- a/src/fl_cursor.cxx +++ b/src/fl_cursor.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_cursor.cxx,v 1.6.2.6.2.4 2002/01/01 15:11:32 easysw Exp $" +// "$Id: fl_cursor.cxx,v 1.6.2.6.2.5 2002/08/01 02:15:43 easysw Exp $" // // Mouse cursor support for the Fast Light Tool Kit (FLTK). // @@ -41,6 +41,16 @@ void fl_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { if (Fl::first_window()) Fl::first_window()->cursor(c,fg,bg); } +void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { + if (c == FL_CURSOR_DEFAULT) c = FL_CURSOR_ARROW; + + cursor_default = c; + cursor_fg = fg; + cursor_bg = bg; + + cursor(c, fg, bg); +} + #ifdef WIN32 # ifndef IDC_HAND @@ -49,6 +59,9 @@ void fl_cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { if (!shown()) return; + if (c == FL_CURSOR_DEFAULT) { + c = cursor_default; + } if (c > FL_CURSOR_NESW) { i->cursor = 0; } else if (c == FL_CURSOR_DEFAULT) { @@ -173,6 +186,9 @@ static Cursor crsrARROW = void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) { if (!shown()) return; + if (c == FL_CURSOR_DEFAULT) { + c = cursor_default; + } switch (c) { case FL_CURSOR_CROSS: i->cursor = GetCursor( crossCursor ); break; case FL_CURSOR_WAIT: i->cursor = GetCursor( watchCursor ); break; @@ -251,6 +267,11 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { if (!shown()) return; Cursor cursor; int deleteit = 0; + if (c == FL_CURSOR_DEFAULT) { + c = cursor_default; + fg = cursor_fg; + bg = cursor_bg; + } if (!c) { cursor = None; } else { @@ -290,5 +311,5 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { #endif // -// End of "$Id: fl_cursor.cxx,v 1.6.2.6.2.4 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: fl_cursor.cxx,v 1.6.2.6.2.5 2002/08/01 02:15:43 easysw Exp $". // |
