51#include <mcp/syscalls.h>
59#define CONTROL_NO_GROUP -1
60#define CONTROL_MAX_CAPTION_SIZE 128
62#define CONTROL_ID_ERROR -2
63#define CONTROL_ID_NOT_FOUND -1
70typedef enum control_active_state
74} control_active_state;
76typedef enum control_pushed_state
78 CONTROL_NOT_PRESSED = 0,
80} control_pushed_state;
84 CONTROL_TYPE_ERROR = -1,
109typedef enum h_align_type
116typedef enum v_align_type
234int8_t Control_GetGroup(
Control* the_control);
243bool Control_GetVisible(
Control* the_control);
244bool Control_GetActive(
Control* the_control);
245bool Control_GetEnabled(
Control* the_control);
246int16_t Control_GetValue(
Control* the_control);
247int16_t Control_GetMinValue(
Control* the_control);
248int16_t Control_GetMaxValue(
Control* the_control);
252char* Control_GetCaption(
Control* the_control);
254bool Control_SetID(
Control* the_control, uint16_t the_new_id);
256bool Control_SetGroup(
Control* the_control, int16_t the_group_id);
264bool Control_SetParent(
Control* the_control,
Window* the_window);
283bool Control_SetEnabled(
Control* the_control,
bool is_enabled);
284bool Control_SetValue(
Control* the_control, int16_t the_value);
285bool Control_SetMinValue(
Control* the_control, int16_t the_value);
286bool Control_SetMaxValue(
Control* the_control, int16_t the_value);
287bool Control_SetImageUp(
Control* the_control,
Bitmap* the_image);
288bool Control_SetImageDown(
Control* the_control,
Bitmap* the_image);
289bool Control_SetImageInactive(
Control* the_control,
Bitmap* the_image);
290bool Control_SetCaption(
Control* the_control,
char* the_text);
void Control_SetPressed(Control *the_control, bool is_pressed)
Set the control's pressed/unpressed state.
Definition: control.c:454
control_type Control_GetType(Control *the_control)
Get the control type.
Definition: control.c:622
void Control_SetActive(Control *the_control, bool is_active)
Set the control's active/inactive state.
Definition: control.c:430
bool Control_IsRighter(Control *the_control, int16_t *x)
Compare the control's right-edge coordinate to the passed value If the control is more to the right t...
Definition: control.c:662
Control * Control_GetNextControl(Control *the_control)
Get the next control in the chain.
Definition: control.c:603
bool Control_SetNextControl(Control *the_control, Control *the_next_control)
Links the control to the next control passed.
Definition: control.c:409
bool Control_UpdateFromTemplate(Control *the_control, ControlTemplate *the_template)
Updates the passed control with new theme info from the passed control template Call this when the th...
Definition: control.c:352
void Control_Render(Control *the_control)
Blits the control to the control's parent window if the control is visible, and if it is listed as in...
Definition: control.c:718
bool Control_IsLefter(Control *the_control, int16_t *x)
Compare the control's left-edge coordinate to the passed value If the control is more to the left tha...
Definition: control.c:688
control_type
Definition: control.h:83
@ LABEL
proportional control for handling vertical scrolling within a defined area
Definition: control.h:98
@ SIZE_NORMAL
standard system control; the minimize widget of a window. do not add outside of the context of a wind...
Definition: control.h:94
@ IMAGE_BUTTON
multi-line text input field
Definition: control.h:91
@ TEXT_FIELD
flexible-width button with text caption
Definition: control.h:86
@ FUTURE_GROW_R
not sure these will be treated as generic controls, but reserving the id
Definition: control.h:100
@ RADIO_BUTTON
flexible-width single-line text input field
Definition: control.h:87
@ CLOSE_WIDGET
a fixed height/width button control with no caption, up/down states, and a no defined shape in the th...
Definition: control.h:92
@ SIZE_MAXIMIZE
standard system control; the normal-size widget of a window. do not add outside of the context of a w...
Definition: control.h:95
@ H_SCROLLER
standard system control; the maximize widget of a window. do not add outside of the context of a wind...
Definition: control.h:96
@ V_SCROLLER
proportional control for handling horizontal scrolling within a defined area
Definition: control.h:97
@ FUTURE_GROW_UP
not sure these will be treated as generic controls, but reserving the id
Definition: control.h:101
@ CUSTOM
image?
Definition: control.h:105
@ SIZE_MINIMIZE
standard system control; the close widget of a window. do not add outside of the context of a window ...
Definition: control.h:93
@ TEXT_BOX
the titlebar of a window
Definition: control.h:90
@ TEXT_BUTTON
for functions that return a control type, this value will be returned in the event of an error
Definition: control.h:85
@ FUTURE_GROW_L
static text label
Definition: control.h:99
@ TITLEBAR
checkbox control. do not assign the same group id to each control, as checkboxes are not mutually exc...
Definition: control.h:89
@ RESERVED1x
not sure these will be treated as generic controls, but reserving the id
Definition: control.h:103
@ CHECKBOX
mutually-exclusive radio button control, assign each control in the set the same group id
Definition: control.h:88
@ FUTURE_GROW_DN
not sure these will be treated as generic controls, but reserving the id
Definition: control.h:102
@ RESERVED2x
progress bar?
Definition: control.h:104
Control * Control_New(ControlTemplate *the_template, Window *the_window, Rectangle *the_parent_rect, int16_t control_id, int16_t group_id)
Allocate a Control object.
Definition: control.c:215
bool Control_GetPressed(Control *the_control)
Get the pressed/not pressed state.
Definition: control.c:641
bool Control_Destroy(Control **the_control)
Frees all allocated memory associated with the passed object, and the object itself.
Definition: control.c:312
int16_t Control_GetID(Control *the_control)
Get the ID of the control.
Definition: control.c:584
void Control_AlignToParentRect(Control *the_control)
Set or uppdate the control's position and/or size as appropriate to the control's parent rect Call wh...
Definition: control.c:500
void Control_MarkInvalidated(Control *the_control, bool invalidated)
Mark the specified control is invalidated or validated Note: Marking a control as invalidated causes ...
Definition: control.c:479
This structure describes an instantiated control on a window.
Definition: control.h:130
bool visible_
height of the control
Definition: control.h:144
bool invalidated_
is the control currently in a clicked/pushed/depressed state or not. Drives rendering choice....
Definition: control.h:148
h_align_type h_align_
coordinates relative to the parent window (ie, these are not global coordinates)
Definition: control.h:138
int16_t y_offset_
horizontal coordinate relative to the parent window's left or right edge. If h_align_ is H_ALIGN_CENT...
Definition: control.h:141
int16_t min_
current value of the control
Definition: control.h:150
int16_t width_
vertical coordinate relative to the parent window's top or bottom edge. If v_align_ is V_ALIGN_CENTER...
Definition: control.h:142
int16_t avail_text_width_
optional string to draw centered horizontally and vertically on the control. Typical use cases includ...
Definition: control.h:154
int16_t max_
minimum allowed value
Definition: control.h:151
Window * parent_win_
next control in the list
Definition: control.h:135
v_align_type v_align_
whether the control should be positioned relative to the left side, right side, or centered
Definition: control.h:139
int16_t x_offset_
whether the control should be positioned relative to the top edge, bottom edge, or centered
Definition: control.h:140
bool enabled_
is the control activated or not (in appearance). Does not affect ability to receive events.
Definition: control.h:146
Rectangle rect_
parent rectangle (the window segment it belongs to: titlebar, contentarea, iconbar
Definition: control.h:137
Control * next_
button vs checkbox vs radio button, etc.
Definition: control.h:134
bool pressed_
is the control enabled or not. If not enabled, it will not receive events.
Definition: control.h:147
int16_t id_
group number, if this control is part of a group of controls. -1 (no group) is default....
Definition: control.h:132
int16_t height_
width of the control
Definition: control.h:143
Rectangle * parent_rect_
parent window
Definition: control.h:136
char * caption_
4 image state bitmaps: [active yes/no][pushed down yes/no]
Definition: control.h:153
control_type type_
used to identify the control in the control list, etc.
Definition: control.h:133
Bitmap * image_[2][2]
maximum allowed value
Definition: control.h:152
A structure that can be used to instantiate a ControlTemplate object instance in a window The Control...
Definition: control_template.h:69
Definition: a2560k.h:1369