summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Cairo_Window.H39
-rw-r--r--FL/Fl_File_Input.H3
-rw-r--r--FL/Fl_Gl_Window.H48
-rw-r--r--FL/Fl_Input.H3
-rw-r--r--FL/Fl_Pack.H5
-rw-r--r--FL/Fl_Slider.H2
-rw-r--r--FL/Fl_Value_Input.H2
-rw-r--r--FL/Fl_Value_Output.H5
-rw-r--r--FL/Fl_Value_Slider.H3
-rw-r--r--src/Fl_Value_Input.cxx2
10 files changed, 69 insertions, 43 deletions
diff --git a/FL/Fl_Cairo_Window.H b/FL/Fl_Cairo_Window.H
index 169bff020..31ff318b2 100644
--- a/FL/Fl_Cairo_Window.H
+++ b/FL/Fl_Cairo_Window.H
@@ -45,7 +45,7 @@
/**
This defines a pre-configured cairo fltk window.
- This class overloads for you the virtual draw() method,
+ This class overloads the virtual draw() method for you,
so that the only thing you have to do is to provide your cairo code.
All cairo context handling is achieved transparently.
\note You can alternatively define your custom cairo fltk window,
@@ -55,23 +55,28 @@
the current window. \see Fl_Window::current()
*/
class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window {
+
+public:
+ Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {}
+
+protected:
+ /** Overloaded to provide cairo callback support */
+ void draw() {
+ Fl_Double_Window::draw();
+ // manual method ? if yes explicitly get a cairo_context here
+ if (!Fl::cairo_autolink_context())
+ Fl::cairo_make_current(this);
+ if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
+ }
+
public:
- Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {}
- /** Overloaded to provide cairo callback support */
- void draw() {
- Fl_Double_Window::draw();
- // manual method ? if yes explicitly get a cairo_context here
- if (!Fl::cairo_autolink_context())
- Fl::cairo_make_current(this);
- if (draw_cb_) draw_cb_(this, Fl::cairo_cc());
- }
- /** This defines the cairo draw calback prototype that you must further */
- typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
- /**
- You must provide a draw callback which will implement your cairo rendering,
- This method will permit you to set you \a cb cairo callback.
- */
- void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;}
+ /** This defines the cairo draw callback prototype that you must further */
+ typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
+ /**
+ You must provide a draw callback which will implement your cairo rendering.
+ This method will permit you to set your cairo callback to \a cb.
+ */
+ void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;}
private:
cairo_draw_cb draw_cb_;
};
diff --git a/FL/Fl_File_Input.H b/FL/Fl_File_Input.H
index 6422b5bf1..48b1faca7 100644
--- a/FL/Fl_File_Input.H
+++ b/FL/Fl_File_Input.H
@@ -68,8 +68,11 @@ public:
Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
virtual int handle(int event);
+
+protected:
virtual void draw();
+public:
/** Gets the box type used for the navigation bar. */
Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
/** Sets the box type to use for the navigation bar. */
diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H
index 8707f5d14..dac0a096f 100644
--- a/FL/Fl_Gl_Window.H
+++ b/FL/Fl_Gl_Window.H
@@ -35,7 +35,7 @@
#ifndef GLContext
/**
- opaque pointer type to hide system specific implementation.
+ Opaque pointer type to hide system specific implementation.
*/
typedef void* GLContext; // actually a GLXContext or HGLDC
#endif
@@ -43,22 +43,24 @@ typedef void* GLContext; // actually a GLXContext or HGLDC
class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
/**
- The Fl_Gl_Window widget sets things up so OpenGL works, and
- also keeps an OpenGL "context" for that window, so that changes to the
+ The Fl_Gl_Window widget sets things up so OpenGL works.
+
+ It also keeps an OpenGL "context" for that window, so that changes to the
lighting and projection may be reused between redraws. Fl_Gl_Window
- also flushes the OpenGL streams and swaps buffers after draw()
- returns.
- <P>OpenGL hardware typically provides some overlay bit planes, which
+ also flushes the OpenGL streams and swaps buffers after draw() returns.
+
+ OpenGL hardware typically provides some overlay bit planes, which
are very useful for drawing UI controls atop your 3D graphics. If the
- overlay hardware is not provided, FLTK tries to simulate the overlay,
+ overlay hardware is not provided, FLTK tries to simulate the overlay.
This works pretty well if your graphics are double buffered, but not
- very well for single-buffered. </P>
- <P>Please note that the FLTK drawing and clipping functions
+ very well for single-buffered.
+
+ Please note that the FLTK drawing and clipping functions
will not work inside an Fl_Gl_Window. All drawing
should be done using OpenGL calls exclusively.
Even though Fl_Gl_Window is derived from Fl_Group,
it is not useful to add other FLTK Widgets as children,
- unless those Widgets are modified to draw using OpenGL calls.
+ unless those widgets are modified to draw using OpenGL calls.
*/
class FL_EXPORT Fl_Gl_Window : public Fl_Window {
@@ -87,11 +89,10 @@ public:
void resize(int,int,int,int);
/**
- Is turned off when FLTK creates a new
- context for this window or when the window resizes, and is turned on <I>
- after</I> draw() is called. You can use this inside your
- draw() method to avoid unneccessarily initializing the OpenGL
- context. Just do this:
+ Is turned off when FLTK creates a new context for this window or
+ when the window resizes, and is turned on \e after draw() is called.
+ You can use this inside your draw() method to avoid unnecessarily
+ initializing the OpenGL context. Just do this:
\code
void mywindow::draw() {
if (!valid()) {
@@ -130,11 +131,11 @@ public:
*/
void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;}
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
+ /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
static int can_do(int m) {return can_do(m,0);}
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
+ /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
static int can_do(const int *m) {return can_do(0, m);}
- /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
+ /** Returns non-zero if the hardware supports the given or current OpenGL mode. */
int can_do() {return can_do(mode_,alist);}
/**
Set or change the OpenGL capabilites of the window. The value can be
@@ -188,8 +189,8 @@ public:
*/
int can_do_overlay();
/**
- This method causes draw_overlay to be called at a later time.
- Initially the overlay is clear, if you want the window to display
+ This method causes draw_overlay() to be called at a later time.
+ Initially the overlay is clear. If you want the window to display
something in the overlay when it first appears, you must call this
immediately after you show() your window.
*/
@@ -219,7 +220,12 @@ public:
Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
: Fl_Window(X,Y,W,H,l) {init();}
- // you *must* override the draw method
+protected:
+ /**
+ Draws the Fl_Gl_Window.
+
+ You \e \b must override the draw() method.
+ */
virtual void draw();
};
diff --git a/FL/Fl_Input.H b/FL/Fl_Input.H
index c3ca5d845..631d3f639 100644
--- a/FL/Fl_Input.H
+++ b/FL/Fl_Input.H
@@ -247,8 +247,9 @@ class FL_EXPORT Fl_Input : public Fl_Input_ {
int shift_position(int p);
int shift_up_down_position(int p);
void handle_mouse(int keepmark=0);
-public:
+protected:
void draw();
+public:
int handle(int);
Fl_Input(int,int,int,int,const char * = 0);
};
diff --git a/FL/Fl_Pack.H b/FL/Fl_Pack.H
index 238f68b35..fcfd712fa 100644
--- a/FL/Fl_Pack.H
+++ b/FL/Fl_Pack.H
@@ -51,12 +51,17 @@
*/
class FL_EXPORT Fl_Pack : public Fl_Group {
int spacing_;
+
public:
enum { // values for type(int)
VERTICAL = 0,
HORIZONTAL = 1
};
+
+protected:
void draw();
+
+public:
Fl_Pack(int x,int y,int w ,int h,const char *l = 0);
/**
Gets the number of extra pixels of blank space that are added
diff --git a/FL/Fl_Slider.H b/FL/Fl_Slider.H
index 7815beef1..fb0b3e701 100644
--- a/FL/Fl_Slider.H
+++ b/FL/Fl_Slider.H
@@ -80,10 +80,10 @@ protected:
// these allow subclasses to put the slider in a smaller area:
void draw(int, int, int, int);
int handle(int, int, int, int, int);
+ void draw();
public:
- void draw();
int handle(int);
Fl_Slider(int x,int y,int w,int h, const char *l = 0);
Fl_Slider(uchar t,int x,int y,int w,int h, const char *l);
diff --git a/FL/Fl_Value_Input.H b/FL/Fl_Value_Input.H
index 6cba43e6d..cdbcd86f4 100644
--- a/FL/Fl_Value_Input.H
+++ b/FL/Fl_Value_Input.H
@@ -73,7 +73,9 @@ private:
virtual void value_damage(); // cause damage() due to value() changing
public:
int handle(int);
+protected:
void draw();
+public:
void resize(int,int,int,int);
Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
~Fl_Value_Input();
diff --git a/FL/Fl_Value_Output.H b/FL/Fl_Value_Output.H
index f471e4910..72371d846 100644
--- a/FL/Fl_Value_Output.H
+++ b/FL/Fl_Value_Output.H
@@ -52,9 +52,12 @@ class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
Fl_Fontsize textsize_;
uchar soft_;
unsigned textcolor_;
+
+protected:
+ void draw();
+
public:
int handle(int);
- void draw();
Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
/**
diff --git a/FL/Fl_Value_Slider.H b/FL/Fl_Value_Slider.H
index fc1590957..bf9ae1ef6 100644
--- a/FL/Fl_Value_Slider.H
+++ b/FL/Fl_Value_Slider.H
@@ -43,8 +43,9 @@ class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
-public:
+protected:
void draw();
+public:
int handle(int);
Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
/** Gets the typeface of the text in the value box. */
diff --git a/src/Fl_Value_Input.cxx b/src/Fl_Value_Input.cxx
index 1ac7a6958..60f204eb4 100644
--- a/src/Fl_Value_Input.cxx
+++ b/src/Fl_Value_Input.cxx
@@ -52,7 +52,7 @@ void Fl_Value_Input::draw() {
if (damage()&~FL_DAMAGE_CHILD) input.clear_damage(FL_DAMAGE_ALL);
input.box(box());
input.color(color(), selection_color());
- input.draw();
+ Fl_Widget *i = &input; i->draw(); // calls protected input.draw()
input.clear_damage();
}