1998-10-20 01:39:29 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// Window header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2009-01-01 19:11:32 +03:00
|
|
|
// Copyright 1998-2009 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-10-15 17:46:06 +04:00
|
|
|
/* \file
|
2008-09-16 11:26:22 +04:00
|
|
|
Fl_Window widget . */
|
|
|
|
|
1998-10-06 23:14:55 +04:00
|
|
|
#ifndef Fl_Window_H
|
|
|
|
#define Fl_Window_H
|
|
|
|
|
|
|
|
#include "Fl_Group.H"
|
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
#define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this
|
|
|
|
#define FL_DOUBLE_WINDOW 0xF1 ///< double window type id
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2001-05-11 22:37:08 +04:00
|
|
|
class Fl_X;
|
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
This widget produces an actual window. This can either be a main
|
|
|
|
window, with a border and title and all the window management controls,
|
2008-09-17 19:44:43 +04:00
|
|
|
or a "subwindow" inside a window. This is controlled by whether or not
|
2008-09-14 02:33:03 +04:00
|
|
|
the window has a parent().
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
Once you create a window, you usually add children Fl_Widget
|
|
|
|
's to it by using window->add(child) for each new widget.
|
|
|
|
See Fl_Group for more information on how to add and remove children.
|
|
|
|
|
|
|
|
There are several subclasses of Fl_Window that provide
|
|
|
|
double-buffering, overlay, menu, and OpenGL support.
|
|
|
|
|
|
|
|
The window's callback is done if the user tries to close a window
|
|
|
|
using the window manager and Fl::modal() is zero or equal to the
|
|
|
|
window. Fl_Window has a default callback that calls Fl_Window::hide().
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
class FL_EXPORT Fl_Window : public Fl_Group {
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2001-05-11 22:37:08 +04:00
|
|
|
friend class Fl_X;
|
|
|
|
Fl_X *i; // points at the system-specific stuff
|
1998-10-06 23:14:55 +04:00
|
|
|
|
|
|
|
const char* iconlabel_;
|
|
|
|
const char* xclass_;
|
1999-01-04 22:25:40 +03:00
|
|
|
const void* icon_;
|
1998-10-06 23:14:55 +04:00
|
|
|
// size_range stuff:
|
2008-04-23 19:07:13 +04:00
|
|
|
int minw, minh, maxw, maxh;
|
|
|
|
int dw, dh, aspect;
|
|
|
|
uchar size_range_set;
|
2002-08-01 06:15:43 +04:00
|
|
|
// cursor stuff
|
|
|
|
Fl_Cursor cursor_default;
|
|
|
|
Fl_Color cursor_fg, cursor_bg;
|
2002-08-14 20:19:48 +04:00
|
|
|
void size_range_();
|
|
|
|
void _Fl_Window(); // constructor innards
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2005-07-15 13:34:53 +04:00
|
|
|
// unimplemented copy ctor and assignment operator
|
|
|
|
Fl_Window(const Fl_Window&);
|
|
|
|
Fl_Window& operator=(const Fl_Window&);
|
|
|
|
|
1998-10-06 23:14:55 +04:00
|
|
|
protected:
|
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Stores the last window that was made current. See current() const */
|
2002-08-14 20:19:48 +04:00
|
|
|
static Fl_Window *current_;
|
|
|
|
virtual void draw();
|
2008-09-14 02:33:03 +04:00
|
|
|
/** Forces the window to be drawn, this window is also made current and calls draw(). */
|
2002-08-14 20:19:48 +04:00
|
|
|
virtual void flush();
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
/**
|
|
|
|
Sets an internal flag that tells FLTK and the window manager to
|
|
|
|
honor position requests.
|
|
|
|
|
|
|
|
This is used internally and should not be needed by user code.
|
|
|
|
|
|
|
|
\param[in] force 1 to set the FORCE_POSITION flag, 0 to clear it
|
|
|
|
*/
|
|
|
|
void force_position(int force) {
|
|
|
|
if (force) set_flag(FORCE_POSITION);
|
|
|
|
else clear_flag(FORCE_POSITION);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
Returns the internal state of the window's FORCE_POSITION flag.
|
|
|
|
|
|
|
|
\retval 1 if flag is set
|
|
|
|
\retval 0 otherwise
|
|
|
|
|
|
|
|
\see force_position(int)
|
|
|
|
*/
|
|
|
|
int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
|
|
|
|
|
1998-10-06 23:14:55 +04:00
|
|
|
public:
|
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Creates a window from the given size and title.
|
|
|
|
If Fl_Group::current() is not NULL, the window is created as a
|
2009-12-24 14:40:26 +03:00
|
|
|
subwindow of the parent window.
|
2008-09-14 02:33:03 +04:00
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
The first form of the constructor creates a top-level window
|
2008-09-14 02:33:03 +04:00
|
|
|
and asks the window manager to position the window. The second
|
|
|
|
form of the constructor either creates a subwindow or a
|
|
|
|
top-level window at the specified location (x,y) , subject to window
|
|
|
|
manager configuration. If you do not specify the position of the
|
|
|
|
window, the window manager will pick a place to show the window
|
|
|
|
or allow the user to pick a location. Use position(x,y)
|
|
|
|
or hotspot() before calling show() to request a
|
|
|
|
position on the screen. See Fl_Window::resize()
|
2009-12-24 14:40:26 +03:00
|
|
|
for some more details on positioning windows.
|
2008-09-14 02:33:03 +04:00
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
Top-level windows initially have visible() set to 0
|
2008-09-14 02:33:03 +04:00
|
|
|
and parent() set to NULL. Subwindows initially
|
|
|
|
have visible() set to 1 and parent() set to
|
2009-12-24 14:40:26 +03:00
|
|
|
the parent window pointer.
|
2008-09-14 02:33:03 +04:00
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
Fl_Widget::box() defaults to FL_FLAT_BOX. If you plan to
|
|
|
|
completely fill the window with children widgets you should
|
2008-09-14 02:33:03 +04:00
|
|
|
change this to FL_NO_BOX. If you turn the window border off
|
|
|
|
you may want to change this to FL_UP_BOX.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
\see Fl_Window(int x, int y, int w, int h, const char* title = 0)
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
|
|
|
Fl_Window(int w, int h, const char* title= 0);
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Creates a window from the given position, size and title.
|
|
|
|
|
|
|
|
\see Fl_Window::Fl_Window(int w, int h, const char *title = 0)
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
|
|
|
Fl_Window(int x, int y, int w, int h, const char* title = 0);
|
|
|
|
/**
|
|
|
|
The destructor <I>also deletes all the children</I>. This allows a
|
|
|
|
whole tree to be deleted at once, without having to keep a pointer to
|
|
|
|
all the children in the user code. A kludge has been done so the
|
2009-12-24 14:40:26 +03:00
|
|
|
Fl_Window and all of its children can be automatic (local)
|
2008-09-14 02:33:03 +04:00
|
|
|
variables, but you must declare the Fl_Window <I>first</I> so
|
|
|
|
that it is destroyed last.
|
|
|
|
*/
|
|
|
|
virtual ~Fl_Window();
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2002-07-15 01:25:39 +04:00
|
|
|
virtual int handle(int);
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Changes the size and position of the window. If shown() is true,
|
|
|
|
these changes are communicated to the window server (which may
|
2008-09-14 02:33:03 +04:00
|
|
|
refuse that size and cause a further resize). If shown() is
|
|
|
|
false, the size and position are used when show() is called.
|
2009-12-24 14:40:26 +03:00
|
|
|
See Fl_Group for the effect of resizing on the child widgets.
|
|
|
|
|
|
|
|
You can also call the Fl_Widget methods size(x,y) and position(w,h),
|
|
|
|
which are inline wrappers for this virtual function.
|
|
|
|
|
|
|
|
A top-level window can not force, but merely suggest a position and
|
2008-09-14 02:33:03 +04:00
|
|
|
size to the operating system. The window manager may not be willing or
|
|
|
|
able to display a window at the desired position or with the given
|
|
|
|
dimensions. It is up to the application developer to verify window
|
|
|
|
parameters after the resize request.
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
virtual void resize(int,int,int,int);
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Sets whether or not the window manager border is around the
|
|
|
|
window. The default value is true. void border(int) can be
|
|
|
|
used to turn the border on and off. <I>Under most X window
|
|
|
|
managers this does not work after show() has been called,
|
|
|
|
although SGI's 4DWM does work.</I>
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void border(int b);
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Fast inline function to turn the window manager border
|
2008-09-14 02:33:03 +04:00
|
|
|
off. It only works before show() is called.
|
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void clear_border() {set_flag(NOBORDER);}
|
2009-12-24 14:40:26 +03:00
|
|
|
/** See void Fl_Window::border(int) */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int border() const {return !(flags() & NOBORDER);}
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Activates the flags NOBORDER|FL_OVERRIDE */
|
2009-09-27 16:06:35 +04:00
|
|
|
void set_override() {set_flag(NOBORDER|OVERRIDE);}
|
2008-09-14 02:33:03 +04:00
|
|
|
/** Returns non zero if FL_OVERRIDE flag is set, 0 otherwise. */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int override() const { return flags()&OVERRIDE; }
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2008-09-17 19:44:43 +04:00
|
|
|
A "modal" window, when shown(), will prevent any events from
|
2008-09-14 02:33:03 +04:00
|
|
|
being delivered to other windows in the same program, and will also
|
|
|
|
remain on top of the other windows (if the X window manager supports
|
2008-09-17 19:44:43 +04:00
|
|
|
the "transient for" property). Several modal windows may be shown at
|
2009-08-03 10:26:32 +04:00
|
|
|
once, in which case only the last one shown gets events. You can see
|
2009-12-24 14:40:26 +03:00
|
|
|
which window (if any) is modal by calling Fl::modal().
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void set_modal() {set_flag(MODAL);}
|
2008-09-18 23:09:34 +04:00
|
|
|
/** Returns true if this window is modal. */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int modal() const {return flags() & MODAL;}
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2008-09-17 19:44:43 +04:00
|
|
|
A "non-modal" window (terminology borrowed from Microsoft Windows)
|
2008-09-14 02:33:03 +04:00
|
|
|
acts like a modal() one in that it remains on top, but it has
|
|
|
|
no effect on event delivery. There are <I>three</I> states for a
|
|
|
|
window: modal, non-modal, and normal.
|
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void set_non_modal() {set_flag(NON_MODAL);}
|
2008-09-18 23:09:34 +04:00
|
|
|
/** Returns true if this window is modal or non-modal. */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2009-08-03 10:26:32 +04:00
|
|
|
/**
|
|
|
|
Marks the window as a menu window.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2009-08-03 10:26:32 +04:00
|
|
|
This is intended for internal use, but it can also be used if you
|
|
|
|
write your own menu handling. However, this is not recommended.
|
|
|
|
|
|
|
|
This flag is used for correct "parenting" of windows in communication
|
|
|
|
with the windowing system. Modern X window managers can use different
|
|
|
|
flags to distinguish menu and tooltip windows from normal windows.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2009-08-03 10:26:32 +04:00
|
|
|
This must be called before the window is shown and cannot be changed
|
|
|
|
later.
|
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void set_menu_window() {set_flag(MENU_WINDOW);}
|
2009-08-03 10:26:32 +04:00
|
|
|
|
|
|
|
/** Returns true if this window is a menu window. */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int menu_window() const {return flags() & MENU_WINDOW;}
|
2009-08-03 10:26:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Marks the window as a tooltip window.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2009-08-03 10:26:32 +04:00
|
|
|
This is intended for internal use, but it can also be used if you
|
|
|
|
write your own tooltip handling. However, this is not recommended.
|
|
|
|
|
|
|
|
This flag is used for correct "parenting" of windows in communication
|
|
|
|
with the windowing system. Modern X window managers can use different
|
|
|
|
flags to distinguish menu and tooltip windows from normal windows.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2009-08-03 10:26:32 +04:00
|
|
|
This must be called before the window is shown and cannot be changed
|
|
|
|
later.
|
|
|
|
|
|
|
|
\note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this
|
|
|
|
also \b clears the menu_window() state.
|
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void set_tooltip_window() { set_flag(TOOLTIP_WINDOW);
|
|
|
|
clear_flag(MENU_WINDOW); }
|
2009-08-03 10:26:32 +04:00
|
|
|
/** Returns true if this window is a tooltip window. */
|
2009-09-28 18:34:52 +04:00
|
|
|
unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
|
2009-08-03 10:26:32 +04:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Positions the window so that the mouse is pointing at the given
|
|
|
|
position, or at the center of the given widget, which may be the
|
2008-09-14 02:33:03 +04:00
|
|
|
window itself. If the optional offscreen parameter is
|
|
|
|
non-zero, then the window is allowed to extend off the screen (this
|
|
|
|
does not work with some X window managers). \see position()
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void hotspot(int x, int y, int offscreen = 0);
|
2008-09-18 23:09:34 +04:00
|
|
|
/** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
|
2002-07-15 01:25:39 +04:00
|
|
|
void hotspot(const Fl_Widget*, int offscreen = 0);
|
2008-09-18 23:09:34 +04:00
|
|
|
/** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
|
1998-10-06 23:14:55 +04:00
|
|
|
void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Undoes the effect of a previous resize() or show() so that the next time
|
|
|
|
show() is called the window manager is free to position the window.
|
|
|
|
|
|
|
|
This is for Forms compatibility only.
|
|
|
|
|
|
|
|
\deprecated please use force_position(0) instead
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2009-09-27 16:06:35 +04:00
|
|
|
void free_position() {clear_flag(FORCE_POSITION);}
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Sets the allowable range the user can resize this window to.
|
|
|
|
This only works for top-level windows.
|
2008-09-14 02:33:03 +04:00
|
|
|
<UL>
|
2009-12-24 14:40:26 +03:00
|
|
|
<LI>minw and minh are the smallest the window can be.
|
|
|
|
Either value must be greater than 0.</LI>
|
|
|
|
<LI>maxw and maxh are the largest the window can be. If either is
|
|
|
|
<I>equal</I> to the minimum then you cannot resize in that direction.
|
|
|
|
If either is zero then FLTK picks a maximum size in that direction
|
|
|
|
such that the window will fill the screen.</LI>
|
|
|
|
<LI>dw and dh are size increments. The window will be constrained
|
|
|
|
to widths of minw + N * dw, where N is any non-negative integer.
|
|
|
|
If these are less or equal to 1 they are ignored (this is ignored
|
|
|
|
on WIN32).</LI>
|
|
|
|
<LI>aspect is a flag that indicates that the window should preserve its
|
|
|
|
aspect ratio. This only works if both the maximum and minimum have
|
|
|
|
the same aspect ratio (ignored on WIN32 and by many X window managers).
|
|
|
|
</LI>
|
2008-09-14 02:33:03 +04:00
|
|
|
</UL>
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
If this function is not called, FLTK tries to figure out the range
|
|
|
|
from the setting of resizable():
|
|
|
|
<UL>
|
2009-12-24 14:40:26 +03:00
|
|
|
<LI>If resizable() is NULL (this is the default) then the window cannot
|
|
|
|
be resized and the resize border and max-size control will not be
|
|
|
|
displayed for the window.</LI>
|
|
|
|
<LI>If either dimension of resizable() is less than 100, then that is
|
|
|
|
considered the minimum size. Otherwise the resizable() has a minimum
|
|
|
|
size of 100.</LI>
|
|
|
|
<LI>If either dimension of resizable() is zero, then that is also the
|
|
|
|
maximum size (so the window cannot resize in that direction).</LI>
|
2008-09-14 02:33:03 +04:00
|
|
|
</UL>
|
2009-12-24 14:40:26 +03:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
It is undefined what happens if the current size does not fit in the
|
|
|
|
constraints passed to size_range().
|
|
|
|
*/
|
1998-10-06 23:14:55 +04:00
|
|
|
void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
|
2008-04-23 19:07:13 +04:00
|
|
|
minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
/** See void Fl_Window::label(const char*) */
|
1998-10-06 23:14:55 +04:00
|
|
|
const char* label() const {return Fl_Widget::label();}
|
2008-09-18 23:09:34 +04:00
|
|
|
/** See void Fl_Window::iconlabel(const char*) */
|
1998-10-06 23:14:55 +04:00
|
|
|
const char* iconlabel() const {return iconlabel_;}
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Sets the window title bar label. */
|
2002-07-15 01:25:39 +04:00
|
|
|
void label(const char*);
|
2008-09-18 23:09:34 +04:00
|
|
|
/** Sets the icon label. */
|
2002-07-15 01:25:39 +04:00
|
|
|
void iconlabel(const char*);
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Sets the icon label. */
|
2008-09-18 23:09:34 +04:00
|
|
|
void label(const char* label, const char* iconlabel); // platform dependent
|
2005-04-09 17:51:32 +04:00
|
|
|
void copy_label(const char* a);
|
2008-09-18 23:09:34 +04:00
|
|
|
/** See void Fl_Window::xclass(const char*) */
|
1998-10-06 23:14:55 +04:00
|
|
|
const char* xclass() const {return xclass_;}
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
A string used to tell the system what type of window this is. Mostly
|
|
|
|
this identifies the picture to draw in the icon. <I>Under X, this is
|
|
|
|
turned into a XA_WM_CLASS pair by truncating at the first
|
|
|
|
non-alphanumeric character and capitalizing the first character, and
|
2008-09-17 19:44:43 +04:00
|
|
|
the second one if the first is 'x'. Thus "foo" turns into "foo, Foo",
|
|
|
|
and "xprog.1" turns into "xprog, XProg".</I> This only works if called <I>
|
2008-09-14 02:33:03 +04:00
|
|
|
before</I> calling show().
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
Under Microsoft Windows this string is used as the name of the
|
2008-09-14 02:33:03 +04:00
|
|
|
WNDCLASS structure, though it is not clear if this can have any
|
|
|
|
visible effect. The passed pointer is stored unchanged. The string
|
|
|
|
is not copied.
|
|
|
|
*/
|
1998-10-06 23:14:55 +04:00
|
|
|
void xclass(const char* c) {xclass_ = c;}
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Gets the current icon window target dependent data. */
|
1999-01-04 22:25:40 +03:00
|
|
|
const void* icon() const {return icon_;}
|
2009-12-24 14:40:26 +03:00
|
|
|
/** Sets the current icon window target dependent data. */
|
1999-02-18 16:12:50 +03:00
|
|
|
void icon(const void * ic) {icon_ = ic;}
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Returns non-zero if show() has been called (but not hide()
|
2009-12-24 14:40:26 +03:00
|
|
|
). You can tell if a window is iconified with (w->shown()
|
|
|
|
&& !w->visible()).
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
1998-10-06 23:14:55 +04:00
|
|
|
int shown() {return i != 0;}
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Puts the window on the screen. Usually (on X) this has the side
|
|
|
|
effect of opening the display. The second form is used for top-level
|
|
|
|
windows and allows standard arguments to be parsed from the
|
2008-09-14 02:33:03 +04:00
|
|
|
command-line.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
If the window is already shown then it is restored and raised to the
|
2008-09-14 02:33:03 +04:00
|
|
|
top. This is really convenient because your program can call show()
|
|
|
|
at any time, even if the window is already up. It also means that
|
|
|
|
show() serves the purpose of raise() in other toolkits.
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
virtual void show();
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Removes the window from the screen. If the window is already hidden or
|
2008-09-14 02:33:03 +04:00
|
|
|
has not been shown then this does nothing and is harmless.
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
virtual void hide();
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
See virtual void Fl_Window::show()
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void show(int, char**);
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Makes the window completely fill the screen, without any window
|
|
|
|
manager border visible. You must use fullscreen_off() to undo
|
|
|
|
this. This may not work with all window managers.
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void fullscreen();
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Turns off any side effects of fullscreen() and does
|
|
|
|
resize(x,y,w,h).
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void fullscreen_off(int,int,int,int);
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Iconifies the window. If you call this when shown() is false
|
|
|
|
it will show() it as an icon. If the window is already
|
|
|
|
iconified this does nothing.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
Call show() to restore the window.
|
|
|
|
|
|
|
|
When a window is iconified/restored (either by these calls or by the
|
2008-09-14 02:33:03 +04:00
|
|
|
user) the handle() method is called with FL_HIDE and
|
2009-12-24 14:40:26 +03:00
|
|
|
FL_SHOW events and visible() is turned on and off.
|
|
|
|
|
|
|
|
There is no way to control what is drawn in the icon except with the
|
2008-09-14 02:33:03 +04:00
|
|
|
string passed to Fl_Window::xclass(). You should not rely on
|
|
|
|
window managers displaying the icons.
|
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void iconize();
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2002-07-15 01:25:39 +04:00
|
|
|
int x_root() const ;
|
|
|
|
int y_root() const ;
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2008-09-18 23:09:34 +04:00
|
|
|
static Fl_Window *current();
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
2009-12-24 14:40:26 +03:00
|
|
|
Sets things up so that the drawing functions in <FL/fl_draw.H> will go
|
|
|
|
into this window. This is useful for incremental update of windows, such
|
|
|
|
as in an idle callback, which will make your program behave much better
|
|
|
|
if it draws a slow graphic. <B>Danger: incremental update is very hard to
|
2008-09-14 02:33:03 +04:00
|
|
|
debug and maintain!</B>
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
This method only works for the Fl_Window and Fl_Gl_Window derived classes.
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2002-07-15 01:25:39 +04:00
|
|
|
void make_current();
|
1998-10-06 23:14:55 +04:00
|
|
|
|
2010-02-13 15:25:58 +03:00
|
|
|
/** Returns an Fl_Window pointer if this widget is an Fl_Window.
|
|
|
|
|
|
|
|
\retval NULL if this widget is not derived from Fl_Window.
|
|
|
|
\note This method is provided to avoid dynamic_cast.
|
|
|
|
\todo More documentation ...
|
|
|
|
*/
|
2010-03-17 01:51:31 +03:00
|
|
|
virtual Fl_Window* as_window() { return this; }
|
2010-02-13 15:25:58 +03:00
|
|
|
|
2008-09-15 21:46:42 +04:00
|
|
|
// for back-compatibility only:
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Changes the cursor for this window. This always calls the system, if
|
|
|
|
you are changing the cursor a lot you may want to keep track of how
|
2009-12-24 14:40:26 +03:00
|
|
|
you set it in a static variable and call this only if the new cursor
|
|
|
|
is different.
|
2008-09-18 23:09:34 +04:00
|
|
|
|
2009-12-24 14:40:26 +03:00
|
|
|
The type Fl_Cursor is an enumeration defined in <FL/Enumerations.H>.
|
2008-09-14 02:33:03 +04:00
|
|
|
(Under X you can get any XC_cursor value by passing
|
|
|
|
Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are
|
|
|
|
not implemented on WIN32.
|
2009-12-24 14:40:26 +03:00
|
|
|
|
|
|
|
For back compatibility only.
|
2008-09-14 02:33:03 +04:00
|
|
|
*/
|
2008-09-18 23:09:34 +04:00
|
|
|
void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
|
2002-08-01 06:15:43 +04:00
|
|
|
void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
|
2002-07-15 01:25:39 +04:00
|
|
|
static void default_callback(Fl_Window*, void* v);
|
1998-10-06 23:14:55 +04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|