1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "gx_api.h"
5 
6 #include "text_draw_resources.h"
7 #include "text_draw_specifications.h"
8 
9 /* Define prototypes.   */
10 VOID  start_guix(VOID);
11 extern UINT win32_graphics_driver_setup_565rgb(GX_DISPLAY *display);
12 
13 GX_WINDOW_ROOT *root;
14 
main(int argc,char ** argv)15 int main(int argc, char ** argv)
16 {
17     tx_kernel_enter();
18     return(0);
19 }
20 
tx_application_define(void * first_unused_memory)21 VOID tx_application_define(void *first_unused_memory)
22 {
23     start_guix();
24 }
25 
start_guix(VOID)26 VOID  start_guix(VOID)
27 {
28     /* Initialize GUIX.  */
29     gx_system_initialize();
30 
31     gx_studio_display_configure(DISPLAY_1, win32_graphics_driver_setup_565rgb,
32         LANGUAGE_ENGLISH, DISPLAY_1_THEME_1, &root);
33 
34     /* create the main screen */
35     gx_studio_named_widget_create("main_screen", (GX_WIDGET *)root, GX_NULL);
36 
37     /* Show the root window to make it and patients screen visible.  */
38     gx_widget_show(root);
39 
40     /* start GUIX thread */
41     gx_system_start();
42 }
43 
prompt_left_aligned_draw(GX_PROMPT * prompt)44 VOID prompt_left_aligned_draw(GX_PROMPT *prompt)
45 {
46     GX_STRING string;
47 
48     gx_widget_background_draw(prompt);
49 
50     gx_context_string_get_ext(prompt->gx_prompt_text_id, &string);
51 
52     gx_context_font_set(prompt->gx_prompt_font_id);
53 
54     gx_context_line_color_set(prompt->gx_prompt_normal_text_color);
55 
56     gx_canvas_aligned_text_draw(&string, &prompt->gx_widget_size, GX_STYLE_TEXT_LEFT);
57 }
58 
prompt_center_aligned_draw(GX_PROMPT * prompt)59 VOID prompt_center_aligned_draw(GX_PROMPT *prompt)
60 {
61     GX_STRING string;
62 
63     gx_widget_background_draw(prompt);
64 
65     gx_context_string_get_ext(prompt->gx_prompt_text_id, &string);
66 
67     gx_context_font_set(prompt->gx_prompt_font_id);
68 
69     gx_context_line_color_set(prompt->gx_prompt_normal_text_color);
70 
71     gx_canvas_aligned_text_draw(&string, &prompt->gx_widget_size, GX_STYLE_TEXT_CENTER);
72 }
73 
prompt_right_aligned_draw(GX_PROMPT * prompt)74 VOID prompt_right_aligned_draw(GX_PROMPT *prompt)
75 {
76     GX_STRING string;
77 
78     gx_widget_background_draw(prompt);
79 
80     gx_context_string_get_ext(prompt->gx_prompt_text_id, &string);
81 
82     gx_context_font_set(prompt->gx_prompt_font_id);
83 
84     gx_context_line_color_set(prompt->gx_prompt_normal_text_color);
85 
86     gx_canvas_aligned_text_draw(&string, &prompt->gx_widget_size, GX_STYLE_TEXT_RIGHT);
87 }
88