|
Typedefs | |
| typedef bool(* | wtk_frame_handler_t )(struct wtk_frame *frame, win_command_t command_data) |
| Frame command event handler callback. | |
Functions | |
| struct wtk_frame * | wtk_frame_create (struct win_window *parent, struct win_area const *area, char const *caption, bool allow_resize, wtk_frame_handler_t frame_handler, void *custom_data) |
| struct win_window * | wtk_frame_as_parent (struct wtk_frame *frame) |
| struct win_window * | wtk_frame_as_child (struct wtk_frame *frame) |
| void * | wtk_frame_get_custom_data (struct wtk_frame const *frame) |
|
| |
| static bool | wtk_frame_handler (struct win_window *win, enum win_event_type type, void const *data) |
|
| |
| #define | WTK_FRAME_RIGHTBORDER 2 |
| Left frame border size. | |
| #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. | |
Frame widget provides a frame with border and a title bar. It can be configured to be resizable and movable.
| #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_RIGHTBORDER 2 |
Left frame border size.
Right frame border size.
Definition at line 65 of file wtk.h.
Referenced by wtk_frame_handler(), 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().
| typedef bool(* wtk_frame_handler_t)(struct wtk_frame *frame, win_command_t command_data) |
| struct win_window* wtk_frame_as_child | ( | struct wtk_frame * | frame | ) | [read] |
This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.
| frame | Frame widget to manage. |
Definition at line 173 of file wtk_frame.c.
References assert, and wtk_frame::container.
| struct win_window* wtk_frame_as_parent | ( | struct wtk_frame * | frame | ) | [read] |
This function returns a reference to the window that should be used as a parent for child widgets and windows. This corresponds to the internal area inside borders and title bar.
| frame | Frame widget to be a parent. |
Definition at line 159 of file wtk_frame.c.
References assert, and wtk_frame::contents.
| struct wtk_frame* wtk_frame_create | ( | struct win_window * | parent, | |
| struct win_area const * | area, | |||
| char const * | caption, | |||
| bool | allow_resize, | |||
| wtk_frame_handler_t | frame_handler, | |||
| void * | custom_data | |||
| ) | [read] |
This function creates a new frame widget. It allocates required memory and intializes necessary windows to create the widget. If there is not enough memory, the function returns NULL.
To destroy the widget and all its contents, and free its memory, call win_destroy() on the frame's child reference, given by wtk_frame_as_child(), like this: "win_destroy(wtk_frame_as_child(my_frame_ptr));". The frame's internal area will equal the area parameter, but the total extents will be slightly larger, to accommodate for titlebar, borders etc.
| parent | Parent window. | |
| area | Area of the internal contents. | |
| caption | Pointer to caption string. Will be copied into widget. | |
| allow_resize | True if resize handle should be included on the frame. | |
| frame_handler | Optional command event handler, for applications. | |
| custom_data | Optional custom data link, for applications. |
Definition at line 1018 of file wtk_frame.c.
References win_attributes::area, assert, win_attributes::background, win_attributes::behavior, wtk_frame::caption, wtk_frame::container, wtk_frame::contents, win_attributes::custom, wtk_frame::custom_data, win_attributes::event_handler, frame, wtk_frame::frame_handler, membag_alloc(), membag_free(), win_area::pos, wtk_frame::resize, win_area::size, wtk_frame::state, strlen(), WIN_BEHAVIOR_RAISE_ON_PRESS, WIN_BEHAVIOR_REDRAW_PARENT, win_create(), win_destroy(), win_show(), wtk_copy_string(), wtk_frame_handler(), WTK_FRAME_NORMAL, WTK_FRAME_RESIZE_HEIGHT, WTK_FRAME_RESIZE_WIDTH, WTK_FRAME_TITLEBAR_HEIGHT, WTK_FRAME_TOPBORDER, and wtk_resize_frame().
| void* wtk_frame_get_custom_data | ( | struct wtk_frame const * | frame | ) |
This function returns the custom data from the frame's attributes. The custom data can be used for e.g. linking to associated applications.
| frame | Pointer to frame. |
Definition at line 187 of file wtk_frame.c.
References assert, and wtk_frame::custom_data.
| static bool wtk_frame_handler | ( | struct win_window * | win, | |
| enum win_event_type | type, | |||
| void const * | data | |||
| ) | [static] |
This function is the window event handler for frame widgets. It handles all events sent to the windows composing the widget.
| win | Window receiving the event. | |
| type | The event type. | |
| data | Custom data, depending on event type. |
Definition at line 764 of file wtk_frame.c.
References wtk_frame::caption, wtk_frame::container, frame, wtk_frame::frame_handler, GFX_COLOR_TRANSPARENT, gfx_draw_filled_circle, gfx_draw_filled_rect, gfx_draw_string(), GFX_QUADRANT1, membag_free(), win_clip_region::origin, wtk_frame::resize, win_area::size, sysfont, win_destroy(), WIN_EVENT_COMMAND, WIN_EVENT_DESTROY, WIN_EVENT_DRAW, WIN_EVENT_POINTER, win_get_area(), win_get_custom_data(), WIN_POINTER_MOVE, WIN_POINTER_PRESS, WIN_POINTER_RELEASE, WTK_FRAME_BORDER_COLOR, WTK_FRAME_BOTTOMBORDER, WTK_FRAME_CAPTION_COLOR, WTK_FRAME_CAPTION_X, WTK_FRAME_CAPTION_Y, WTK_FRAME_RESIZE_COLOR, WTK_FRAME_RESIZE_RADIUS, WTK_FRAME_RIGHTBORDER, WTK_FRAME_TITLEBAR_COLOR, WTK_FRAME_TITLEBAR_HEIGHT, WTK_FRAME_TOPBORDER, wtk_handle_frame_move(), wtk_handle_frame_press(), wtk_handle_frame_release(), wtk_handle_resize_move(), wtk_handle_resize_press(), and wtk_handle_resize_release().
Referenced by wtk_frame_create().
1.6.3