Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include <kolibri.h>
  2. #include <kos_heap.h>
  3. #include <load_lib.h>
  4. #include <l_box_lib.h>
  5.  
  6. using namespace Kolibri;
  7.  
  8. const char header[] = "Boxlib example 1";
  9. char library_path[2048];
  10.  
  11. void* mouse_dd;
  12. char str1[22];
  13. char str2[22];
  14. char str3[22] = "+380";
  15.  
  16. edit_box edit1 = { 100, 62, 10, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str1, &mouse_dd, ed_focus };
  17. edit_box edit2 = { 100, 62, 30, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str2, &mouse_dd };
  18. edit_box edit3 = { 100, 62, 50, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str3, &mouse_dd, 0, 4 };
  19.  
  20. char str4[] = "CheckBox 1";
  21. char str5[] = "CheckBox 2";
  22.  
  23. check_box check1 = { {15, 10, 12,  80}, 8, 0xffffff, 0x80, 0, str4, ch_flag_middle+ch_flag_en };
  24. check_box check2 = { {15, 10, 20, 100}, 8, 0xffffff, 0x80, 0, str5, ch_flag_middle };
  25.  
  26. namespace Kolibri{
  27.         char CurrentDirectoryPath[2048];
  28. }
  29.  
  30. bool KolibriOnStart(TStartData &kos_start, TThreadData /*th*/)
  31. {
  32.         kos_start.Left = 10;
  33.         kos_start.Top = 40;
  34.         kos_start.Width = 280;
  35.         kos_start.Height = 200;
  36.         kos_start.WinData.WindowColor = 0xd0d0d0;
  37.         kos_start.WinData.WindowType = 0x33; // 0x34 - fixed, 0x33 - not fixed
  38.         kos_start.WinData.Title = header;
  39.         if(LoadLibrary("box_lib.obj", library_path, "/sys/lib/box_lib.obj", &import_box_lib))
  40.         {
  41.                 check_box_init(&check1);
  42.                 check_box_init(&check2);
  43.         }
  44.         return true;
  45. }
  46.  
  47. void KolibriOnPaint(void)
  48. {
  49.         DrawText(10,14,0,"Surname:");
  50.         edit_box_draw(&edit1);
  51.         DrawText(10,34,0,"Name:");
  52.         edit_box_draw(&edit2);
  53.         DrawText(10,54,0,"Phone:");
  54.         edit_box_draw(&edit3);
  55.  
  56.         check_box_draw(&check1);
  57.         check_box_draw(&check2);
  58. }
  59.  
  60. void KolibriOnKeyPress(TThreadData th)
  61. {
  62.         asm{
  63.                 mcall SF_GET_KEY
  64.         }
  65.         edit_box_key(&edit1);
  66.         edit_box_key(&edit2);
  67.         edit_box_key(&edit3);
  68. }
  69.  
  70. void KolibriOnMouse(TThreadData th)
  71. {
  72.         edit_box_mouse(&edit1);
  73.         edit_box_mouse(&edit2);
  74.         edit_box_mouse(&edit3);
  75.  
  76.         check_box_mouse(&check1);
  77.         check_box_mouse(&check2);
  78. }
  79.