source: rtems-graphics-toolkit/fltk-1.1.10/documentation/Fl_Window.html @ 513eea1

Last change on this file since 513eea1 was 513eea1, checked in by Joel Sherrill <joel.sherrill@…>, on 01/09/10 at 22:43:24

2010-01-08 Joel Sherrill <joel.sherrill@…>

fltk 1.1.10. imported

  • ORIGIN: Updated.
  • Property mode set to 100644
File size: 14.8 KB
Line 
1<HTML>
2<HEAD>
3        <TITLE>Fl_Window</TITLE>
4</HEAD>
5<BODY>
6<!-- NEW PAGE -->
7<H2><A name=Fl_Window>class Fl_Window</A></H2>
8<HR>
9<H3>Class Hierarchy</H3>
10<UL>
11<PRE>
12<A href=Fl_Group.html#Fl_Group>Fl_Group</A>
13   |
14   +----<B>Fl_Window</B>
15           |
16           +----<A href=Fl_Double_Window.html#Fl_Double_Window>Fl_Double_Window</A>, <A href=Fl_Gl_Window.html#Fl_Gl_Window>Fl_Gl_Window</A>,
17                <A href=Fl_Overlay_Window.html#Fl_Overlay_Window>Fl_Overlay_Window</A>, <A href=Fl_Single_Window.html#Fl_Single_Window>Fl_Single_Window</A>
18</PRE>
19</UL>
20<H3>Include Files</H3>
21<UL>
22<PRE>
23#include &lt;FL/Fl_Window.H&gt;
24</PRE>
25</UL>
26<H3>Description</H3>
27 This widget produces an actual window.  This can either be a main
28window, with a border and title and all the window management controls,
29or a &quot;subwindow&quot; inside a window.  This is controlled by whether or not
30the window has a <TT>parent()</TT>.
31<P>Once you create a window, you usually add children <TT>Fl_Widget</TT>
32's to it by using <TT>window-&gt;add(child)</TT> for each new widget.  See <A
33href=Fl_Group.html#Fl_Group><TT>Fl_Group</TT></A> for more information
34on how to add and remove children. </P>
35<P>There are several subclasses of <TT>Fl_Window</TT> that provide
36double-buffering, overlay, menu, and OpenGL support. </P>
37<P>The window's callback is done if the user tries to close a window
38using the window manager and <A href="Fl.html#Fl.modal"><TT>
39Fl::modal()</TT></A> is zero or equal to the window. <TT>Fl_Window</TT>
40 has a default callback that calls <TT>Fl_Window::hide()</TT>. </P>
41<H3>Methods</H3>
42<CENTER>
43<TABLE width=90% summary="Fl_Window methods.">
44<TR><TD align=left valign=top>
45<UL>
46<LI><A href=#Fl_Window.Fl_Window>Fl_Window</A></LI>
47<LI><A href=#Fl_Window.~Fl_Window>~Fl_Window</A></LI>
48<LI><A href=#Fl_Window.border>border</A></LI>
49<LI><A href=#Fl_Window.clear_border>clear_border</A></LI>
50<LI><A href=#Fl_Window.current>current</A></LI>
51<LI><A href=#Fl_Window.cursor>cursor</A></LI>
52</UL>
53</TD><TD align=left valign=top>
54<UL>
55<LI><A href=#Fl_Window.free_position>free_position</A></LI>
56<LI><A href=#Fl_Window.fullscreen>fullscreen</A></LI>
57<LI><A href=#Fl_Window.fullscreen_off>fullscreen_off</A></LI>
58<LI><A href=#Fl_Window.hide>hide</A></LI>
59<LI><A href=#Fl_Window.hotspot>hotspot</A></LI>
60</UL>
61</TD><TD align=left valign=top>
62<UL>
63<LI><A href=#Fl_Window.iconize>iconize</A></LI>
64<LI><A href=#Fl_Window.iconlabel>iconlabel</A></LI>
65<LI><A href=#Fl_Window.label>label</A></LI>
66<LI><A href=#Fl_Window.make_current>make_current</A></LI>
67<LI><A href=#Fl_Window.modal>modal</A></LI>
68</UL>
69</TD><TD align=left valign=top>
70<UL>
71<LI><A href=#Fl_Window.non_modal>non_modal</A></LI>
72<LI><A href=#Fl_Window.resize>resize</A></LI>
73<LI><A href=#Fl_Window.set_modal>set_modal</A></LI>
74<LI><A href=#Fl_Window.set_non_modal>set_non_modal</A></LI>
75<LI><A href=#Fl_Window.show>show</A></LI>
76</UL>
77</TD><TD align=left valign=top>
78<UL>
79<LI><A href=#Fl_Window.shown>shown</A></LI>
80<LI><A href=#Fl_Window.size_range>size_range</A></LI>
81<LI><A href=#Fl_Window.xclass>xclass</A></LI>
82</UL>
83</TD></TR>
84</TABLE>
85</CENTER>
86<H4><A name=Fl_Window.Fl_Window>Fl_Window::Fl_Window(int w, int h, const char *title = 0)<br>
87Fl_Window::Fl_Window(int x, int y, int w, int h, const char *title = 0)</A></H4>
88
89<p>Creates a new window. If <a
90href='Fl_Group.html#Fl_Group.current'><tt>Fl_Group::current()</tt></a>
91is not <tt>NULL</tt>, the window is created as a subwindow of
92the parent window.</p>
93
94<p>The first form of the constructor creates a top-level window
95and asks the window manager to position the window. The second
96form of the constructor either creates a subwindow or a
97top-level window at the specified location, subject to window
98manager configuration. If you do not specify the position of the
99window, the window manager will pick a place to show the window
100or allow the user to pick a location. Use <tt>position(x,y)</tt>
101or <tt>hotspot()</tt> before calling <tt>show()</tt> to request a
102position on the screen. See <TT><A href="#Fl_Window.resize">
103Fl_Window::resize()</A></TT> for some more details on positioning
104windows.</p>
105
106<p>Top-level windows initially have <tt>visible()</tt> set to 0
107and <tt>parent()</tt> set to <tt>NULL</tt>. Subwindows initially
108have <tt>visible()</tt> set to 1 and <tt>parent()</tt> set to
109the parent window pointer.</p>
110
111<P><TT>Fl_Widget::box()</TT> defaults to <TT>FL_FLAT_BOX</TT>. If you
112plan to completely fill the window with children widgets you should
113change this to <TT>FL_NO_BOX</TT>. If you turn the window border off
114you may want to change this to <TT>FL_UP_BOX</TT>.</P>
115
116<H4><A name=Fl_Window.~Fl_Window>virtual Fl_Window::~Fl_Window()</A></H4>
117 The destructor <I>also deletes all the children</I>. This allows a
118whole tree to be deleted at once, without having to keep a pointer to
119all the children in the user code. A kludge has been done so the <TT>
120Fl_Window</TT> and all of its children can be automatic (local)
121variables, but you must declare the <TT>Fl_Window</TT> <I>first</I> so
122that it is destroyed last.
123<H4><A name=Fl_Window.size_range>void Fl_Window::size_range(int minw,
124int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0)</A></H4>
125 Set the allowable range the user can resize this window to.  This only
126works for top-level windows.
127<UL>
128<LI><TT>minw</TT> and <TT>minh</TT> are the smallest the window  can
129be. Either value must be greater than 0.</LI>
130<LI><TT>maxw</TT> and <TT>maxh</TT> are the largest the window  can be.
131 If either is <I>equal</I> to the minimum then you  cannot resize in
132that direction.  If either is zero  then FLTK picks a maximum size in
133that direction such that the  window will fill the screen. </LI>
134<LI><TT>dw</TT> and <TT>dh</TT> are size increments.  The  window will
135be constrained to widths of <TT>minw + N * dw</TT>,  where <TT>N</TT>
136 is any non-negative integer.  If these are  less or equal to 1 they
137are ignored.  (this is ignored on WIN32)</LI>
138<LI><TT>aspect</TT> is a flag that indicates that the window should
139 preserve its aspect ratio.  This only works if both the maximum and
140 minimum have the same aspect ratio.  (ignored on WIN32 and by many X
141 window managers)</LI>
142</UL>
143 If this function is not called, FLTK tries to figure out the range
144from the setting of <A href="Fl_Group.html#Fl_Group.resizable"><TT>resizable()</TT></A>:
145<UL>
146<LI>If <TT>resizable()</TT> is <TT>NULL</TT> (this is the  default)
147then the window cannot be resized and the resize  border and max-size
148control will not be displayed for the  window. </LI>
149<LI>If either dimension of <TT>resizable()</TT> is less than  100,
150then that is considered the minimum size.  Otherwise the <TT>
151resizable()</TT> has a minimum size of 100. </LI>
152<LI>If either dimension of <TT>resizable()</TT> is zero, then  that is
153also the maximum size (so the window cannot resize in  that direction). </LI>
154</UL>
155 It is undefined what happens if the current size does not fit in the
156constraints passed to <TT>size_range()</TT>.
157<H4><A name=Fl_Window.show>virtual void Fl_Window::show()
158<BR> void Fl_Window::show(int argc, char **argv)</A></H4>
159Put the window on the screen.  Usually this has the side effect of
160opening the display. The second form is used for top-level
161windows and allows standard arguments to be parsed from the
162command-line.
163<P>If the window is already shown then it is restored and raised to the
164top.  This is really convenient because your program can call <TT>show()</TT>
165 at any time, even if the window is already up.  It also means that <TT>
166show()</TT> serves the purpose of <TT>raise()</TT> in other toolkits. </P>
167<H4><A name=Fl_Window.hide>virtual void Fl_Window::hide()</A></H4>
168 Remove the window from the screen.  If the window is already hidden or
169has not been shown then this does nothing and is harmless.
170<H4><A name=Fl_Window.shown>int Fl_Window::shown() const</A></H4>
171 Returns non-zero if <TT>show()</TT> has been called (but not <TT>hide()</TT>
172). You can tell if a window is iconified with <TT>(w-&gt;shown()
173&amp;&amp; !w-&gt;visible())</TT>.
174<H4><A name=Fl_Window.iconize>void Fl_Window::iconize()</A></H4>
175 Iconifies the window.  If you call this when <TT>shown()</TT> is false
176it will <TT>show()</TT> it as an icon.  If the window is already
177iconified this does nothing.
178<P>Call <TT>show()</TT> to restore the window. </P>
179<P>When a window is iconified/restored (either by these calls or by the
180user) the <TT>handle()</TT> method is called with <TT>FL_HIDE</TT> and <TT>
181FL_SHOW</TT> events and <TT>visible()</TT> is turned on and off. </P>
182<P>There is no way to control what is drawn in the icon except with the
183string passed to <TT>Fl_Window::xclass()</TT>.  You should not rely on
184window managers displaying the icons. </P>
185<H4><A name=Fl_Window.resize>void Fl_Window::resize(int,int,int,int)</A></H4>
186 Change the size and position of the window.  If <TT>shown()</TT> is
187true, these changes are communicated to the window server (which may
188refuse that size and cause a further resize).  If <TT>shown()</TT> is
189false, the size and position are used when <TT>show()</TT> is called.
190See <A href=Fl_Group.html#Fl_Group><TT>Fl_Group</TT></A> for the effect
191of resizing on the child widgets.
192<P>You can also call the <TT>Fl_Widget</TT> methods <TT>size(x,y)</TT>
193 and <TT>position(w,h)</TT>, which are inline wrappers for this virtual
194function. </P>
195<P>A top-level window can not force, but merely suggest a position and
196size to the operating system. The window manager may not be willing or
197able to display a window at the desired position or with the given
198dimensions. It is up to the application developer to verify window
199parameters after the <tt>resize</tt> request.
200<H4><A name=Fl_Window.free_position>void Fl_Window::free_position()</A></H4>
201 Undoes the effect of a previous <TT>resize()</TT> or <TT>show()</TT>
202 so that the next time <TT>show()</TT> is called the window manager is
203free to position the window.
204<H4><A name=Fl_Window.hotspot>void Fl_Window::hotspot(int x, int y, int
205offscreen = 0)
206<BR> void Fl_Window::hotspot(const Fl_Widget*, int offscreen = 0)
207<BR> void Fl_Window::hotspot(const Fl_Widget&amp;, int offscreen = 0)</A></H4>
208<TT>position()</TT> the window so that the mouse is pointing at the
209given position, or at the center of the given widget, which may be the
210window itself.  If the optional <TT>offscreen</TT> parameter is
211non-zero, then the window is allowed to extend off the screen (this
212does not work with some X window managers).
213<H4><A name=Fl_Window.fullscreen>void Fl_Window::fullscreen()</A></H4>
214 Makes the window completely fill the screen, without any window
215manager border visible.  You must use <TT>fullscreen_off()</TT> to undo
216this. This may not work with all window managers.
217<H4><A name=Fl_Window.fullscreen_off>int Fl_Window::fullscreen_off(int
218x, int y, int w, int h)</A></H4>
219 Turns off any side effects of <TT>fullscreen()</TT> and does <TT>
220resize(x,y,w,h)</TT>.
221<H4><A name=Fl_Window.border>int Fl_Window::border(int)
222<BR> uchar Fl_Window::border() const</A></H4>
223 Gets or sets whether or not the window manager border is around the
224window.  The default value is true. <TT>border(n)</TT> can be used to
225turn the border on and off, and returns non-zero if the value has been
226changed. <I>Under most X window managers this does not work after <TT>
227show()</TT> has been called, although SGI's 4DWM does work.</I>
228<H4><A name=Fl_Window.clear_border>void Fl_Window::clear_border()</A></H4>
229<TT>clear_border()</TT> is a fast inline function to turn the border
230off. It only works before <TT>show()</TT> is called.
231<H4><A name=Fl_Window.set_modal>void Fl_Window::set_modal()</A></H4>
232 A &quot;modal&quot; window, when <TT>shown()</TT>, will prevent any events from
233being delivered to other windows in the same program, and will also
234remain on top of the other windows (if the X window manager supports
235the &quot;transient for&quot; property).  Several modal windows may be shown at
236once, in which case only the last one shown gets events.  You can see
237which window (if any) is modal by calling <A href="Fl.html#Fl.modal"><TT>
238Fl::modal()</TT></A>.
239<H4><A name=Fl_Window.modal>uchar Fl_Window::modal() const</A></H4>
240 Returns true if this window is modal.
241<H4><A name=Fl_Window.set_non_modal>void Fl_Window::set_non_modal()</A></H4>
242 A &quot;non-modal&quot; window (terminology borrowed from Microsoft Windows)
243acts like a <TT>modal()</TT> one in that it remains on top, but it has
244no effect on event delivery.  There are <I>three</I> states for a
245window: modal, non-modal, and normal.
246<H4><A name=Fl_Window.non_modal>uchar Fl_Window::non_modal() const</A></H4>
247 Returns true if this window is modal or non-modal.
248<H4><A name=Fl_Window.label>void Fl_Window::label(const char*)
249<BR> const char* Fl_Window::label() const</A></H4>
250 Gets or sets the window title bar label.
251<H4><A name=Fl_Window.iconlabel>void Fl_Window::iconlabel(const char*)
252<BR> const char* Fl_Window::iconlabel() const</A></H4>
253 Gets or sets the icon label.
254<H4><A name=Fl_Window.xclass>void Fl_Window::xclass(const char*)
255<BR> const char* Fl_Window::xclass() const</A></H4>
256 A string used to tell the system what type of window this is. Mostly
257this identifies the picture to draw in the icon. <I>Under X, this is
258turned into a <TT>XA_WM_CLASS</TT> pair by truncating at the first
259non-alphanumeric character and capitalizing the first character, and
260the second one if the first is 'x'.  Thus &quot;foo&quot; turns into &quot;foo, Foo&quot;,
261and &quot;xprog.1&quot; turns into &quot;xprog, XProg&quot;.</I> This only works if called <I>
262before</I> calling <TT>show()</TT>.
263<P>Under Microsoft Windows this string is used as the name of the
264WNDCLASS structure, though it is not clear if this can have any
265visible effect. The passed pointer is stored unchanged. The string
266is not copied.</P>
267<H4><A name=Fl_Window.make_current>void Fl_Window::make_current()</A></H4>
268<TT>make_current()</TT> sets things up so that the drawing functions in <A
269href=drawing.html#drawing><TT>&lt;FL/fl_draw.H&gt;</TT></A> will go into this
270window. This is useful for incremental update of windows, such as in an
271idle callback, which will make your program behave much better if it
272draws a slow graphic. <B>Danger: incremental update is very hard to
273debug and maintain!</B>
274<P>This method only works for the <TT>Fl_Window</TT> and <TT>
275Fl_Gl_Window</TT> classes. </P>
276<H4><A name=Fl_Window.current>static Fl_Window* Fl_Window::current()</A></H4>
277 Returns the last window that was made current.
278<H4><A name=Fl_Window.cursor>void Fl_Window::cursor(Fl_Cursor, Fl_Color = FL_WHITE, Fl_Color = FL_BLACK)</A></H4>
279Change the cursor for this window.  This always calls the system, if
280you are changing the cursor a lot you may want to keep track of how
281you set it in a static variable and call this only if the new cursor
282is different.
283
284<P>The type <TT>Fl_Cursor</TT> is an enumeration defined in <A
285href=enumerations.html#cursor> <TT>&lt;FL/Enumerations.H&gt;</TT></A>.
286(Under X you can get any XC_cursor value by passing <TT>
287Fl_Cursor((XC_foo/2)+1)</TT>).  The colors only work on X, they are
288not implemented on WIN32.
289
290</BODY></HTML>
Note: See TracBrowser for help on using the repository browser.