Subversion Repositories Kolibri OS

Rev

Rev 9558 | Rev 9620 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef KOLIBRI_DIALOG_H
  2. #define KOLIBRI_DIALOG_H
  3.  
  4. #include <stdlib.h>
  5. #define NOT_SUCCESS 0
  6. #define SUCCESS 1
  7.  
  8. char sz_com_area_name[]    = "FFFFFFFF_open_dialog";
  9. char sz_dir_default_path[] = "/sys";
  10. char sz_start_path[]       = "/sys/File managers/opendial";
  11.  
  12. char cd_com_area_name[]    = "FFFFFFFF_color_dialog";
  13. char cd_start_path[]       = "/sys/colrdial";
  14.  
  15. enum open_dialog_mode {
  16.     OPEN,
  17.     SAVE,
  18.     SELECT
  19. };
  20.  
  21. typedef struct {
  22.         unsigned int size;
  23.         unsigned char end;
  24. }od_filter __attribute__ ((__packed__));
  25.  
  26. typedef struct {
  27.     unsigned int mode;
  28.     char* procinfo;
  29.     char* com_area_name;
  30.     unsigned int com_area;
  31.     char* opendir_path;
  32.     char* dir_default_path;
  33.     char* start_path;
  34.     void (*draw_window)();
  35.     unsigned int status;
  36.     char* openfile_path;
  37.     char* filename_area;
  38.     od_filter* filter_area;
  39.     unsigned short x_size;
  40.     unsigned short x_start;
  41.     unsigned short y_size;
  42.     unsigned short y_start;
  43. }open_dialog __attribute__ ((__packed__));
  44.  
  45.  
  46. typedef struct{
  47.     unsigned int type;
  48.     char* procinfo;
  49.     char* com_area_name;
  50.     unsigned int com_area;
  51.     char* start_path;
  52.     void (*draw_window)(void);
  53.     unsigned int status;
  54.     unsigned short x_size;
  55.     unsigned short x_start;
  56.     unsigned short y_size;
  57.     unsigned short y_start;
  58.     unsigned int color_type;
  59.     unsigned int color;
  60. }color_dialog __attribute__ ((__packed__));
  61.  
  62. void fake_on_redraw(void) {}
  63.  
  64. open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
  65. {
  66.     open_dialog *new_opendialog = (open_dialog *)malloc(sizeof(open_dialog));
  67.     od_filter *new_od_filter = (od_filter *)malloc(sizeof(od_filter));
  68.     char *plugin_path = (char *)calloc(4096, sizeof(char));
  69.         char *openfile_path = (char *)calloc(4096, sizeof(char));
  70.         char *proc_info = (char *)calloc(1024, sizeof(char));
  71.         char *filename_area = (char *)calloc(256, sizeof(char));
  72.  
  73.         new_od_filter -> size = 0;
  74.         new_od_filter -> end = 0;
  75.  
  76.         new_opendialog -> mode = mode;
  77.         new_opendialog -> procinfo = proc_info;
  78.         new_opendialog -> com_area_name = sz_com_area_name;
  79.         new_opendialog -> com_area = 0;
  80.         new_opendialog -> opendir_path = plugin_path;
  81.         new_opendialog -> dir_default_path = sz_dir_default_path;
  82.         new_opendialog -> start_path = sz_start_path;
  83.         new_opendialog -> draw_window = &fake_on_redraw;
  84.         new_opendialog -> status = 0;
  85.         new_opendialog -> openfile_path = openfile_path;
  86.         new_opendialog -> filename_area = filename_area;
  87.         new_opendialog -> filter_area = new_od_filter;
  88.         new_opendialog -> x_size = x_size;
  89.         new_opendialog -> x_start = tlx;
  90.         new_opendialog -> y_size = y_size;
  91.         new_opendialog -> y_start = tly;
  92.         return new_opendialog;
  93. }
  94.  
  95. void cd_fake_on_redraw(void) {}
  96.  
  97. color_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
  98. {
  99.     color_dialog *new_colordialog = (color_dialog *)malloc(sizeof(color_dialog));
  100.     char *proc_info = (char *)calloc(1024, sizeof(char));
  101.  
  102.         new_colordialog -> type = type;
  103.         new_colordialog -> procinfo = proc_info;
  104.         new_colordialog -> com_area_name = cd_com_area_name;
  105.         new_colordialog -> com_area = 0;
  106.         new_colordialog -> start_path = cd_start_path;
  107.         new_colordialog -> draw_window = &cd_fake_on_redraw;
  108.         new_colordialog -> status = 0;
  109.         new_colordialog -> x_size = x_size;
  110.         new_colordialog -> x_start = tlx;
  111.         new_colordialog -> y_size = y_size;
  112.         new_colordialog -> y_start = tly;
  113.         new_colordialog -> color_type = 0;
  114.         new_colordialog -> color = 0;
  115.         return new_colordialog;
  116. }
  117.  
  118. extern void kolibri_dialog_init();
  119.  
  120. extern void (*OpenDialog_init __attribute__((__stdcall__)))(open_dialog *);
  121. extern void (*OpenDialog_start __attribute__((__stdcall__)))(open_dialog *);
  122.  
  123. extern void (*ColorDialog_init __attribute__((__stdcall__)))(color_dialog *);
  124. extern void (*ColorDialog_start __attribute__((__stdcall__)))(color_dialog *);
  125.  
  126. #endif
  127.