Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. // WRITED BY MAXCODEHACK
  2. // Need to other sample, this sample is very shitcode)
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <stdarg.h>
  8. #include "kos32sys1.h"
  9. #include <clayer/boxlib.h>
  10.  
  11. struct kolibri_system_colors sys_color_table;
  12.  
  13. char statusbar[255];
  14. char proc_info[1024];
  15. char text_line[255];
  16.  
  17. enum BUTTONS
  18. {
  19.     BTN_QUIT = 1,
  20.     BTN_POP = 10,
  21.     BTN_UNLOCK = 11
  22. };
  23.  
  24. #define FONT_W 8
  25. #define FONT_H 14
  26. #define LINES 10
  27.  
  28. void draw_window()
  29. {
  30.     int win_hight, win_width, i, pos_y = get_skin_height() + 36;  // 60 == 24+36
  31.  
  32.     // start redraw
  33.     begin_draw();
  34.         // define&draw window
  35.         sys_create_window(10, 40, 600, 400, "My window", /*sys_color_table.work_area*/0xFFFFFF, 0x13);
  36.  
  37.     // end redraw
  38.     end_draw();
  39. }
  40. scrollbar scroll_ver = {15, 100 - 26, 100 - 29, 0, 0, 2 /* type */, 115, 15, 0,0x353B47,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
  41. int main()
  42. {
  43.     kolibri_boxlib_init();
  44.     int gui_event;
  45.     uint32_t pressed_button = 0, mouse_button;
  46.     pos_t   mouse_pos;
  47.  
  48.     get_system_colors(&sys_color_table);
  49.     set_event_mask(0xC0000027); // mouse events only when focused window and mouse inside
  50.  
  51.     do
  52.     {
  53.         gui_event = get_os_event();
  54.         switch(gui_event)
  55.         {
  56.         case KOLIBRI_EVENT_NONE:
  57.             // background work
  58.                         break;
  59.         case KOLIBRI_EVENT_REDRAW:
  60.             draw_window();
  61.             scrollbar_v_draw(&scroll_ver);
  62.                         break;
  63.         case KOLIBRI_EVENT_KEY:
  64.             // scroll
  65.                         break;
  66.         case KOLIBRI_EVENT_BUTTON:
  67.            
  68.             break;
  69.         case KOLIBRI_EVENT_MOUSE:
  70.             scrollbar_v_mouse(&scroll_ver);
  71.             break;
  72.         }
  73.     } while(1);
  74.  
  75.   return 0;
  76. }
  77.