GEOS SDK TechDocs
|
|
4.3 Drawing the Document
|
4.5 Document Scaling
Typically, the document's size will be independent of the view's size. The visual relationship between the two is maintained with the use of scrollers. In these situations, the view will size itself according to the size of its parent Primary window. However, you can change the sizing behavior of the view simply by setting attributes or applying hints.
HINT_INITIAL_SIZE, HINT_MINIMUM_SIZE, HINT_MAXIMUM_SIZE, HINT_FIXED_SIZE
Although the view normally sizes itself to fit the specifications of its parent window, you can change this behavior by applying one of four hints or by setting vertical or horizontal attributes.
HINT_INITIAL_SIZE
This hint sets the initial size of the view to a given width and height. The view window will never shrink smaller than the size set with this hint.
HINT_MINIMUM_SIZE
This hint sets the smallest possible size of the view window. The view's initial size is unaffected by this hint except to ensure that the parent Primary opens large enough to accommodate the view window.
HINT_MAXIMUM_SIZE
This hint sets the maximum allowable size of the view window. This may be used in place of or in addition to the document bounds.
HINT_FIXED_SIZE
This hint has the effect of setting initial, minimum, and maximum sizes at once to set a permanent size for the view window.
All the above hints deal with the structure
CompSizeHintArgs
. This structure allows specification of size in any of a number of different formats including pixels, percentage of screen size, multiples of character widths, number of text lines, and others.
You may also set GVDA_NO_LARGER_THAN_CONTENT and/or GVDA_NO_SMALLER_THAN_CONTENT in the
GVI_horizAttrs
and
GVI_vertAttrs
attribute fields to ensure that the view stays with the content's size. These attributes can be set as follows:
GVI_horizAttrs = @default
| GVDA_NO_LARGER_THAN_CONTENT
| GVDA_NO_SMALLER_THAN_CONTENT;
GVI_vertAttrs = @default
| GVDA_NO_LARGER_THAN_CONTENT
| GVDA_NO_SMALLER_THAN_CONTENT;
The above lines will ensure that the view will remain exactly the same size as the content (within screen boundaries).
You can also instruct the view window to snap its width or height to a multiple of the current horizontal or vertical increment. To do this, set the
GVI_vertAttrs
or
GVI_horizAttrs
attribute GVDA_SIZE_A_MULTIPLE_OF_INCREMENT as below:
GVI_horizAttrs = @default
| GVDA_SIZE_A_MULTIPLE_OF_INCREMENT;
GVI_vertAttrs = @default
| GVDA_SIZE_A_MULTIPLE_OF_INCREMENT;
HINT_VIEW_LEAVE_ROOM_FOR_VERT_SCROLLER, HINT_VIEW_LEAVE_ROOM_FOR_HORIZ_SCROLLER
Occasionally, you may want to leave extra room for scroller objects even when your view will not have scrollers. You can do so with the hints
HINT_VIEW_LEAVE_ROOM_FOR_VERT_SCROLLER
and
HINT_VIEW_LEAVE_ROOM_FOR_HORIZ_SCROLLER
. Although these hints will not affect the size of the view's window, they will affect the view's geometry with respect to its parent window.
MSG_GEN_VIEW_CALC_WIN_SIZE
When determining its size initially, the view sends itself the message
MSG_GEN_VIEW_CALC_WIN_SIZE
. This message, while not useful to applications in and of itself, may be subclassed to get special window sizing behavior. When this message is sent, it includes a suggested window size; by subclassing the GenView and altering the functionality of this message, you can return a different suggested size. The new suggestion will be used to set the view's new size, except at very small sizes--the view will make itself large enough to show scrollers and other children if required.
SizeAsDWord MSG_GEN_VIEW_CALC_WIN_SIZE(
word width, /* suggested new width of view window */
word height); /* suggested new height of view window */
This message is sent by the view to itself when it is first being initialized. It takes a suggested size and returns a new suggested size, adjusted for specific conditions.
Source: Unrestricted.
Destination: Any GenView object.
Parameters:
width
The new suggested width of the view window.
height
Return: A dword representing both the height and the width determined by the method. The width occupies the low word, and the height occupies the high word.
Interception: If you require special sizing behavior from your GenView window, subclass this method. Be sure to call the superclass in the handler.
GEOS SDK TechDocs
|
|
4.3 Drawing the Document
|
4.5 Document Scaling