1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "tx_api.h"
5 #include "gx_api.h"
6 #include "gx_validation_utility.h"
7 #include "gx_menu.h"
8 #include "gx_system.h"
9 
10 TEST_PARAM test_parameter = {
11     "guix_tree_view_show_event_process", /* Test name */
12     460, 100, 628, 355  /* Define the coordinates of the capture area.
13                          In this test, we only need to capture the line
14                          drawing area.  */
15 };
16 
17 static VOID      control_thread_entry(ULONG);
main(int argc,char ** argv)18 int main(int argc, char ** argv)
19 {
20     /* Parse the command line argument. */
21     gx_validation_setup(argc, argv);
22 
23     /* Start ThreadX system */
24     tx_kernel_enter();
25     return(0);
26 }
27 
tx_application_define(void * first_unused_memory)28 VOID tx_application_define(void *first_unused_memory)
29 {
30 
31     /* Create a dedicated thread to perform various operations
32        on the line drawing example. These operations simulate
33        user input. */
34     gx_validation_control_thread_create(control_thread_entry);
35 
36     /* Termiante the test if it runs for more than 100 ticks */
37     /* This function is not implemented yet. */
38     gx_validation_watchdog_create(100);
39 
40     /* Call the actual line example routine. */
41     gx_validation_application_define(first_unused_memory);
42 
43 }
44 
45 
46 /* Replace the default graphics driver with the validation driver. */
47 #ifdef win32_graphics_driver_setup_24xrgb
48 #undef win32_graphics_driver_setup_24xrgb
49 #endif
50 #define win32_graphics_driver_setup_24xrgb  gx_validation_graphics_driver_setup_24xrgb
51 
52 
53 #ifdef WIN32
54 #undef WIN32
55 #endif
56 
57 #include "gx_validation_wrapper.h"
58 
59 #include "demo_guix_all_widgets.c"
60 
61 char test_comment[256];
62 
control_thread_entry(ULONG input)63 static VOID control_thread_entry(ULONG input)
64 {
65 INT           frame_id = 1;
66 GX_EVENT      my_event;
67 GX_TREE_VIEW  test_tree;
68 GX_BUTTON     button;
69 GX_MENU       menu;
70 GX_RECTANGLE  size;
71 
72     /* Toggle from menu screen to text screen. */
73     ToggleScreen((GX_WINDOW *)&menu_screen, pButtonScreen);
74 
75     gx_utility_rectangle_define(&size, 486, 247, 565, 270);
76 
77     memset(&test_tree, 0, sizeof(GX_TREE_VIEW));
78     gx_tree_view_create(&test_tree, "test_tree", GX_NULL, GX_STYLE_ENABLED, 1024, &size);
79     gx_menu_insert(&menu_screen.menu_screen_tree_menu_1, (GX_WIDGET *)&test_tree);
80 
81     memset(&button, 0, sizeof(GX_BUTTON));
82     gx_button_create(&button, "test_button", &test_tree, GX_STYLE_ENABLED, 2014, &size);
83 
84     memset(&menu, 0, sizeof(GX_MENU));
85     gx_menu_create(&menu, "test_menu", &test_tree, 0, 0, GX_STYLE_ENABLED, 1026, &size);
86 
87     memset(&my_event, 0, sizeof(GX_EVENT));
88     my_event.gx_event_target = (GX_WIDGET *)&test_tree;
89     my_event.gx_event_type = GX_EVENT_SHOW;
90     gx_system_event_send(&my_event);
91     gx_validation_set_frame_id(frame_id++);
92     gx_validation_set_frame_comment("show test tree that is attached to menu_1");
93     gx_validation_screen_refresh();
94 
95     gx_widget_detach(&test_tree);
96     gx_system_event_send(&my_event);
97 
98     tx_thread_sleep(2);
99 
100     gx_validation_end();
101 
102     exit(0);
103 }
104 
105