2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #ifndef __gator_objects_h
11 #define __gator_objects_h 1
13 /*--------------------------------------------------------------------------------
16 * Constants and data structures defining the basis for a gator object.
17 *--------------------------------------------------------------------------------*/
19 #include "gtxwindows.h" /*Standard window defs & ops */
21 /*Max number of chars in an object name*/
22 #define GATOR_OBJNAMELEN 128
25 * The onode is the focus of all gator display activity. There is a unique
26 * onode for each gator object.
29 int o_type
; /*Object type */
30 char o_name
[GATOR_OBJNAMELEN
]; /*Object's string name */
31 int o_x
, o_y
; /*X and Y coordinates */
32 int o_width
, o_height
; /*Width & height in pixels */
33 int o_changed
; /*Changed since last refresh? */
34 short o_refcount
; /*Reference count */
35 struct gwin
*o_window
; /*Object's associated graphical window */
36 struct onodeops
*o_op
; /*Object's operations */
37 struct onode
*o_home
; /*Ptr to home object */
38 struct onode
*o_help
; /*Ptr to help object, if any */
39 struct onode
*o_nextobj
; /*Ptr to next queued object, if any */
40 struct onode
*o_upobj
; /*Ptr to parent (up) object, if any */
41 struct onode
*o_downobj
; /*Ptr to child (down) object, if any */
42 int *o_data
; /*Ptr to object's private data region */
46 * Operations on individual onodes. A pointer to this function array is
47 * attached to each onode. In reality, this array is different for each
48 * object type, holding additional operations specific to that object.
49 * However, every object must implement these functions in these first
53 int (*on_destroy
) (struct onode
*); /*Destroy an onode */
54 int (*on_display
) (struct onode
*); /*Display an onode */
55 int (*on_release
) (struct onode
*); /*Decrement an onode ref count */
59 * Macros facilitating the use of onode functions.
61 #define OOP_DESTROY(ONP) (ONP)->o_op->on_destroy(ONP);
62 #define OOP_DISPLAY(ONP) (ONP)->o_op->on_display(ONP);
63 #define OOP_RELEASE(ONP) (ONP)->o_op->on_release(ONP);
66 * Initialization parameters for an onode.
68 struct onode_initparams
{
69 int i_debug
; /*Turn debugging on? */
70 struct gwin_initparams
*i_gwparams
; /*Ptr to window init params */
74 * Creation parameters for an onode.
76 struct onode_createparams
{
77 int cr_type
; /*Type of onode */
78 char cr_name
[GATOR_OBJNAMELEN
]; /*Object name */
79 int cr_x
, cr_y
; /*X and Y coordinates */
80 int cr_width
, cr_height
; /*Width & height in pixels */
81 struct gwin
*cr_window
; /*Graphical window to use */
82 struct onode
*cr_home_obj
; /*Home object */
83 struct onode
*cr_prev_obj
; /*Object having this one as next */
84 struct onode
*cr_parent_obj
; /*This object's parent */
85 char *cr_helpstring
; /*Ptr to object's help text */
89 * Is debugging output enabled?
91 extern int objects_debug
;
93 extern int gator_objects_init(struct onode_initparams
*);
96 * Initialize the gator object package.
99 * struct onode_initparams *params: Initialization parameters.
103 * Error value otherwise.
106 extern struct onode
*gator_objects_create(struct onode_createparams
*params
);
109 * Create an onode of the given type.
112 * struct onode_createparams *params: Ptr to creation params.
115 * Ptr to newly-created onode if successful,
116 * Null pointer otherwise.
119 extern struct onode
*gator_objects_lookup(char *);
122 * Look up a gator onode by name.
125 * char *onode_name: Onode string name to find.
128 * Ptr to onode matching the given name if one exists,
129 * Null pointer otherwise.
132 #endif /* __gator_objects_h */