Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions source/include/gfx/default/wtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,78 @@ typedef uint8_t wtk_radio_group_size_t;

//! @}

/**
* \ingroud gfx_wtk_dialogue_box
* @{
*/

#ifndef DIALOGUE_FRAME_POS_X
//! Dialogue box frame X position inside parent frame.
#define DIALOGUE_FRAME_POS_X 40
#endif

#ifndef DIALOGUE_FRAME_POS_Y
//! Dialogue box frame Y position inside parent frame.
#define DIALOGUE_FRAME_POS_Y 50
#endif

#ifndef DIALOGUE_FRAME_SIZE_X
//! Dialogue box horisontal size X.
#define DIALOGUE_FRAME_SIZE_X 240
#endif

#ifndef DIALOGUE_FRAME_SIZE_Y
//! Dialogue box vertical size Y.
#define DIALOGUE_FRAME_SIZE_Y 120
#endif

#ifndef BUTTON_POS_Y
//! Buttons Y position inside dialogue box frame.
#define BUTTON_POS_Y 60
#endif

#ifndef BUTTON_SIZE_X
//! Buttons horisontal size X.
#define BUTTON_SIZE_X 90
#endif

#ifndef BUTTON_SIZE_Y
//! Buttons vertical size Y.
#define BUTTON_SIZE_Y 40
#endif

#ifndef BUTTON_SPACING
//! Horisontal spacing between buttons on X axis.
#define BUTTON_SPACING 20
#endif

#ifndef DIALOGUE_BOX_BACKGROUND
//! Background color of dialogue box frame.
#define DIALOGUE_BOX_BACKGROUND GFX_COLOR(100, 100, 100)
#endif

#ifndef DIALOGUE_FRAME_LINE_COLOR
//! Line color of the dialogue gox frame.
#define DIALOGUE_FRAME_LINE_COLOR GFX_COLOR(0, 0, 0)
#endif

#ifndef CAPTION_POS_X
//! Caption position centered on top of dialogue box by dividing size in half.
#define CAPTION_POS_X DIALOGUE_FRAME_SIZE_X / 2
#endif

#ifndef CAPTION_POS_Y
//! Caption distance down from top of dialogue box.
#define CAPTION_POS_Y 10
#endif

//! Second caption position centered on top of dialogue box.
#define SECOND_CAPTION_POS_X CAPTION_POS_X
//! Second caption distance down from top of dialogue box.
#define SECOND_CAPTION_POS_Y 40

//! @}

//! @}

#endif /* DEFAULT_WTK_H_INCLUDED */
24 changes: 24 additions & 0 deletions source/include/gfx/wtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* - \ref gfx_wtk_radio_button
* - \ref gfx_wtk_slider
* - \ref gfx_wtk_label
* - \ref gfx_wtk_dialogue_box
* @{
*/

Expand Down Expand Up @@ -343,6 +344,29 @@ bool wtk_progress_bar_set_value(struct wtk_progress_bar *bar, uint8_t value);
void wtk_progress_bar_set_colors(struct wtk_progress_bar *bar,
gfx_color_t color1, gfx_color_t color2);


struct win_window *wtk_dialogue_box_create(struct win_window *parent,
char *caption, char *second_caption, win_command_t command_data);


/**
* \defgroup gfx_wtk_dialogue_box Dialogue box widget
*
* Dialogue box widget provides storage structs for dialogue
* captions and command data.
*
* @{
*/
struct wtk_dialogue_box;

struct win_window *wtk_dialogue_box_create(struct win_window *parent,
char *caption, char *second_caption, win_command_t command_data);

struct win_window *wtk_dialogue_box_as_child(
struct wtk_dialogue_box *dialogue_box);
void *wtk_dialogue_box_get_custom_data(
const struct wtk_dialogue_box *dialogue_box);

//! @}


Expand Down
1 change: 1 addition & 0 deletions source/util/gfx/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ src-$(CONFIG_GFX_WTK) += util/gfx/wtk_label.c
src-$(CONFIG_GFX_WTK) += util/gfx/wtk_progress_bar.c
src-$(CONFIG_GFX_WTK) += util/gfx/wtk_radio_button.c
src-$(CONFIG_GFX_WTK) += util/gfx/wtk_slider.c
src-$(CONFIG_GFX_WTK) += util/gfx/wtk_dialogue_box.c

mkfiles += $(src)/util/gfx/subdir.mk
Loading