Subversion Repositories Kolibri OS

Rev

Rev 6456 | Rev 6466 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6456 Rev 6457
Line 31... Line 31...
31
 
31
 
32
  KOLIBRI_NUM_GUI_ELEMENTS
32
  KOLIBRI_NUM_GUI_ELEMENTS
Line 33... Line 33...
33
};
33
};
34
 
34
 
35
/* Linked list which connects together all the elements drawn inside a GUI window */
35
/* Linked list which connects together all the elements drawn inside a GUI window */
36
struct kolibri_window_element {
36
typedef struct{
-
 
37
  enum KOLIBRI_GUI_ELEMENT_TYPE type;
37
  enum KOLIBRI_GUI_ELEMENT_TYPE type;
38
  void *element;
38
  void *element;
-
 
Line 39... Line 39...
39
  struct kolibri_window_element *next, *prev;
39
  void *next, *prev;
Line 40... Line 40...
40
};
40
}kolibri_window_element;
41
 
41
 
42
 
42
 
43
typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__));
43
typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__));
44
 
44
 
45
/* Generic structure for supporting functions on various elements of Kolibri's GUI */
45
/* Generic structure for supporting functions on various elements of Kolibri's GUI */
Line 46... Line 46...
46
struct kolibri_element_operations {
46
typedef struct {
47
 	cb_elem_boxlib 	redraw_fn;
47
 	cb_elem_boxlib 	redraw_fn;
48
 	cb_elem_boxlib 	mouse_fn;
48
 	cb_elem_boxlib 	mouse_fn;
49
 	cb_elem_boxlib 	key_fn;
49
 	cb_elem_boxlib 	key_fn;
50
};
50
}kolibri_element_operations;
Line 51... Line 51...
51
 
51
 
52
/* Structure for a GUI Window on Kolibri. It also contains all the elements drawn in window */
52
/* Structure for a GUI Window on Kolibri. It also contains all the elements drawn in window */
Line 53... Line 53...
53
struct kolibri_window {
53
typedef struct{
54
  unsigned int topleftx, toplefty;
54
  unsigned int topleftx, toplefty;
Line 55... Line 55...
55
  unsigned int sizex, sizey;
55
  unsigned int sizex, sizey;
56
  char *window_title;
56
  char *window_title;
Line 57... Line 57...
57
 
57
 
58
  /* Refer to sysfuncs, value to be stored in EDX (Function 0) */
58
  /* Refer to sysfuncs, value to be stored in EDX (Function 0) */
Line 59... Line 59...
59
  unsigned int XY;
59
  unsigned int XY;
60
 
60
 
61
  struct kolibri_window_element *elements;
61
  kolibri_window_element *elements;
62
};
62
}kolibri_window;
Line 97... Line 97...
97
}
97
}
Line 98... Line 98...
98
 
98
 
99
/* Create a new main GUI window for KolibriOS */
99
/* Create a new main GUI window for KolibriOS */
Line 100... Line 100...
100
/* tl stands for TOP LEFT. x and y are coordinates. */
100
/* tl stands for TOP LEFT. x and y are coordinates. */
101
 
101
 
102
struct kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int sizey, char *title)
102
kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int sizey, char *title)
Line 103... Line 103...
103
{
103
{
104
  struct kolibri_window *new_win = (struct kolibri_window *)malloc(sizeof(struct kolibri_window));
104
  kolibri_window *new_win = (kolibri_window *)malloc(sizeof(kolibri_window));
105
 
105
 
106
  new_win->topleftx = tlx;
106
  new_win->topleftx = tlx;
Line 113... Line 113...
113
 
113
 
114
  return new_win;
114
  return new_win;
Line 115... Line 115...
115
}
115
}
116
 
116
 
117
/* Add an element to an existing window */
117
/* Add an element to an existing window */
118
void kolibri_window_add_element(struct kolibri_window *some_window, enum KOLIBRI_GUI_ELEMENT_TYPE element_type, void *some_gui_element)
118
void kolibri_window_add_element(kolibri_window *some_window, enum KOLIBRI_GUI_ELEMENT_TYPE element_type, void *some_gui_element)
Line 119... Line 119...
119
{
119
{
120
  struct kolibri_window_element *new_element = (struct kolibri_window_element *)malloc(sizeof(struct kolibri_window_element));
120
  kolibri_window_element *new_element = (kolibri_window_element *)malloc(sizeof(kolibri_window_element));
Line 121... Line 121...
121
 
121
 
Line 128... Line 128...
128
      some_window->elements -> prev = some_window->elements;
128
      some_window->elements -> prev = some_window->elements;
129
      some_window->elements -> next = some_window->elements;
129
      some_window->elements -> next = some_window->elements;
130
    }
130
    }
131
  else
131
  else
132
    {
132
    {
133
      struct kolibri_window_element *last_element = some_window -> elements -> prev;
133
      kolibri_window_element *last_element = some_window -> elements -> prev;
Line 134... Line 134...
134
 
134
 
135
      last_element -> next = new_element;
135
      last_element -> next = new_element;
136
      new_element -> next = some_window -> elements; /* start of linked list  */
136
      new_element -> next = some_window -> elements; /* start of linked list  */
137
      some_window -> elements -> prev = new_element;
137
      some_window -> elements -> prev = new_element;