|
Modules | |
| Frame widget | |
| Basic frame widget | |
| Button widget | |
| Check box widget | |
| Radio button widget | |
| Slider widget | |
| Label widget | |
| Progress bar widget | |
Typedefs | |
| typedef uint16_t | wtk_string_size_t |
| Datatype holding size of strings. | |
Functions | |
| uint8_t | wtk_rescale_value (uint8_t value, uint8_t from_scale, uint8_t to_scale) |
| Rescale 8-bit value. | |
| void | wtk_copy_string (char *dest, char const *source) |
| void | wtk_shade_pixel (gfx_color_t *pixel, uint8_t alpha) |
|
| |
| typedef uint8_t | wtk_radio_group_size_t |
| Datatype holding reference count for radio button groups. | |
| #define | WTK_RADIOBUTTON_RADIUS 4 |
| Radius of radio button circle. | |
| #define | WTK_RADIOBUTTON_BUTTON_X (WTK_RADIOBUTTON_RADIUS) |
| Radio button circle center X offset. | |
| #define | WTK_RADIOBUTTON_BUTTON_Y (WTK_RADIOBUTTON_RADIUS) |
| Radio button circle center Y offset. | |
| #define | WTK_RADIOBUTTON_CAPTION_X ((WTK_RADIOBUTTON_RADIUS * 2) + 4) |
| Radio button caption text X offset. | |
| #define | WTK_RADIOBUTTON_CAPTION_Y 0 |
| Radio button caption text Y offset. | |
| #define | WTK_RADIOBUTTON_BUTTON_COLOR GFX_COLOR(0, 0, 0) |
| Radio button circle color. | |
| #define | WTK_RADIOBUTTON_SELECT_COLOR GFX_COLOR(128, 0, 0) |
| Radio button select mark color. | |
| #define | WTK_RADIOBUTTON_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Radio button caption text color. | |
|
| |
| #define | WTK_FRAME_TOPBORDER 2 |
| Top frame border size. | |
| #define | WTK_FRAME_BOTTOMBORDER 4 |
| Bottom frame border size. | |
| #define | WTK_FRAME_RESIZE_RADIUS 7 |
| Radius of resize handle (second quadrant of circle). | |
| #define | WTK_FRAME_RESIZE_WIDTH (WTK_FRAME_RESIZE_RADIUS + 1) |
| Width of resize handle. | |
| #define | WTK_FRAME_RESIZE_HEIGHT (WTK_FRAME_RESIZE_RADIUS + 1) |
| Height of resize handle. | |
| #define | WTK_FRAME_MIN_WIDTH (WTK_FRAME_RESIZE_WIDTH - WTK_FRAME_RIGHTBORDER) |
| Minimum width of contents window of a frame. | |
| #define | WTK_FRAME_MIN_HEIGHT (WTK_FRAME_RESIZE_HEIGHT - WTK_FRAME_BOTTOMBORDER) |
| Minimum height of contents window of a frame. | |
| #define | WTK_FRAME_TITLEBAR_HEIGHT 9 |
| Height of titlebar area. | |
| #define | WTK_FRAME_CAPTION_X 3 |
| Caption text X offset inside title bar. | |
| #define | WTK_FRAME_CAPTION_Y 1 |
| Caption text Y offset inside title bar. | |
| #define | WTK_FRAME_BACKGROUND_COLOR GFX_COLOR(192, 192, 128) |
| Background color of frame contents window. | |
| #define | WTK_FRAME_BORDER_COLOR GFX_COLOR(240, 240, 240) |
| Frame border color. | |
| #define | WTK_FRAME_TITLEBAR_COLOR GFX_COLOR(128, 128, 255) |
| Background color of frame title bar. | |
| #define | WTK_FRAME_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Caption text foreground color. | |
| #define | WTK_FRAME_RESIZE_COLOR GFX_COLOR(64, 192, 192) |
| Resize handle color. | |
| #define | WTK_FRAME_SHADESIZE 4 |
| Size of drop shadow area outside left/bottom/right border. 0 = no shadow. | |
| #define | WTK_FRAME_SHADES { 252, 242, 220, 180 } |
| Shade factor of drop shadow, first number is farthest from border. | |
| #define | WTK_DRAG_THRESHOLD 4 |
| Distance from origin before dragging operation kicks in. | |
| #define | WTK_DRAG_HANDLE_RADIUS 4 |
| Radius of drag origin and target handles. | |
| #define | WTK_DRAG_PIXMAP_SIZE (WTK_DRAG_HANDLE_RADIUS * 2 + 1) |
| Pixmap pixel count for storing drag handle background graphics. | |
| #define | WTK_DRAG_ORIGIN_COLOR GFX_COLOR(255, 0, 0) |
| Drag origin handle color. | |
| #define | WTK_DRAG_TARGET_COLOR GFX_COLOR(0, 255, 0) |
| Drag target handle color. | |
|
| |
| #define | WTK_BUTTON_BACKGROUND_COLOR GFX_COLOR(128, 128, 128) |
| Color of button background (text color when highlighted). | |
| #define | WTK_BUTTON_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Color of button text (background color when highlighted). | |
|
| |
| #define | WTK_CHECKBOX_BOX_X 0 |
| Checkbox square X offset. | |
| #define | WTK_CHECKBOX_BOX_Y 0 |
| Checkbox square Y offset. | |
| #define | WTK_CHECKBOX_CAPTION_X (WTK_CHECKBOX_BOX_SIZE + 4) |
| Checkbox caption text X offset. | |
| #define | WTK_CHECKBOX_CAPTION_Y 0 |
| Checkbox caption text Y offset. | |
| #define | WTK_CHECKBOX_BOX_COLOR GFX_COLOR(0, 0, 0) |
| Checkbox square frame color. | |
| #define | WTK_CHECKBOX_SELECT_COLOR GFX_COLOR(128, 0, 0) |
| Checkbox square select mark color. | |
| #define | WTK_CHECKBOX_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Checkbox caption text color. | |
|
| |
| #define | WTK_SLIDER_KNOB_WIDTH 10 |
| Width of the slider knob, including borders, in pixels. | |
| #define | WTK_SLIDER_BORDER_COLOR GFX_COLOR(0, 0, 0) |
| Color of all the slider's borders. | |
| #define | WTK_SLIDER_BACKGROUND_COLOR GFX_COLOR(128, 128, 128) |
| Color of the slider's background. | |
| #define | WTK_SLIDER_KNOB_COLOR_NORMAL GFX_COLOR(128, 0, 0) |
| Color of the slider knob when normal. | |
| #define | WTK_SLIDER_KNOB_COLOR_MOVING GFX_COLOR(255, 255, 255) |
| Color of the slider knob when moving. | |
The Widget toolkit implements many common widgets for use on a graphical display using the functionality of Window system and Graphics library
The following widgets are implemented:
| #define WTK_BUTTON_BACKGROUND_COLOR GFX_COLOR(128, 128, 128) |
Color of button background (text color when highlighted).
Definition at line 192 of file wtk.h.
Referenced by wtk_button_handler().
| #define WTK_BUTTON_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Color of button text (background color when highlighted).
Definition at line 197 of file wtk.h.
Referenced by wtk_button_handler().
| #define WTK_CHECKBOX_BOX_COLOR GFX_COLOR(0, 0, 0) |
Checkbox square frame color.
Definition at line 234 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_BOX_X 0 |
Checkbox square X offset.
Definition at line 214 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_BOX_Y 0 |
Checkbox square Y offset.
Definition at line 219 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Checkbox caption text color.
Definition at line 244 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_CAPTION_X (WTK_CHECKBOX_BOX_SIZE + 4) |
Checkbox caption text X offset.
Definition at line 224 of file wtk.h.
Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().
| #define WTK_CHECKBOX_CAPTION_Y 0 |
Checkbox caption text Y offset.
Definition at line 229 of file wtk.h.
Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().
| #define WTK_CHECKBOX_SELECT_COLOR GFX_COLOR(128, 0, 0) |
Checkbox square select mark color.
Definition at line 239 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_DRAG_HANDLE_RADIUS 4 |
Radius of drag origin and target handles.
Definition at line 160 of file wtk.h.
Referenced by wtk_continue_drag(), wtk_start_drag(), and wtk_stop_drag().
| #define WTK_DRAG_ORIGIN_COLOR GFX_COLOR(255, 0, 0) |
| #define WTK_DRAG_PIXMAP_SIZE (WTK_DRAG_HANDLE_RADIUS * 2 + 1) |
Pixmap pixel count for storing drag handle background graphics.
Definition at line 165 of file wtk.h.
Referenced by wtk_continue_drag(), wtk_start_drag(), and wtk_stop_drag().
| #define WTK_DRAG_TARGET_COLOR GFX_COLOR(0, 255, 0) |
Drag target handle color.
Definition at line 175 of file wtk.h.
Referenced by wtk_continue_drag(), and wtk_start_drag().
| #define WTK_DRAG_THRESHOLD 4 |
Distance from origin before dragging operation kicks in.
Definition at line 155 of file wtk.h.
Referenced by wtk_is_drag_threshold_exceeded().
| #define WTK_FRAME_BACKGROUND_COLOR GFX_COLOR(192, 192, 128) |
| #define WTK_FRAME_BORDER_COLOR GFX_COLOR(240, 240, 240) |
| #define WTK_FRAME_BOTTOMBORDER 4 |
Bottom frame border size.
Definition at line 75 of file wtk.h.
Referenced by wtk_frame_handler(), and wtk_resize_frame().
| #define WTK_FRAME_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Caption text foreground color.
Definition at line 135 of file wtk.h.
Referenced by wtk_frame_handler().
| #define WTK_FRAME_CAPTION_X 3 |
Caption text X offset inside title bar.
Definition at line 110 of file wtk.h.
Referenced by wtk_frame_handler().
| #define WTK_FRAME_CAPTION_Y 1 |
Caption text Y offset inside title bar.
Definition at line 115 of file wtk.h.
Referenced by wtk_frame_handler().
| #define WTK_FRAME_MIN_HEIGHT (WTK_FRAME_RESIZE_HEIGHT - WTK_FRAME_BOTTOMBORDER) |
Minimum height of contents window of a frame.
Definition at line 100 of file wtk.h.
Referenced by wtk_resize_frame().
| #define WTK_FRAME_MIN_WIDTH (WTK_FRAME_RESIZE_WIDTH - WTK_FRAME_RIGHTBORDER) |
Minimum width of contents window of a frame.
Definition at line 95 of file wtk.h.
Referenced by wtk_resize_frame().
| #define WTK_FRAME_RESIZE_COLOR GFX_COLOR(64, 192, 192) |
| #define WTK_FRAME_RESIZE_HEIGHT (WTK_FRAME_RESIZE_RADIUS + 1) |
Height of resize handle.
Definition at line 90 of file wtk.h.
Referenced by wtk_frame_create(), and wtk_resize_frame().
| #define WTK_FRAME_RESIZE_RADIUS 7 |
Radius of resize handle (second quadrant of circle).
Definition at line 80 of file wtk.h.
Referenced by wtk_frame_handler().
| #define WTK_FRAME_RESIZE_WIDTH (WTK_FRAME_RESIZE_RADIUS + 1) |
Width of resize handle.
Definition at line 85 of file wtk.h.
Referenced by wtk_frame_create(), and wtk_resize_frame().
| #define WTK_FRAME_SHADES { 252, 242, 220, 180 } |
| #define WTK_FRAME_SHADESIZE 4 |
Size of drop shadow area outside left/bottom/right border. 0 = no shadow.
Definition at line 145 of file wtk.h.
Referenced by wtk_resize_frame().
| #define WTK_FRAME_TITLEBAR_COLOR GFX_COLOR(128, 128, 255) |
Background color of frame title bar.
Definition at line 130 of file wtk.h.
Referenced by wtk_frame_handler().
| #define WTK_FRAME_TITLEBAR_HEIGHT 9 |
Height of titlebar area.
Definition at line 105 of file wtk.h.
Referenced by wtk_frame_create(), wtk_frame_handler(), and wtk_resize_frame().
| #define WTK_FRAME_TOPBORDER 2 |
Top frame border size.
Definition at line 70 of file wtk.h.
Referenced by wtk_frame_create(), wtk_frame_handler(), and wtk_resize_frame().
| #define WTK_RADIOBUTTON_BUTTON_COLOR GFX_COLOR(0, 0, 0) |
Radio button circle color.
Definition at line 284 of file wtk.h.
Referenced by wtk_radio_button_handler().
| #define WTK_RADIOBUTTON_BUTTON_X (WTK_RADIOBUTTON_RADIUS) |
Radio button circle center X offset.
Definition at line 264 of file wtk.h.
Referenced by wtk_radio_button_handler().
| #define WTK_RADIOBUTTON_BUTTON_Y (WTK_RADIOBUTTON_RADIUS) |
Radio button circle center Y offset.
Definition at line 269 of file wtk.h.
Referenced by wtk_radio_button_handler(), and wtk_radio_button_size_hint().
| #define WTK_RADIOBUTTON_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Radio button caption text color.
Definition at line 294 of file wtk.h.
Referenced by wtk_radio_button_handler().
| #define WTK_RADIOBUTTON_CAPTION_X ((WTK_RADIOBUTTON_RADIUS * 2) + 4) |
Radio button caption text X offset.
Definition at line 274 of file wtk.h.
Referenced by wtk_radio_button_handler(), and wtk_radio_button_size_hint().
| #define WTK_RADIOBUTTON_CAPTION_Y 0 |
Radio button caption text Y offset.
Definition at line 279 of file wtk.h.
Referenced by wtk_radio_button_handler(), and wtk_radio_button_size_hint().
| #define WTK_RADIOBUTTON_RADIUS 4 |
Radius of radio button circle.
Definition at line 259 of file wtk.h.
Referenced by wtk_radio_button_handler(), and wtk_radio_button_size_hint().
| #define WTK_RADIOBUTTON_SELECT_COLOR GFX_COLOR(128, 0, 0) |
Radio button select mark color.
Definition at line 289 of file wtk.h.
Referenced by wtk_radio_button_handler().
| #define WTK_SLIDER_BACKGROUND_COLOR GFX_COLOR(128, 128, 128) |
Color of the slider's background.
Definition at line 329 of file wtk.h.
Referenced by wtk_slider_handler().
| #define WTK_SLIDER_BORDER_COLOR GFX_COLOR(0, 0, 0) |
Color of all the slider's borders.
Definition at line 324 of file wtk.h.
Referenced by wtk_slider_handler().
| #define WTK_SLIDER_KNOB_COLOR_MOVING GFX_COLOR(255, 255, 255) |
Color of the slider knob when moving.
Definition at line 339 of file wtk.h.
Referenced by wtk_slider_handler().
| #define WTK_SLIDER_KNOB_COLOR_NORMAL GFX_COLOR(128, 0, 0) |
Color of the slider knob when normal.
Definition at line 334 of file wtk.h.
Referenced by wtk_slider_handler().
| #define WTK_SLIDER_KNOB_WIDTH 10 |
Width of the slider knob, including borders, in pixels.
Definition at line 319 of file wtk.h.
Referenced by wtk_slider_create(), wtk_slider_handler(), and wtk_slider_set_value().
| typedef uint8_t wtk_radio_group_size_t |
| typedef uint16_t wtk_string_size_t |
| void wtk_copy_string | ( | char * | dest, | |
| char const * | source | |||
| ) |
This function copies the string contents, including the zero terminator, from source to destination. The caller is responsible for providing memory for the destination string, either on the stack, static, or dynamically allocated.
| dest | Destination string. | |
| source | Source string, zero terminated. |
Referenced by wtk_button_create(), wtk_check_box_create(), wtk_frame_create(), wtk_label_change(), wtk_label_create(), and wtk_radio_button_create().
Rescale 8-bit value.
For internal use only.
This function is used by, e.g., the slider widget for computing the slider knob position from a given value and vice versa. It returns a value with the same data width as the input, meaning value cannot exceed from_scale, or overflows will occur.
The formula is:
new_value = (value / from_scale) * to_scale
| value | Value to rescale. | |
| from_scale | Maximum of old scale for value. | |
| to_scale | Maximum of scale for new value. |
Referenced by wtk_progress_bar_create(), wtk_progress_bar_set_value(), wtk_slider_create(), wtk_slider_handler(), and wtk_slider_set_value().
| void wtk_shade_pixel | ( | gfx_color_t * | pixel, | |
| uint8_t | alpha | |||
| ) |
This function shades one pixel. Alpha equal to 0 gives a black pixel. Alpha equal to 255 gives an untouched pixel.
| pixel | Pointer to pixel to shade. | |
| alpha | Shade value. Lower value gives blacker pixel. |
1.6.3