mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Move documentation. Fix _inactive count bug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18282 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
75d4c1baa5
commit
1de7b7edf8
7 changed files with 604 additions and 1220 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2003-12-29 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSApplication.m (-activateIgnoringOtherApps:): Change
|
||||
location of _inactive count calculation.
|
||||
|
||||
* Documentation/gnustep-gui.texi: Move class documentation...
|
||||
* Headers/Additions/GNUstepGUI/GSHbox.h: ...to here.
|
||||
* Headers/Additions/GNUstepGUI/GSTable.h: and here.
|
||||
* Headers/Additions/GNUstepGUI/GSVbox.h: and here.
|
||||
|
||||
2003-12-28 19:33 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Headers/AppKit/NSMenuItem.h: Added documentation for many
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,15 +31,139 @@
|
|||
|
||||
#include "GSTable.h"
|
||||
|
||||
//
|
||||
// GSHbox inherits from GSTable the autosizing/autoresizing engine.
|
||||
// The only real difference between a GSHbox and a GSTable with 1 row
|
||||
// is that the GSHbox has a much simpler, easier and friendlier API.
|
||||
//
|
||||
// You shouldn't use GSTable methods with GSHbox (exception: methods
|
||||
// explicitly quoted in comments to this file as 'inherited from GSTable').
|
||||
// If you need to do that, you should be using GSTable instead.
|
||||
//
|
||||
/**
|
||||
<unit>
|
||||
<heading>GSHbox</heading>
|
||||
|
||||
<p>
|
||||
GSHbox inherits from GSTable the autosizing/autoresizing engine.
|
||||
The only real difference between a GSHbox and a GSTable with 1 row
|
||||
is that the GSHbox has a much simpler, easier and friendlier API.
|
||||
</p>
|
||||
<p>
|
||||
You shouldn't use GSTable methods with GSHbox (exception: methods
|
||||
explicitly quoted in comments to this file as 'inherited from GSTable').
|
||||
If you need to do that, you should be using GSTable instead.
|
||||
</p>
|
||||
<p>
|
||||
A GSHbox is an invisible view (a logical device) which can
|
||||
contain some views. The GSHbox controls the position and sizes
|
||||
of these views so that they are lined up in a row.
|
||||
</p>
|
||||
<p>
|
||||
To initialize a GSHbox, you should always use -init
|
||||
method. Don't use GSTable methods. The correct way to start
|
||||
using a new GSHbox is simply:
|
||||
<example>
|
||||
hbox = [GSHbox new];
|
||||
</example>
|
||||
<p>
|
||||
(well, of course, autoreleasing it if necessary). You add a view to a
|
||||
GSHbox using the method -addView: and its variants. The
|
||||
views you add to a GSHbox are placed by the GSHbox in its
|
||||
subview hierarchy, and moved (and/or resized in the vertical direction)
|
||||
so that they are positioned one after the other, from left to right, in
|
||||
a row. Before adding views to a box, you should resize them to the
|
||||
least comfortable size you want them to have. The GSHbox
|
||||
considers this size as the minimum size your view should ever have, and
|
||||
never resizes your view below this size.
|
||||
</p>
|
||||
<p>
|
||||
The initial size of the GSHbox is zero; each time you add a view
|
||||
in the GSHbox, the GSHbox resizes itself to fit the new
|
||||
contents. Usually, you simply add objects to the GSHbox, and let
|
||||
it compute its size (this is the minimum size); you may get this
|
||||
resulting size by
|
||||
<example>
|
||||
size = [yourHBox size];
|
||||
</example>
|
||||
for example, if the GSHbox is to be used as the content view of a window,
|
||||
you may create the window exactly with this size.
|
||||
</p>
|
||||
<p>
|
||||
You should never force a GSHbox in a size different from the one
|
||||
it has automatically computed. It sounds quite pointless anyway. The
|
||||
only correct (and meaningful) way to resize a GSHbox is through
|
||||
-resizeWithOldSuperviewSize: messages (in the view hierarchy).
|
||||
In other words, after you place your box in the view hierarchy, then you
|
||||
may resize the superview and (if the superview has autoresizing of
|
||||
subviews enabled) your box is resized automatically accordingly.
|
||||
</p>
|
||||
<p>
|
||||
By default, there is no space between the added views. By using the method
|
||||
-addView:withMinXMargin: you may tell the GSHbox to insert
|
||||
some space (a <var>margin</var>) between the view you are adding and the
|
||||
previous one (the one at its left).
|
||||
</p>
|
||||
<p>
|
||||
If what you want is space around the GSHbox, and not between
|
||||
views in the GSHbox, you don't want a margin but a <var>border</var>;
|
||||
you should then use -setBorder:, which will add an equal amount
|
||||
of space on all the sides of the box. You can also set a different
|
||||
border on each side (see -setMinXBorder: and similar methods).
|
||||
</p>
|
||||
<p>
|
||||
A useful feature of GSHbox is that it supports <var>separators</var>.
|
||||
This facility is not directly available in GSTable (to add
|
||||
separators to a GSTable you need to create and handle them
|
||||
yourself). A GSHbox separator is a vertical groove line, used to
|
||||
mark the separation between different elements of a box. To add a
|
||||
separator, simply invoke the method -addSeparator. The separator
|
||||
is put at the right of the last added view.
|
||||
</p>
|
||||
<p>
|
||||
To use GSHbox proficiently, it is crucial to set correctly the
|
||||
autoresizing mask of each view before adding it to the GSHbox.
|
||||
</p>
|
||||
<p>
|
||||
The GSHbox treats each view and its margins as a whole (see the
|
||||
GSTable class description for more information).
|
||||
</p>
|
||||
<p>
|
||||
When the GSHbox is resized in the vertical direction (as a
|
||||
consequence of user intervertion, for example), what happens is:
|
||||
<list>
|
||||
<item> if the new height is less than the minimum height of the GSHbox
|
||||
(computed as the maximum of the minimum height of the added views), it
|
||||
simply resizes all the added views to this minimum height; part of them
|
||||
are clipped then.
|
||||
</item>
|
||||
<item> if the new height is greater than the GSHbox's minimum height,
|
||||
the GSHbox resizes all the added views to the new height. This
|
||||
is done through the standard superview-subview resizing mechanism, so
|
||||
that, by setting the autoresizingMask of each view that you add,
|
||||
you are able to control exactly how the resizing effects each view and
|
||||
its margins.
|
||||
</item>
|
||||
</list>
|
||||
<p>
|
||||
When the GSHbox is resized in the horizontal direction, its
|
||||
behaviour is as follows:
|
||||
</p>
|
||||
<list>
|
||||
<item> If the new width is less than
|
||||
the minimum width, all the added views are sized to minimum width; part
|
||||
of them is clipped then.
|
||||
</item>
|
||||
<item> If the new width is greater than
|
||||
the minimum width, some of the views are resized. You may decide which
|
||||
views you want to be resized and which not; to disable resizing of a
|
||||
certain view in the horizontal direction, you should specify a NO
|
||||
value to the option <code>enablingXResizing</code> when you add the view to
|
||||
the box. Views with X Resizing Not Enabled are always kept in their
|
||||
minimum width (the original one), and never resized. If nothing is
|
||||
specified, a default of YES for <code>enablingXResizing</code> is
|
||||
understood. So, when the new width is greater than the minimum width,
|
||||
the excess width is equally divided between the view with X Resizing
|
||||
Enabled. The actual resizing is done through the usual
|
||||
superview-subview resizing mechanism, so that again you may influence
|
||||
the way the resizing affects each view by setting the autoresizing mask
|
||||
of each view.
|
||||
</item>
|
||||
</list>
|
||||
|
||||
</unit>
|
||||
*/
|
||||
@interface GSHbox: GSTable
|
||||
{
|
||||
BOOL _haveViews;
|
||||
|
@ -47,121 +171,163 @@
|
|||
}
|
||||
//
|
||||
// Initizialing.
|
||||
// Always use init for GSHbox: other methods don't make sense.
|
||||
// Don't used GSTable methods. You do not need to specify
|
||||
// the number of views you plan to put in the box
|
||||
// when you initialize it.
|
||||
// So, the correct way to start a new GSHbox is simply:
|
||||
//
|
||||
// hbox = [GSHbox new];
|
||||
//
|
||||
/** Always use init for GSHbox: other methods don't make sense.
|
||||
Don't used GSTable methods. You do not need to specify
|
||||
the number of views you plan to put in the box
|
||||
when you initialize it.
|
||||
*/
|
||||
-(id) init;
|
||||
//
|
||||
// Setting Border.
|
||||
//
|
||||
|
||||
// Use these if you want some spacing around the table.
|
||||
// Changing the border will update immediately the box.
|
||||
// The default border is zero.
|
||||
//
|
||||
// Inherited from GSTable Class:
|
||||
// To have the same border on the four sides use:
|
||||
//-(void) setBorder: (float)aBorder;
|
||||
//
|
||||
// To set borders in the horizontal or vertical direction, use:
|
||||
//-(void) setXBorder: (float)aBorder;
|
||||
//-(void) setYBorder: (float)aBorder;
|
||||
//
|
||||
// To specificy different borders, use:
|
||||
//-(void) setMinXBorder: (float)aBorder;
|
||||
//-(void) setMaxXBorder: (float)aBorder;
|
||||
//-(void) setMinYBorder: (float)aBorder;
|
||||
//-(void) setMaxYBorder: (float)aBorder;
|
||||
//
|
||||
/** Set the spacing around the table.
|
||||
Changing the border will update immediately the box.
|
||||
The default border is zero.
|
||||
|
||||
Inherited from GSTable Class:
|
||||
To have the same border on the four sides use:
|
||||
*/
|
||||
-(void) setBorder: (float)aBorder;
|
||||
|
||||
/** Set borders in the horizontal direction. */
|
||||
-(void) setXBorder: (float)aBorder;
|
||||
/** Set borders in the vertical direction. */
|
||||
-(void) setYBorder: (float)aBorder;
|
||||
|
||||
-(void) setMinXBorder: (float)aBorder;
|
||||
-(void) setMaxXBorder: (float)aBorder;
|
||||
-(void) setMinYBorder: (float)aBorder;
|
||||
-(void) setMaxYBorder: (float)aBorder;
|
||||
|
||||
|
||||
//
|
||||
// Adding a View.
|
||||
// Use these methods to pack views in the GSHbox.
|
||||
// Don't use the corresponding methods of GSTable, which are far more general
|
||||
// and far more complicate. If you need to do that, use GSTable instead.
|
||||
//
|
||||
/** See -addView:enablingXResizing:withMinXMargin: */
|
||||
-(void) addView: (NSView *)aView;
|
||||
|
||||
/** See -addView:enablingXResizing:withMinXMargin: */
|
||||
-(void) addView: (NSView *)aView
|
||||
enablingXResizing: (BOOL)aFlag;
|
||||
|
||||
/** See -addView:enablingXResizing:withMinXMargin: */
|
||||
-(void) addView: (NSView *)aView
|
||||
withMinXMargin: (float)aMargin;
|
||||
|
||||
/** <p> Pack views in the GSHbox.
|
||||
Don't use the corresponding methods of GSTable, which are far more general
|
||||
and far more complicate. If you need to do that, use GSTable instead.
|
||||
</p>
|
||||
<p>
|
||||
Add a view to the box, enabling X Resizing only if flag is
|
||||
YES, and a MinXMargin aMargin. If aFlag is
|
||||
YES the [view and its margins] should be resized in the
|
||||
horizontal direction when the GSHbox is resized in the horizontal
|
||||
direction. If aFlag is NO the view is never X-resized and
|
||||
always left in its original width. The default is YES.
|
||||
</p>
|
||||
<p>
|
||||
The min X margin is used to separate the view from the preceding one.
|
||||
The first view added to the box has no min X margin; if you try setting
|
||||
one for it, it is ignored (zero is used instead).
|
||||
</p>
|
||||
<p>
|
||||
When views are added to the GSHbox, it might happen that some of
|
||||
the added views have a greater height than others. When this happens,
|
||||
the GSHbox resizes all the views to the highest height. As
|
||||
usual, each view is resized with its margins; the effect of the resizing
|
||||
on each view is determined by the autoresizing mask of the view. The
|
||||
classical options are
|
||||
</p>
|
||||
<deflist>
|
||||
<term> (NSViewMinYMargin | NSViewMaxYMargin) </term>
|
||||
<desc>Center the view vertically</desc>
|
||||
<term> NSViewMinYMargin </term>
|
||||
<desc>Flush the view up (down if the GSHbox is flipped)</desc>
|
||||
<term> NSViewMaxYMargin </term>
|
||||
<desc>Flush the view down (up if the GSHbox is flipped)</desc>
|
||||
<term> NSViewHeightSizable </term>
|
||||
<desc>Expand the view to the whole height</desc>
|
||||
</deflist>
|
||||
<p>
|
||||
(you may need to OR these masks with the mask you use in the
|
||||
horizontal direction, if you use any).
|
||||
</p>
|
||||
<p>
|
||||
With a GSHbox, only one margin is set when you add views to the GSHbox:
|
||||
the margin between each view and the preceding one.
|
||||
Exception: the first view is special, and has no margin set (it has no
|
||||
preceding view to be separated from).
|
||||
Space above or below the view may result if the view is shorter,
|
||||
in the vertical direction, than the other views in the GSHbox;
|
||||
in that case the view is resized to fit vertically,
|
||||
according to its autoresizingMask.
|
||||
By changing the autoresizingMask you may decide whether the space
|
||||
should go to the view or to its vertical margins; this for example
|
||||
lets you center vertically or flush up/down your view.
|
||||
*/
|
||||
-(void) addView: (NSView *)aView
|
||||
// enablingXResizing is YES if the {view and its margins} should be
|
||||
// resized when the GSHbox is resized in the horizontal direction.
|
||||
// FALSE does not resize it. Default is YES.
|
||||
enablingXResizing: (BOOL)aFlag
|
||||
// With a GSHbox, only one margin is set when you add views to the GSHbox:
|
||||
// the margin between each view and the preceding one.
|
||||
// Exception: the first view is special, and has no margin set (it has no
|
||||
// preceding view to be separated from).
|
||||
// Space above or below the view may result if the view is shorter,
|
||||
// in the vertical direction, than the other views in the GSHbox;
|
||||
// in that case the view is resized to fit vertically,
|
||||
// according to its autoresizingMask.
|
||||
// By changing the autoresizingMask you may decide whether the space
|
||||
// should go to the view or to its vertical margins; this for example
|
||||
// lets you center vertically or flush up/down your view.
|
||||
withMinXMargin: (float)aMargin;
|
||||
enablingXResizing: (BOOL)aFlag
|
||||
withMinXMargin: (float)aMargin;
|
||||
|
||||
//
|
||||
// Adding a Separator.
|
||||
//
|
||||
/** Add a separator with the default MinXMargin. */
|
||||
-(void) addSeparator;
|
||||
|
||||
/** Add a separator (a vertical groove line encompassing all the
|
||||
height of the GSHbox) to the GSHbox, inserting a margin aMargin
|
||||
between the separator and the last added view.
|
||||
*/
|
||||
-(void) addSeparatorWithMinXMargin: (float)aMargin;
|
||||
|
||||
//
|
||||
// Setting Margins.
|
||||
//
|
||||
|
||||
// Use only the following method to set a default margin.
|
||||
// The default margin set with the following method will be used
|
||||
// for all the views added after.
|
||||
// (Exception: the first view put in the box has no margins at all)
|
||||
// It will not affect already added views.
|
||||
// In a GSHbox, only one margin is used, the one between each view
|
||||
// and the preceding one. If what you want is space around the GSHbox,
|
||||
// you don't want a margin but a border; use setBorder:
|
||||
// (see above, "Setting Border").
|
||||
// If you need more complicated margins/borders, use GSTable.
|
||||
/** Use only the following method to set a default margin.
|
||||
The default margin set with the following method will be used
|
||||
for all the views added after.
|
||||
(Exception: the first view put in the box has no margins at all)
|
||||
It will not affect already added views.
|
||||
In a GSHbox, only one margin is used, the one between each view
|
||||
and the preceding one. If what you want is space around the GSHbox,
|
||||
you don't want a margin but a border; use setBorder:
|
||||
(see above, "Setting Border").
|
||||
If you need more complicated margins/borders, use GSTable.
|
||||
*/
|
||||
-(void) setDefaultMinXMargin: (float)aMargin;
|
||||
|
||||
//
|
||||
// Minimum Size.
|
||||
//
|
||||
|
||||
// This returns the minimum size the GSHbox should be resized to.
|
||||
// Trying to resize the GSHbox below this size will only result in clipping
|
||||
// (ie, making it disappear) part of the GSHbox.
|
||||
// Inherited from GSTable Class:
|
||||
// -(NSSize) minimumSize;
|
||||
/** This returns the minimum size the GSHbox should be resized to.
|
||||
Trying to resize the GSHbox below this size will only result in clipping
|
||||
(ie, making it disappear) part of the GSHbox.
|
||||
Inherited from GSTable Class:
|
||||
*/
|
||||
-(NSSize) minimumSize;
|
||||
|
||||
//
|
||||
// Resizing.
|
||||
//
|
||||
|
||||
// If for any reason you need the GSHbox to revert to its minimum size,
|
||||
// invoke the following.
|
||||
// Inherited from GSTable Class:
|
||||
// -(void) sizeToFit;
|
||||
/** If for any reason you need the GSHbox to revert to its minimum size,
|
||||
invoke the following.
|
||||
Inherited from GSTable Class:
|
||||
*/
|
||||
-(void) sizeToFit;
|
||||
|
||||
//
|
||||
// Getting Number of Views
|
||||
//
|
||||
|
||||
// Return the number of views in the GSHbox (separators included).
|
||||
/** Return the number of views in the GSHbox (separators included). */
|
||||
-(int) numberOfViews;
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_GSHbox */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,144 @@
|
|||
|
||||
#include <AppKit/NSView.h>
|
||||
|
||||
/**
|
||||
<unit>
|
||||
<heading>GSTable</heading>
|
||||
|
||||
<p>
|
||||
A GSTable object is used to control the disposition (position and
|
||||
size) of a group of NSViews. The GSTable object offers
|
||||
two main facilities to the programmer:
|
||||
</p>
|
||||
<list>
|
||||
<item>
|
||||
with a GSTable object, you do not need to specify the exact
|
||||
position and size of each view. You only specify the logical position,
|
||||
relative to the other views in the table. The actual frame of each view
|
||||
is then computed by the GSTable at run time.
|
||||
</item>
|
||||
<item>
|
||||
when the GSTable is resized (for example, because the user has
|
||||
resized the window in which the GSTable is), the GSTable
|
||||
takes care of moving and resizing all its views automatically. This is
|
||||
done in much a advanced and customizable way than in the usual standard
|
||||
NSView's autoresizing mechanism.
|
||||
</item>
|
||||
</list>
|
||||
|
||||
<p>
|
||||
You create a GSTable instance with a certain number of rows and
|
||||
columns. The GSTable object itself is invisible; it is only a
|
||||
logical device used to specify the subview position. Then, you place
|
||||
one by one the views you want to control in the GSTable, by
|
||||
calling a method of the family -putView:atRow:column:. Before
|
||||
placing a view in the table, you should resize it to the minimum
|
||||
comfortable size you want it to have. The table then automatically
|
||||
places the views, organizing them in well-ordered columns and rows.
|
||||
</p>
|
||||
<p>
|
||||
The initial size of the GSTable is zero; each time you put a view
|
||||
in the GSTable, the GSTable recomputes sizes and as a
|
||||
result resizes itself so that it exactly fits the views it contains.
|
||||
You should not force a GSTable in a size different from the one
|
||||
it has automatically computed. The only acceptable, reasonable and
|
||||
meaningful way of resizing a GSTable is through the appropriate
|
||||
-resizeWithOldSuperviewSize: message when the GSTable is
|
||||
in the view hierarchy.
|
||||
</p>
|
||||
<p>
|
||||
When you add a view, you may specify some particular margins to be used
|
||||
for that view. If nothing is specified, the view is added to the table
|
||||
with the margins of 0. You should think of each view and its margins as
|
||||
a whole. A position in the GSTable is free or filled with a view
|
||||
and its margins.
|
||||
</p>
|
||||
<p>
|
||||
The GSTable itself knows what is the minimum size it needs to
|
||||
have in order to comfortably display the views it contains. You may get
|
||||
this size by calling the method -minimumSize. When first filled,
|
||||
the table has this minimum size. If in any moment you want the table to
|
||||
restore itself to this size, you should invoke the method
|
||||
-sizeToFit.
|
||||
</p>
|
||||
<p>
|
||||
When the GSTable receives a -resizeWithOldSuperviewSize:
|
||||
message, it automatically rearranges the views it contains:
|
||||
<list>
|
||||
<item>
|
||||
If the new width or height is equal or less than the table's minimum
|
||||
width or height, the GSTable simply arranges its views in the
|
||||
initial position. In other words, the GSTable refuse to resize
|
||||
below its minimum width or height. If you do that, part of the
|
||||
GSTable is clipped.
|
||||
</item>
|
||||
<item>
|
||||
If the new width or height is bigger than the table's minimum width or
|
||||
height, the space in excess is equally distributed between the columns
|
||||
or rows which have X (or Y) resizing enabled. When a column or a row is
|
||||
resized, each view in the column or row is resized together with its
|
||||
margins. By setting the autoresizingMask of each view, you may decide
|
||||
how the resizing operation will act on that particular view and its
|
||||
margins. For example, setting the autoresizingMask to
|
||||
<code>NSViewWidthSizable | NSViewHeightSizable</code> will always leave the
|
||||
margins fixed to their initial dimensions, and expand/reduce only the
|
||||
view, in all directions. Setting the autoresizingMask to
|
||||
<code>NSViewMinXMargin | NSViewMaxXMargin</code> <code>| NSViewSizable |
|
||||
NSViewHeightSizable</code> will instead expand/reduce both the margins and the
|
||||
view in the horizontal direction, but leave the margins fixed and
|
||||
expand/reduce only the view in the vertical direction. Whatever the
|
||||
autoresizingMask and the amount of the resizing, views and margins are
|
||||
never resized below their minimum comfortable size, as explained above.
|
||||
For more information on the autoresizingMask, please refer to the
|
||||
description of the -setAutoresizingMask: method of the
|
||||
NSView class.
|
||||
</item>
|
||||
</list>
|
||||
|
||||
<section>
|
||||
<heading> Advanced Description of GSTable</heading>
|
||||
|
||||
<p>
|
||||
We call any view which is added to the GSTable a <var>prisoner</var>.
|
||||
The purpose of the GSTable is to effectively manage its
|
||||
prisoners. To do so, the GSTable creates a special view, called
|
||||
a <var>jail</var>, for each prisoner. The jails are subviews of the
|
||||
GSTable; each prisoner, when added to the GSTable, is made
|
||||
a subview of its jail. The GSTable always moves and resizes
|
||||
directly the jails. The moving is automatically transmitted to the
|
||||
prisoners, which are subviews of the jails; the resizing is transmitted
|
||||
through the usual autoresizing machinery, because the jails always have
|
||||
autoresizing of subviews turned on. This works because if a prisoner
|
||||
sends to its superview a -frame message, the frame of the jail
|
||||
(and <em>not</em> the frame of the GSTable) is returned, so that
|
||||
each prisoner will autoresize itself in its jail frame. Moreover, any
|
||||
prisoner, being a subview of its jail, is clipped in its jail frame. If
|
||||
a prisoner draws something out of its jail frame, the output is
|
||||
discarded by the usual subview/view clipping machinery. This prevents
|
||||
the prisoners from disturbing each other. The dimension of the jail is
|
||||
the dimension of the prisoner plus its margins. Since the
|
||||
GSTable manages directly the jails, each prisoner is managed
|
||||
together with its margins. When the jail is resized, the prisoner
|
||||
receives a -resizeWithOldSuperviewSize:, which makes it resize
|
||||
itself and its margins in the new jail size, according to its
|
||||
autoresizingMask.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<heading> Setting Row and Column Expand Flag</heading>
|
||||
<p>
|
||||
When the GSTable is resized, the extra space is equally divided
|
||||
between the Rows and Columns which have the X (or Y) resizing enabled.
|
||||
The following methods let you enable/disable the X (or Y) resizing of
|
||||
each row and column in the GSTable. Note that when the
|
||||
GSTable is first created, all its columns and rows have by
|
||||
default resizing enabled.
|
||||
-setXResizingEnabled:forColumn:, -setYResizingEnabled:forRow:.
|
||||
</p>
|
||||
</section>
|
||||
</unit>
|
||||
*/
|
||||
@interface GSTable: NSView
|
||||
{
|
||||
int _numberOfRows;
|
||||
|
@ -73,81 +211,144 @@
|
|||
//
|
||||
// Initizialing.
|
||||
//
|
||||
/** Initialize a GSTable with columns columns and rows
|
||||
rows. If columns or rows is negative or null, a warning
|
||||
is issued and a default of 2 is used instead.
|
||||
*/
|
||||
-(id) initWithNumberOfRows: (int)rows
|
||||
numberOfColumns: (int)columns;
|
||||
|
||||
// Initialize with a default of 2 columns and 2 rows.
|
||||
/** Initialize with a default of 2 columns and 2 rows. */
|
||||
-(id) init;
|
||||
//
|
||||
// Setting Border Dimension.
|
||||
// Border is space around the table.
|
||||
//
|
||||
/** Set the GSTable up, bottom, left and right borders to the same
|
||||
value aBorder. The GSTable is immediately updated. If
|
||||
aBorder is negative, the border is reset to the default, which is
|
||||
zero (0). The border is simply unfilled space; it is measured in the
|
||||
GSTable coordinate system.
|
||||
*/
|
||||
-(void) setBorder: (float)aBorder;
|
||||
/** Set the GSTable left and right borders to aBorder. If
|
||||
aBorder is negative, the border is reset to zero. The
|
||||
GSTable is immediately updated.
|
||||
*/
|
||||
-(void) setXBorder: (float)aBorder;
|
||||
/** Same as setXBorder: but set the up and bottom borders. */
|
||||
-(void) setYBorder: (float)aBorder;
|
||||
/** Same as setXBorder: but set only the left border. */
|
||||
-(void) setMinXBorder: (float)aBorder;
|
||||
/** Same as setXBorder: but set only the right border. */
|
||||
-(void) setMaxXBorder: (float)aBorder;
|
||||
/** Same as setXBorder: but set only the lower border (upper
|
||||
if the GSTable is flipped). */
|
||||
-(void) setMinYBorder: (float)aBorder;
|
||||
/** Same as setXBorder: but set only the upper border (lower
|
||||
if the GSTable is flipped). */
|
||||
-(void) setMaxYBorder: (float)aBorder;
|
||||
//
|
||||
// Adding a View.
|
||||
// Use these methods to put views in the GSTable.
|
||||
//
|
||||
/** Put aView in the GSTable, in the specified row and
|
||||
column. Zero (0) margins are used. If the column column
|
||||
(or the row row}) is not enough big to fully display aView
|
||||
and its margins, the column (or the row) is resized (regardless of the
|
||||
fact that X or Y Resizing is Enabled or not). It is understood that
|
||||
this will affect each view (and its margins) in the column (or row)
|
||||
according to the autoresizing mask of each view.
|
||||
*/
|
||||
-(void) putView: (NSView *)aView
|
||||
atRow: (int)row
|
||||
column: (int)column;
|
||||
|
||||
/** Put aView in the GSTable, using margins as margin
|
||||
in all directions: left, right, top, bottom.
|
||||
*/
|
||||
-(void) putView: (NSView *)aView
|
||||
atRow: (int)row
|
||||
column: (int)column
|
||||
withMargins: (float)margins;
|
||||
|
||||
/** Put aView in the GSTable, using xMargins as the
|
||||
left and right margins, and yMargins as the top and bottom
|
||||
margins. */
|
||||
-(void) putView: (NSView *)aView
|
||||
atRow: (int)row
|
||||
column: (int)column
|
||||
withXMargins: (float)xMargins
|
||||
yMargins: (float)yMargins;
|
||||
|
||||
/** Put aView in the GSTabl}, using the specified margins.
|
||||
The names for the margins are chosen as to be as close as possible to
|
||||
the autoresizingMask convention. The margins are to be interpreted as
|
||||
follows:
|
||||
<deflist>
|
||||
<item> minXMargin </item>
|
||||
<desc>Left Margin</desc>
|
||||
<item> maxXMargin </item>
|
||||
<desc>Right Margin</desc>
|
||||
<item> minYMargin </item>
|
||||
<desc>Lower Margin (Upper if view is flipped)</desc>
|
||||
<item> maxYMargin </item>
|
||||
<desc>Upper Margin (Lower if view is flipped)</desc>
|
||||
</deflist>
|
||||
|
||||
<p>
|
||||
Each view which is added to the GSTable can have some margins
|
||||
set. The GSTable treats the view and its margins as a whole.
|
||||
They are given (as a whole) some space, which is reduced or
|
||||
increased (but only if X or Y Resizing is Enabled for the column
|
||||
or the row in which the view resides) when the GSTable is
|
||||
resized. When this happens, the space is added (or subtracted)
|
||||
to the view or to the margins according to the autoResizeMask of
|
||||
the view.
|
||||
</p>
|
||||
*/
|
||||
-(void) putView: (NSView *)aView
|
||||
atRow: (int)row
|
||||
column: (int)column
|
||||
// Each view which is added to the GSTable can have some margins
|
||||
// set. The GSTable treats the view and its margins as a whole.
|
||||
// They are given (as a whole) some space, which is reduced or
|
||||
// increased (but only if X or Y Resizing is Enabled for the column
|
||||
// or the row in which the view resides) when the GSTable is
|
||||
// resized. When this happens, the space is added (or subtracted)
|
||||
// to the view or to the margins according to the autoResizeMask of
|
||||
// the view.
|
||||
withMinXMargin: (float)minXMargin // Left Margin
|
||||
maxXMargin: (float)maxXMargin // Right Margin
|
||||
minYMargin: (float)minYMargin // Lower Margin (Upper if flipped)
|
||||
maxYMargin: (float)maxYMargin; // Upper Margin (Lower if flipped)
|
||||
//
|
||||
// Minimum Size.
|
||||
// This returns the minimum size the GSTable should be resized to.
|
||||
// Trying to resize the GSTable below this size will only result in clipping
|
||||
// (ie, making it disappear) part of the GSTable.
|
||||
//
|
||||
/** This returns the minimum size the GSTable should be resized to.
|
||||
Trying to resize the GSTable below this size will only result in clipping
|
||||
(ie, making it disappear) part of the GSTable.
|
||||
*/
|
||||
-(NSSize) minimumSize;
|
||||
//
|
||||
// Resizing.
|
||||
// If for any reason you need the GSTable to be redrawn (with minimum size),
|
||||
// invoke the following.
|
||||
/** If for any reason you need the GSTable to be redrawn (with minimum size),
|
||||
invoke the following. */
|
||||
-(void) sizeToFit;
|
||||
//
|
||||
// Setting Row and Column Expand Flag
|
||||
// When the GSTable is resized, the extra space is equally divided
|
||||
// between the Rows and Columns which have X/Y Resizing Enabled.
|
||||
//
|
||||
/** Enable/disable X Resizing for the column aColumn}
|
||||
according to aFlag. Note: at present, enabling/disabling
|
||||
X resizing after the table has been put in the view hierarchy
|
||||
is not supported.
|
||||
*/
|
||||
-(void) setXResizingEnabled: (BOOL)aFlag
|
||||
forColumn: (int)aColumn;
|
||||
|
||||
/** Return whether X resizing is enabled for the column aColumn. */
|
||||
-(BOOL) isXResizingEnabledForColumn: (int)aColumn;
|
||||
|
||||
/** Enable/disable Y Resizing for the row aRow
|
||||
according to aFlag. Note: at present, enabling/disabling
|
||||
Y resizing after the table has been put in the view hierarchy
|
||||
is not supported.
|
||||
*/
|
||||
-(void) setYResizingEnabled: (BOOL)aFlag
|
||||
forRow: (int)aRow;
|
||||
|
||||
/** Return whether Y resizing is enabled for the row aRow. */
|
||||
-(BOOL) isYResizingEnabledForRow: (int)aRow;
|
||||
//
|
||||
// Adding Rows and Columns
|
||||
|
@ -155,18 +356,24 @@
|
|||
// Of course it is faster to create a GSTable with the right number of rows
|
||||
// and columns from the beginning.
|
||||
//
|
||||
/** Add a row to the GSTable. The row is added void, with zero
|
||||
height and Y Resizing enabled. */
|
||||
-(void) addRow;
|
||||
// TODO: -(void) insertRow: (int)row;
|
||||
// TODO: -(void) removeRow: (int)row;
|
||||
|
||||
/** Add a column to the GSTable. The column is added void,
|
||||
with zero width and X Resizing enabled. */
|
||||
-(void) addColumn;
|
||||
// TODO: -(void) insertColumn: (int)column;
|
||||
// TODO: -(void) removeColumn: (int)column;
|
||||
//
|
||||
// Getting Row and Column Number
|
||||
//
|
||||
/** Return the number of rows in the GSTable. */
|
||||
-(int) numberOfRows;
|
||||
|
||||
/** Return the number of columns in the GSTable. */
|
||||
-(int) numberOfColumns;
|
||||
@end
|
||||
|
||||
|
|
|
@ -39,6 +39,15 @@
|
|||
|
||||
#include "GSTable.h"
|
||||
|
||||
/**
|
||||
<unit>
|
||||
<heading>GSVbox</heading>
|
||||
|
||||
<p> A GSVbox is completely analogue to a GSHbox. It implements the
|
||||
same methods; the only different is that it packs views from bottom
|
||||
to top (from top to bottom if flipped). </p>
|
||||
</unit>
|
||||
*/
|
||||
@interface GSVbox: GSTable
|
||||
{
|
||||
BOOL _haveViews;
|
||||
|
@ -66,14 +75,18 @@
|
|||
//
|
||||
// Adding a View.
|
||||
//
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addView: (NSView *)aView;
|
||||
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addView: (NSView *)aView
|
||||
enablingYResizing: (BOOL)aFlag;
|
||||
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addView: (NSView *)aView
|
||||
withMinYMargin: (float)aMargin;
|
||||
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addView: (NSView *)aView
|
||||
enablingYResizing: (BOOL)aFlag
|
||||
withMinYMargin: (float)aMargin;
|
||||
|
@ -81,13 +94,16 @@ enablingYResizing: (BOOL)aFlag
|
|||
//
|
||||
// Adding a Separator.
|
||||
//
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addSeparator;
|
||||
/** See the documentation for GSHbox */
|
||||
-(void) addSeparatorWithMinYMargin: (float)aMargin;
|
||||
|
||||
//
|
||||
// Setting Margins.
|
||||
//
|
||||
-(void) setDefaultMinYMargin: (float)aMargin;
|
||||
|
||||
//-(void) setDefaultMinYMargin: (float)aMargin;
|
||||
|
||||
//
|
||||
// Minimum Size.
|
||||
|
@ -106,6 +122,7 @@ enablingYResizing: (BOOL)aFlag
|
|||
//
|
||||
// Getting Number of Views
|
||||
//
|
||||
/** Return the number of views in the GSVbox (separators included). */
|
||||
-(int) numberOfViews;
|
||||
@end
|
||||
|
||||
|
|
|
@ -498,7 +498,7 @@ GSCurrentServer(void)
|
|||
return [self window: frame : type : style : sn];
|
||||
}
|
||||
|
||||
/** Like window::: only there is an additional argument to specify which
|
||||
/** Like -window::: only there is an additional argument to specify which
|
||||
screen the window will display on */
|
||||
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
|
||||
: (int)screen
|
||||
|
@ -514,7 +514,7 @@ GSCurrentServer(void)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Sets the style of the window. See [NSWindow -styleMask] for a
|
||||
/** Sets the style of the window. See [NSWindow-styleMask] for a
|
||||
description of the available styles */
|
||||
- (void) stylewindow: (unsigned int) style : (int) win
|
||||
{
|
||||
|
@ -550,7 +550,7 @@ GSCurrentServer(void)
|
|||
|
||||
|
||||
/** Sets the window device information for the current NSGraphicsContext,
|
||||
typically by calling [NSGraphicsContext -GSSetDevice:::],
|
||||
typically by calling [NSGraphicsContext-GSSetDevice:::],
|
||||
although depending on the concrete implmentation, more information
|
||||
than this may need to be exchanged. */
|
||||
- (void) windowdevice: (int) win
|
||||
|
|
|
@ -914,7 +914,7 @@ static NSCell* tileCell = nil;
|
|||
// TODO: Currently the flag is ignored
|
||||
if (_app_is_active == NO)
|
||||
{
|
||||
unsigned count = [_inactive count];
|
||||
unsigned count;
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
|
@ -926,6 +926,9 @@ static NSCell* tileCell = nil;
|
|||
|
||||
_app_is_active = YES;
|
||||
|
||||
/* Make sure to calculate count after the notification, since
|
||||
inactive status might be changed by a notifiee. */
|
||||
count = [_inactive count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[[_inactive objectAtIndex: i] orderFrontRegardless];
|
||||
|
@ -2042,23 +2045,119 @@ image.
|
|||
/*
|
||||
* Showing Standard Panels
|
||||
*/
|
||||
/* infoPanel, macosx API */
|
||||
/** Calls -orderFrontStandardAboutPanelWithOptions: with nil passed as
|
||||
the options dictionary.
|
||||
*/
|
||||
- (void) orderFrontStandardAboutPanel: sender
|
||||
{
|
||||
[self orderFrontStandardAboutPanelWithOptions: nil];
|
||||
}
|
||||
|
||||
/** Calls -orderFrontStandardInfoPanelWithOptions:
|
||||
*/
|
||||
- (void) orderFrontStandardAboutPanelWithOptions: (NSDictionary *)dictionary
|
||||
{
|
||||
[self orderFrontStandardInfoPanelWithOptions: dictionary];
|
||||
}
|
||||
|
||||
/* infoPanel, GNUstep API */
|
||||
/** Calls -orderFrontStandardInfoPanelWithOptions: with nil passed as
|
||||
the options dictionary.
|
||||
*/
|
||||
- (void) orderFrontStandardInfoPanel: sender
|
||||
{
|
||||
[self orderFrontStandardInfoPanelWithOptions: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
<p>
|
||||
Orders front the standard info panel for the application,
|
||||
taking the needed information from the <code>dictionary</code>
|
||||
argument. There is a single standard info panel per application;
|
||||
it is created the first time that this method is invoked, and then
|
||||
reused in all subsequent calls. The application standard info
|
||||
panel is immutable and can not be changed after creation. Useful
|
||||
keys for the <code>dictionary</code> are:
|
||||
</p>
|
||||
|
||||
<deflist>
|
||||
<term>ApplicationName</term>
|
||||
<desc>A string with the name of the
|
||||
application (eg, <var>"Gorm"</var>). If not available, the
|
||||
<file>Info-gnustep.plist</file> file is searched for the value of
|
||||
<var>ApplicationName</var> followed by
|
||||
<var>NSHumanReadableShortName</var>. If this also fails, the
|
||||
string returned by [NSProcessInfo-processName] is used.
|
||||
</desc>
|
||||
|
||||
<term>ApplicationDescription</term>
|
||||
<desc> A string with a very short
|
||||
description of the application (eg, <var>"GNUstep Graphics
|
||||
Objects Relationship Modeller"</var>). If not available,
|
||||
<file>Info-gnustep.plist</file> is searched for that key; if this
|
||||
fails, no application description is shown.
|
||||
</desc>
|
||||
|
||||
<term>ApplicationIcon</term>
|
||||
<desc> An image to be shown near the title.
|
||||
If not available, <file>Info-gnustep.plist</file> is searched for
|
||||
<var>ApplicationIcon</var>; if this fails, [NSApp-applicationIconImage]
|
||||
is used instead.
|
||||
</desc>
|
||||
|
||||
<term>ApplicationRelease</term>
|
||||
<desc> A string with the name of the
|
||||
application, release included (eg, <var>"Gorm 0.1"</var>). If
|
||||
not available, the value for <var>ApplicationVersion</var> is
|
||||
used instead. If this fails, <file>Info-gnustep.plist</file> is
|
||||
searched for <var>ApplicationRelease</var> or
|
||||
<var>NSAppVersion</var>, otherwise, <var>"Unknown"</var> is
|
||||
used.
|
||||
</desc>
|
||||
|
||||
<term>FullVersionID</term>
|
||||
<desc> A string with the full version of the
|
||||
application (eg, <var>"0.1.2b"</var> or
|
||||
<var>"snap011100"</var>). If not available,
|
||||
<var>Version</var> is used instead. If this fails,
|
||||
<file>Info-gnustep.plist</file> is looked for
|
||||
<var>NSBuildVersion</var>. If all fails, no full version is
|
||||
shown.
|
||||
</desc>
|
||||
|
||||
<term>Authors</term>
|
||||
<desc> An array of strings, each one with the name
|
||||
of an author (eg, <var>[NSArray arrayWithObject: "Nicola Pero
|
||||
<n.peromi.flashnet.it>"]</var>). If not found,
|
||||
<file>Info-gnustep.plist</file> is searched for <var>Authors</var>,
|
||||
if this fails, <var>"Unknown"</var> is displayed.
|
||||
</desc>
|
||||
|
||||
<term>URL</term>
|
||||
<desc> [This field is still under work, so it might be
|
||||
changed] A string with an URL (eg, <var>"See
|
||||
http://www.gnustep.org"</var>).
|
||||
</desc>
|
||||
|
||||
<term>Copyright</term>
|
||||
<desc> A string with copyright owners (eg,
|
||||
<var>"Copyright (C) 2000 The Free Software Foundation,
|
||||
Inc."</var>). Support for multiple line strings is planned but
|
||||
not yet available. If not found, <file>Info-gnustep.plist</file>
|
||||
is searched for <var>Copyright</var> and then (failing this) for
|
||||
<var>NSHumanReadableCopyright</var>. If all fails,
|
||||
<var>"Copyright Information Not Available"</var> is used.
|
||||
</desc>
|
||||
|
||||
<term>CopyrightDescription</term>
|
||||
<desc>A string describing the kind of
|
||||
copyright (eg, <var>"Released under the GNU General Public
|
||||
License 2.0"</var>). If not available,
|
||||
<file>Info-gnustep.plist</file> is searched for
|
||||
<var>CopyrightDescription</var>. If this fails, no copyright
|
||||
description is shown.
|
||||
</desc>
|
||||
*/
|
||||
- (void) orderFrontStandardInfoPanelWithOptions: (NSDictionary *)dictionary
|
||||
{
|
||||
if (_infoPanel == nil)
|
||||
|
|
Loading…
Reference in a new issue