You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_Window object:
Cvo_Window
Cvo_LayoutWindow
#include
<Cvo/Window.h++>
new
Cvo_Window ( char *resource_name,
[ char *class_name ],
{ Cvo_Object *parent | Display *display } )
The Cvo_Window object is the most basic visual object available in Cvo. It contains new information, such as the colors and chamfer of an object. Virtually every visual object is actually built on a Cvo_Window object. Typically, an application will not create any Cvo_Window objects directly, but will use objects derived from the Cvo_Window object. The Cvo_Window object has several classes of functions defined within it. Some deal with basic properties, some provide hooks into X Lib routines, some provide hooks into the Graphics Context of the window, along with several other types of functions.
This object defines the following member functions in addition to those defined by its parent and ancestor objects.
MainLoop (
)
Loop forever, processing events as they come in. Typically this is
the final statement in a Cvo program's main()
function.
Functions dealing with Cvo_Window object attributes:
MakeFrame (
)
Cause this Cvo_Window object to be a frame. This must be called prior to mapping or creating the Cvo_Window object. Generally it is the first thing done after the object is created. For example, these two code fragments are virtually identical:
Cvo_Frame *frame = new Cvo_Frame(parent);
Cvo_Window *frame = new Cvo_Window(parent);
frame->MakeFrame();
This is useful when you want to turn an object like the Cvo_Matrix into a Cvo_Frame.
Erase (
)
This function erases the contents of the object.
Redraw (
)
This function causes the contents of the object to be redrawn.
This function returns the color of the border for this object.
These functions return the basic foreground and background colors of the object. This does not take into account sunkenness or sensitivity.
These functions return the actual color being used for the foreground and background of the the object.
These functions, which must be called before the object is actually created or mapped, are used to set the color of the foreground or background.
Note that typically the foreground used for drawing is kept in the Graphics Context.
NormalBackground (
)
SelectBackground (
)
Change the background of the object to be normal, or selected. A selected background is slightly darker than the normal background.
SetSensitive (
)
SetUnsensitive (
)
Set the sensitivity state of the object. Typically an object grays out its information when it is not sensitive.
InitializeFocus (
)
Outline (
)
These functions are used to indicate that the object has the input
focus. Outline()
should be called prior to calling
InitializeFocus()
.
The Outline()
member function will cause the object to have a visual
outline around it, indicating that it has input focus.
The InitializeFocus()
member function will cause Cvo focus events
to be registered with the appropriate event handler functions.
Functions used to draw chamfers and other decorations:
short Chamfer (
)
This function returns the amount of chamfer used on this object.
This function is used to draw a chamfer whose upper left inside corner is located at (x,y) and whose interior size is width by height. If these values are missing, or all zero, the chamfer is drawn around the edges of the object.
If color is specified, it is the base color used for the chamfer, otherwise the background color is used.
Similar to DrawRaisedChamfer()
, this
function draws a chamfer which makes the interior look sunken as
opposed to raised.
Similar to DrawRaisedChamfer()
, this
function draws an etching around the area specified.
ClearChamfer (
int amount,
[ int x, int y, int width, int height ] )
This function clears the chamfer drawn by one of the above three chamfer drawing functions.
Flatten (
)
Unflatten (
)
Remove, or bring back the chamfer on the object. Note that flattening an object does not reduce the amount of space it takes.
Request that the window manager display image as the icon for this application. This should only be called for top level objects.
Request that the window manager use image as the mask for the icon
displayed when this application is iconified. This should only be
called for top level objects. Also, typically this is only called
after SetIconPixmap()
.
DrawArrow (
int direction,
int x,
int y,
int w,
[ int h ] )
DrawUpArrow (
int x,
int y,
int w,
[ int h ] )
DrawDownArrow (
int x,
int y,
int w,
[ int h ] )
DrawLeftArrow (
int x,
int y,
int w,
[ int h ] )
DrawRightArrow (
int x,
int y,
int w,
[ int h ] )
These functions draw an arrow at (x,y) on the current object. In the case of arrows, a width and optional height in pixels must also be specified. If height is missing the width is used. For DrawArrow(), the directions available for the direction argument are:
Cvo_NORTH
Cvo_SOUTH
Cvo_EAST
Cvo_WEST
Functions dealing with text and fonts are:
Cvo_TextAttribute *TextAttribute (
)
This function returns the basic text attribute used in this object.
Cvo_TextAttribute *NewTextAttribute (
[ { char *resource | XrmQuark *resource } ] )
This function is used to create a new text attribute. If resource is not provided the new text attribute starts out as a copy of the basic text attribute, otherwise resource is used to load defaults from the X resource database. All the standard Cvo_Font resources apply with the additional resources of:
foreground
(class: Foreground
) Name of foreground color to use.
background
(class: Background
) Name of background color to use.
underline
(class: Underline
) Cause the text to be underlined.
enbolden
(class: Enbolden
) Cause the text to be enboldened.
DrawString (
int x,
int y,
{ char | wchar_t } *string,
[ int length ] )
ImageString (
int x,
int y,
{ char | wchar_t } *string,
[ int length ] )
These functions are used to draw the text pointed to by string
which is either NULL
terminated or length characters long at the
position (x,y). Position (x,y) refers to the upper left corner of the
first glyph.
The DrawString()
function only affects the pixels of the letters
themselves (i.e overstrike mode) while the ImageString()
function
affects the background as well.
StringWidth (
{ char | wchar_t } *string,
[ int length ] )
StringHeight (
{ char | wchar_t } *string,
[ int length ] )
These functions return the number of pixels which would be needed if string were to be drawn.
StringExtents (
{ char | wchar_t } *string,
[ int length ],
XRectangle &ink,
[ XRectangle &logical ] )
This function returns the bounding boxes around the actual space which will be affected by string if it were to be drawn and the amount of space that must be reserved. The ink argument will contain the amount of space affected while the logical argument contains the amount of space required.
DrawStrings (
int mode,
int x,
int y,
int width,
int height,
{ char | wchar_t } *string,
[ int length ] )
This function draws multiple strings separated by newlines. Each
string must be either NULL
terminated or length characters long.
Each line is drawn below the previous line. Vertically, the lines are
centered between y and y + height. Horizontally, the lines are either
centered, left justified or right justified depending on mode. If
mode is Cvo_LEFT_JUSTIFY
it will be left justified, if it is
Cvo_RIGHT_JUSTIFY
the lines will be right justified, otherwise the lines
will be centered.
StringsExtents (
{ char | wchar_t } *string,
int length,
XRectangle &logical )
This function returns the bounding box around the lines defined in string.
Functions dealing with the Graphics Context (please see the standard X11 documentation for more details on the arguments of these functions)
SetArcMode (
int arc_mode )
SetClipMask (
Pixmap clip_mask )
SetClipOrigin (
int clip_x_origin,
int clip_y_origin )
SetClipRectangles (
int clip_x_origin,
int clip_y_origin,
XRectangle rectangles[ ],
int nrects,
int ordering )
Note that this function does not adjust the value in rectangles, so these must be specified with X's idea of origin as opposed to Cvo's.
SetDashes (
int dash_offset,
char dash_list[ ],
int n )
SetFillRule (
int fill_rule )
SetFillStyle (
int fill_style )
This function also may change the stipple and fill style of the Graphics Context to allow color to be represented on a monochrome workstation.
This function does not affect the fill style or stipple.
SetFunction (
int function )
SetGraphicsExposures (
BOOL graphics_exposures )
SetLineAttributes (
unsigned int line_width,
int line_style,
int cap_style,
int join_style )
SetPlaneMask (
unsigned long plane_mask )
SetRegion (
Region r )
SetStipple (
Pixmap stipple )
SetSubwindowMode (
int subwindow_mode )
SetTile (
Pixmap tile )
SetTSOrigin (
int ts_x_origin,
int ts_y_origin )
Functions which allow access to standard Xlib functions. (Please see the standard X11 documentation for more details on the arguments of these functions.)
DrawLine (
int x1,
int y1,
int x2,
int y2 )
DrawPoint (
int x,
int y )
DrawArc (
int x,
int y,
int width,
int height,
int angle1,
int angle2 )
DrawRectangle (
int x,
int y,
int width,
int height )
FillArc (
int x,
int y,
int width,
int height,
int angle1,
int angle2 )
FillRectangle (
int x,
int y,
int width,
int height )
ClearArea (
int x,
int y,
int width,
int height,
[ BOOL exposures ] )
The exposures argument defaults to False
.
ClearWindow (
)
This only clears the usable area of the window. It will not affect the chamfers or pads.
CopyArea (
int src_x,
int src_y,
int width,
int height,
int dest_x,
int dest_y )
This function assumes both the source and the destination are the current window.
PutImage (
XImage ximage,
[ int src_x, int src_y ],
int dst_x,
int dst_y,
int width,
int height )
If src_x and src_y are not given, they default to (0,0).
MoveWindow (
int x,
int y,
[ int tag ] )
ResizeWindow (
int width,
int height,
[ int tag ] )
MoveResizeWindow (
int x,
int y,
int width,
int height,
[ int tag ] )
In these functions the tag argument can be used to let the
CvoMovedEvent
and CvoResizeEvent
event handlers know why
the window was moved/resized.
RaiseWindow (
)
LowerWindow (
)
This object defines the following Cvo Events in addition to those defined by its parent and ancestor objects.
CvoMovedEvent
struct
Cvo_MovedEvent
int old_x,
int old_y,
int new_x,
int new_y,
int tag
This event is generated whenever a window is moved. The tag element is either user defined or one of the following:
CvoResizeEvent
struct
Cvo_ResizeEvent
int old_width,
int old_height,
int new_width,
int new_height,
int tag
This event is generated whenever a window is resized. The tag element is either user defined or one of the following:
This object uses the following X resources in addition to those used by its parent and ancestor objects.
*CvoWindow.background
(class:
Background
) (default value:
black
)
*CvoWindow.borderColor
(class:
Foreground
)
*CvoWindow.borderWidth
(class:
BorderWidth
)
*CvoWindow.chamfer
(class:
Chamfer
)
*CvoWindow.enbolden
(class:
Enbolden
)
*CvoWindow.etched
(class:
Etched
)
*CvoWindow.foreground
(class:
Foreground
)
*CvoWindow.moat
(class:
Moat
)
*CvoWindow.moatChamfer
(class:
MoatChamfer
)
*CvoWindow.moatEdge
(class:
MoatEdge
)
*CvoWindow.pixmapFile
(class:
PixmapFile
)This resource value specifies the file which will be used to retrieve a pixmap image. This is used by the Cvo_Image object.
*CvoWindow.raise
(class:
Raise
)
*CvoWindow.reverseVideo
(class:
ReverseVideo
)
*CvoWindow.sunken
(class:
Sunken
)
*CvoWindow.underline
(class:
Underline
)See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.