summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-12-12 21:33:34 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-12-12 21:33:34 +0000
commitcd9639c212846ba3597f1f10551d1c55b6c51312 (patch)
tree606ad78a661d43d95e413cd751c1e4506051ed31 /src
parenta9103714031cedb16b00cd6ce81ef93b04734f08 (diff)
Update documentation screenshots (still have some to go...)
Cleanup some demos and the color chooser. Restore code in Fl_Window::hotspot() to keep the window on the screen. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1837 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Color_Chooser.cxx34
-rw-r--r--src/Fl_Window_hotspot.cxx48
2 files changed, 44 insertions, 38 deletions
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index 91076241e..e13643e83 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4 2001/01/22 15:13:39 easysw Exp $"
+// "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.1 2001/12/12 21:33:34 easysw Exp $"
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
@@ -40,7 +40,7 @@
// The "hue box" can be a circle or rectilinear.
// You get a circle by defining this:
-// #define CIRCLE 1
+#define CIRCLE 1
// And the "hue box" can auto-update when the value changes
// you get this by defining this:
#define UPDATE_HUE_BOX 1
@@ -320,14 +320,14 @@ void Fl_Color_Chooser::mode_cb(Fl_Widget* o, void*) {
////////////////////////////////////////////////////////////////
Fl_Color_Chooser::Fl_Color_Chooser(int X, int Y, int W, int H, const char* L)
- : Fl_Group(0,0,180,100,L),
- huebox(0,0,100,100),
- valuebox(100,0,20,100),
- choice(120,0,60,20),
- rvalue(120,20,60,23),
- gvalue(120,43,60,23),
- bvalue(120,66,60,23),
- resize_box(0,89,100,9)
+ : Fl_Group(0,0,195,115,L),
+ huebox(0,0,115,115),
+ valuebox(115,0,20,115),
+ choice(140,0,55,25),
+ rvalue(140,30,55,25),
+ gvalue(140,60,55,25),
+ bvalue(140,90,55,25),
+ resize_box(0,0,115,115)
{
end();
resizable(resize_box);
@@ -384,15 +384,15 @@ extern const char* fl_ok;
extern const char* fl_cancel;
int fl_color_chooser(const char* name, double& r, double& g, double& b) {
- Fl_Window window(210,153,name);
- Fl_Color_Chooser chooser(5, 5, 200, 95);
- ColorChip ok_color(5, 105, 95, 23);
- Fl_Return_Button ok_button(5, 128, 95, 23, fl_ok);
- ColorChip cancel_color(110, 105, 95, 23);
+ Fl_Window window(215,200,name);
+ Fl_Color_Chooser chooser(10, 10, 195, 115);
+ ColorChip ok_color(10, 130, 95, 25);
+ Fl_Return_Button ok_button(10, 165, 95, 25, fl_ok);
+ ColorChip cancel_color(110, 130, 95, 25);
cancel_color.r = uchar(255*r+.5); ok_color.r = cancel_color.r;
ok_color.g = cancel_color.g = uchar(255*g+.5);
ok_color.b = cancel_color.b = uchar(255*b+.5);
- Fl_Button cancel_button(110, 128, 95, 23, fl_cancel);
+ Fl_Button cancel_button(110, 165, 95, 25, fl_cancel);
window.resizable(chooser);
chooser.rgb(r,g,b);
chooser.callback(chooser_cb, &ok_color);
@@ -431,5 +431,5 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
}
//
-// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4 2001/01/22 15:13:39 easysw Exp $".
+// End of "$Id: Fl_Color_Chooser.cxx,v 1.7.2.4.2.1 2001/12/12 21:33:34 easysw Exp $".
//
diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx
index 176985a86..ec0f580b7 100644
--- a/src/Fl_Window_hotspot.cxx
+++ b/src/Fl_Window_hotspot.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3 2001/01/22 15:13:40 easysw Exp $"
+// "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.1 2001/12/12 21:33:34 easysw Exp $"
//
// Common hotspot routines for the Fast Light Tool Kit (FLTK).
//
@@ -27,17 +27,21 @@
#include <FL/Fl_Window.H>
#ifdef WIN32
-#include <FL/win32.H>
+# include <FL/win32.H>
#endif
-void Fl_Window::hotspot(int X, int Y, int /*offscreen*/) {
- int mx,my; Fl::get_mouse(mx,my);
+void Fl_Window::hotspot(int X, int Y, int offscreen) {
+ int mx,my;
+
+ // Update the screen position based on the mouse position.
+ Fl::get_mouse(mx,my);
X = mx-X; Y = my-Y;
-#if 0
- // Both the WIN32 and X versions do this to all windows all the time...
+
+ // If offscreen is 0 (the default), make sure that the window
+ // stays on the screen, if possible.
if (!offscreen) {
#ifdef WIN32
- //These will be used by reference, so we must passed different variables
+ // These will be used by reference, so we must passed different variables
int bt,bx,by;
x(X);y(Y);
Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
@@ -45,24 +49,25 @@ void Fl_Window::hotspot(int X, int Y, int /*offscreen*/) {
if (X==x()) x(X-1);
#else
if (border()) {
- // ensure border is on screen:
+ // Ensure border is on screen; these values are generic enough
+ // to work with many window managers, and are based on KDE defaults.
const int top = 20;
- const int left = 1;
- const int right = 1;
- const int bottom = 1;
- if (X+w()+right > Fl::w()) X = Fl::w()-right-w();
- if (X-left < 0) X = left;
- if (Y+h()+bottom > Fl::h()) Y = Fl::h()-bottom-h();
- if (Y-top < 0) Y = top;
+ const int left = 4;
+ const int right = 4;
+ const int bottom = 8;
+ if (X+w()+right > Fl::w()-Fl::x()) X = Fl::w()-Fl::x()-right-w();
+ if (X-left < Fl::x()) X = left;
+ if (Y+h()+bottom > Fl::h()-Fl::y()) Y = Fl::h()-Fl::y()-bottom-h();
+ if (Y-top < Fl::y()) Y = top;
}
// now insure contents are on-screen (more important than border):
- if (X+w() > Fl::w()) X = Fl::w()-w();
- if (X < 0) X = 0;
- if (Y+h() > Fl::h()) Y = Fl::h()-h();
- if (Y < 0) Y = 0;
+ if (X+w() > Fl::w()-Fl::x()) X = Fl::w()-Fl::x()-w();
+ if (X < Fl::x()) X = Fl::x();
+ if (Y+h() > Fl::h()-Fl::y()) Y = Fl::h()-Fl::y()-h();
+ if (Y < Fl::y()) Y = Fl::y();
#endif
}
-#endif
+
position(X,Y);
}
@@ -76,6 +81,7 @@ void Fl_Window::hotspot(const Fl_Widget *o, int offscreen) {
hotspot(X,Y,offscreen);
}
+
//
-// End of "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3 2001/01/22 15:13:40 easysw Exp $".
+// End of "$Id: Fl_Window_hotspot.cxx,v 1.7.2.3.2.1 2001/12/12 21:33:34 easysw Exp $".
//