panel_text_notify()
Default notify procedure for panel text items. Determines what the correct
Panel_setting value should be based on the event passed into the notify proce-
dure. The Panel_setting value causes the PANEL_TEXT package to adjust the
caret to advance on Return or Tab, caret to back up on Shift-Return or Shift-Tab, print-
able characters to be inserted into item’s value, and all other characters to be dis-
carded.
Panel_setting
panel_text_notify(item, event)
Panel_item item
Event *event
Returns PANEL_NEXT, PANEL_PREVIOUS, PANEL_INSERT, or PANEL_NONE, respec-
tively.
PANEL_TOGGLE
Macro for “PANEL_CHOICE, PANEL_CHOOSE_ONE, FALSE.” Used to create non-
exclusive choice item(s).
xv_create(panel, PANEL_TOGGLE, NULL);
PANEL_TOGGLE expands to:
PANEL_CHOICE,
PANEL_CHOOSE_ONE, FALSE
To use an ATTR_LIST argument, the ATTR_LIST must be the first attribute in an attri-
bute-value list. See PANEL_CHOICE_STACK for an example.
rect_below()
Returns TRUE if r2 lies below r1 AND the left edge of r2 isn’t greater than the right
edge of r1 AND the right edge isn’t less than the left edge of r1.
int
rect_below( r1, r2 )
Rect *r1, *r2;
rect_borderadjust()
Used to adjust the borders. This macro takes a rect pointer and an int. This macro
is defined as follows:
#define rect_borderadjust(r,m) \
{ (r)->r_width+=(m)+(m);(r)->r_height+=(m)+(m);}
rect_bottom()
Takes a rect pointer and returns the position of the bottom of the rect. This macro
is defined as follows:
#define rect_bottom(rect) ((rect)->r_top+(rect)->r_height-1)
200 XView Reference Manual
rect_bounding()
Return the rectangle that defines the region bound by rectangle r1 and r2.
struct rect
rect_bounding( r1, r2 )
struct rect *r1, *r2;
rect_clipvector()
Clip vector defined by coordinates x1y1,x2y2 to space within rectangle r; returns
TRUE if original vector resides within rectangle.
unsigned
rect_clipvector( r, x1, y1, x2, y2 )
struct rect *r;
int x1, y1, x2, y2;
rect_construct( )
Constructs a rect based on the values specified. It takes a rect pointer and four
int arguments. This macro is defined as follows:
#define rect_construct(r,x,y,w,h) \
{(r)->r_left=(x);(r)->r_top=(y);(r)->r_width=(w);(r)->r_height=(h);}
rect_distance()
Compute the distance from coordinate xy to rectangle. If xy is inside rectangle, 0 is
returned. If x_used or y_used are non-zero, then the projection point is returned.
int
rect_distance( rect, x, y, x_used, y_used )
Rect *rect;
int x, y;
int x_used, y_used;
rect_equal()
Compares two rect pointers and returns TRUE if all dimensions are equal. This macro
is defined as follows:
#define rect_equal(r1,r2) \
((r1)->r_left==(r2)->r_left && (r1)->r_width==(r2)->r_width && \
(r1)->r_top==(r2)->r_top && (r1)->r_height==(r2)->r_height)
rect_includespoint()
Returns TRUE if specified coordinates are within specified rect. It takes a rect
pointer and two integers (x and y coordinates). This macro is defined as follows:
#define rect_includespoint(r,x,y) \
((x) >= (r)->r_left && (y) >= (r)->r_top && \
(x)<(r)->r_left+(r)->r_width && (y)<(r)->r_top+(r)->r_height)
Procedures and Macros
Procedures and Macros 201
rect_includesrect( )
Determines whether or not a specified rect is contained in another. It takes two
rect pointers. This macro is defined as follows:
#define rect_includesrect(r1, r2) \
((r1)->r_left <= (r2)->r_left && (r1)->r_top <= (r2)->r_top && \
(r1)->r_left+(r1)->r_width >= (r2)->r_left+(r2)->r_width && \
(r1)->r_top+(r1)->r_height >= (r2)->r_top+(r2)->r_height)
rect_intersection()
Calculates the intersection of rectangles r1 and r2 and returns the resulting rectangle
r.
struct rect
rect_intersection( r1, r2, r )
Rect *r1, *r2, *r;
rect_intersectsrect()
Determines whether or not one rect intersects another. It takes two rect pointers.
This macro is defined as follows:
#define rect_intersectsrect(r1,r2) \
((r1)->r_left<(r2)->r_left+(r2)->r_width && \
(r1)->r_top<(r2)->r_top+(r2)->r_height && \
(r2)->r_left<(r1)->r_left+(r1)->r_width && \
(r2)->r_top<(r1)->r_top+(r1)->r_height)
rect_isnull( )
Takes a rect pointer and returns TRUE if either the width or the height of the rect is 0.
Otherwise returns FALSE. This macro is defined as follows:
#define rect_isnull(r) ((r)->r_width == 0 || (r)->r_height == 0
rect_marginadjust( )
Adjusts the margins in a rect. It takes a rect pointer and an integer. This macro is
defined as follows:
#define rect_marginadjust(r,m) \
{ (r)->r_left-=(m);(r)->r_top-=(m); \
(r)->r_width+=(m)+(m);(r)->r_height+=(m)+(m);}
202 XView Reference Manual
rect_order( )
Return TRUE if rectangles r1 and r2 are in specified sort order. Where sort order is
defined by:
RECTS_TOPTOBOTTOM: returns TRUE if r1 top <= r2 top
RECTS_BOTTOMTOTOP: returns TRUE if r1 bottom >= r2 bottom
RECTS_LEFTORIGHT: returns TRUE if r1 left <= r2 left
RECTS_RIGHTTOLEFT: returns TRUE if r1 right >= r2 right
RECTS_UNSORT: returns TRUE
unsigned
rect_order( r1, r2, sortorder )
struct rect *r1, *r2;
int sortorder;
rect_passtochild( )
Takes two integers (x and y coordinates) and a rect pointer. This macro is defined as
follows:
#define rect_passtochild(x,y,rect) \
{(rect)->r_left=(rect)->r_left-(x); (rect)->r_top=(rect)->r_top-(y);}
rect_passtoparent()
Takes two integers (x and y coordinates) and a rect pointer. This macro is defined as
follows:
#define rect_passtoparent(x,y,rect) \
{(rect)->r_left=(rect)->r_left+(x); (rect)->r_top=(rect)->r_top+(y);}
rect_print()
Takes a rect pointer and prints the rectangle on stderr.
#define rect_print(rect)
\
(void)fprintf(stderr,"[left: %d, top: %d, width: %d, height: %d]0,
\
(rect)->r_left, (rect)->r_top, (rect)->r_width, (rect)->r_height)
rect_right()
Takes a rect pointer and returns the position of the right edge of the rect. This
macro is defined as follows:
#define rect_right(rect) ((rect)->r_left+(rect)->r_width-1)
rect_right_of()
Returns TRUE if r2 lies to the right of r1 AND the bottom of r2 isn’t above the top of
r1 AND the top of r2 isn’t below the bottom of r1.
int
rect_right_of( r1, r2 )
Rect *r1, *r2;
Procedures and Macros
Procedures and Macros 203
rect_sizes_differ()
Takes two rect pointers. If all dimensions are equal, it returns FALSE, if not it returns
TRUE. This macro is defined as follows:
#define rect_sizes_differ(r1, r2) \
((r1)->r_width != (r2)->r_width || (r1)->r_height != (r2)->r_height)
SCROLLABLE_PANEL
Used to create a scrollbar panel. To add a scrollbar after creating the panel, create a
scrollbar with the panel as its parent. For example:
panel = xv_create(frame, SCROLLABLE_PANEL, NULL);
xv_create(panel, SCROLLBAR, NULL);
Note: Scrollable panels are not inherently OPENLOOK-compliant.
scrollbar_paint()
Repaints all portions of the scrollbar.
void
scrollbar_paint(scrollbar)
Scrollbar scrollbar;
selection_*
Appendix B, Selection Compatibility Procedures and Macros, describes the selec-
tion_* procedures. The selection_ procedures provide compatibility for appli-
cations using selections created prior to XView Version 3. If you are creating a new
application, refer to Chapter 18, Selections, in the XView Programming Manual.
sel_convert_proc()
Default selection convert procedure provided by XView Version 3 for use with the
SELECTION_OWNER package. This procedure allows the selection owner to communi-
cate with the selection requestor.
int
sel_convert_proc(sel_owner, type, data, length, format)
Selection_owner sel_owner;
Atom *type; /* Input/Output */
Xv_opaque *data;
unsigned long *length; /* Output */
int *format;
sel_owner is the selection owner. type is the form data should be converted to.
data is a pointer to the reply buffer. length is a pointer to the length of the reply
buffer.
format is a pointer to an integer representing the number of bits in a single data
member in reply buffer. Returns
TRUE if completed successfully, FALSE if it does not
complete successfully.
204 XView Reference Manual
Get Volume 7B: XView Reference Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.