home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / video / xmovie-1.5.3.tar.gz / xmovie-1.5.3.tar / xmovie-1.5.3 / guicast / bcfilebox.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  4KB  |  217 lines

  1. #ifndef BCFILEBOX_H
  2. #define BCFILEBOX_H
  3.  
  4. #include "bcbutton.h"
  5. #include "bcfilebox.inc"
  6. #include "bclistbox.h"
  7. #include "bcresources.inc"
  8. #include "bctextbox.h"
  9. #include "bcwindow.h"
  10. #include "filesystem.inc"
  11. #include "mutex.h"
  12. #include "thread.h"
  13.  
  14. // Display modes
  15. #define FILEBOX_LIST    0
  16. #define FILEBOX_ICONS   1
  17.  
  18. #define FILEBOX_COLUMNS 2
  19.  
  20. class BC_NewFolder : public BC_Window
  21. {
  22. public:
  23.     BC_NewFolder(int x, int y, BC_FileBox *filebox);
  24.     ~BC_NewFolder();
  25.  
  26.     int create_objects();
  27.     char* get_text();
  28.  
  29. private:
  30.     BC_TextBox *textbox;
  31. };
  32.  
  33. class BC_NewFolderThread : public Thread
  34. {
  35. public:
  36.     BC_NewFolderThread(BC_FileBox *filebox);
  37.     ~BC_NewFolderThread();
  38.  
  39.     void run();
  40.     int interrupt();
  41.     int start_new_folder();
  42.  
  43. private:
  44.     Mutex change_lock, completion_lock;
  45.     int active;
  46.     BC_FileBox *filebox;
  47.     BC_NewFolder *window;
  48. };
  49.  
  50. class BC_FileBoxListBox : public BC_ListBox
  51. {
  52. public:
  53.     BC_FileBoxListBox(int x, int y, BC_FileBox *filebox);
  54.     virtual ~BC_FileBoxListBox();
  55.  
  56.     int handle_event();
  57.     int selection_changed();
  58.  
  59.     BC_FileBox *filebox;
  60. };
  61.  
  62. class BC_FileBoxTextBox : public BC_TextBox
  63. {
  64. public:
  65.     BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox);
  66.     ~BC_FileBoxTextBox();
  67.  
  68.     int handle_event();
  69.     BC_FileBox *filebox;
  70. };
  71.  
  72. class BC_FileBoxOK : public BC_OKButton
  73. {
  74. public:
  75.     BC_FileBoxOK(BC_FileBox *filebox);
  76.     ~BC_FileBoxOK();
  77.  
  78.     int handle_event();
  79.  
  80.     BC_FileBox *filebox;
  81. };
  82.  
  83. class BC_FileBoxCancel : public BC_CancelButton
  84. {
  85. public:
  86.     BC_FileBoxCancel(BC_FileBox *filebox);
  87.     ~BC_FileBoxCancel();
  88.  
  89.     int handle_event();
  90.  
  91.     BC_FileBox *filebox;
  92. };
  93.  
  94. class BC_FileBoxText : public BC_Button
  95. {
  96. public:
  97.     BC_FileBoxText(int x, int y, BC_FileBox *filebox);
  98.     int handle_event();
  99.     BC_FileBox *filebox;
  100. };
  101.  
  102. class BC_FileBoxFilterText : public BC_TextBox
  103. {
  104. public:
  105.     BC_FileBoxFilterText(int x, int y, BC_FileBox *filebox);
  106.     int handle_event();
  107.     BC_FileBox *filebox;
  108. };
  109.  
  110. class BC_FileBoxFilterMenu : public BC_ListBox
  111. {
  112. public:
  113.     BC_FileBoxFilterMenu(int x, int y, BC_FileBox *filebox);
  114.     int handle_event();
  115.     BC_FileBox *filebox;
  116. };
  117.  
  118. class BC_FileBoxIcons : public BC_Button
  119. {
  120. public:
  121.     BC_FileBoxIcons(int x, int y, BC_FileBox *filebox);
  122.     int handle_event();
  123.     BC_FileBox *filebox;
  124. };
  125.  
  126. class BC_FileBoxNewfolder : public BC_Button
  127. {
  128. public:
  129.     BC_FileBoxNewfolder(int x, int y, BC_FileBox *filebox);
  130.     int handle_event();
  131.     BC_FileBox *filebox;
  132. };
  133.  
  134. class BC_FileBoxUpdir : public BC_Button
  135. {
  136. public:
  137.     BC_FileBoxUpdir(int x, int y, BC_FileBox *filebox);
  138.     int handle_event();
  139.     BC_FileBox *filebox;
  140. };
  141.  
  142.  
  143.  
  144. class BC_FileBox : public BC_Window
  145. {
  146. public:
  147.     BC_FileBox(int x, int y,
  148.         char *init_path,
  149.         char *title,
  150.         char *caption,
  151. // Set to 1 to get hidden files. 
  152.         int show_all_files = 0,
  153. // Want only directories
  154.         int want_directory = 0,
  155.         int multiple_files = 0,
  156.         int h_padding = 0);
  157.     virtual ~BC_FileBox();
  158.  
  159.     friend BC_FileBoxCancel;
  160.     friend BC_FileBoxListBox;
  161.     friend BC_FileBoxTextBox;
  162.     friend BC_FileBoxText;
  163.     friend BC_FileBoxIcons;
  164.     friend BC_FileBoxNewfolder;
  165.     friend BC_FileBoxOK;
  166.     friend BC_NewFolderThread;
  167.     friend BC_FileBoxUpdir;
  168.     friend BC_FileBoxFilterText;
  169.     friend BC_FileBoxFilterMenu;
  170.  
  171.     virtual int create_objects();
  172. // Give the most recently selected path
  173.     char* get_path();
  174. // Give the path of any selected item or 0
  175.     char* get_path(int selection);
  176.     int update_filter(char *filter);
  177.     virtual int resize_event(int w, int h);
  178.     char* get_newfolder_title();
  179.  
  180. private:
  181.     int create_icons();
  182.     int create_tables();
  183.     int delete_tables();
  184.     int submit_file(char *path, int return_value);
  185.     int get_display_mode();
  186.     int get_listbox_w();
  187.     int get_listbox_h();
  188.     void create_listbox(int x, int y, int mode);
  189.     BC_Pixmap* get_icon(char *path, int is_dir);    // Get the icon number for a listbox
  190.  
  191.     BC_Pixmap *icons[TOTAL_ICONS];
  192.     FileSystem *fs;
  193.     BC_FileBoxTextBox *textbox;
  194.     BC_FileBoxListBox *listbox;
  195.     BC_FileBoxFilterText *filter_text;
  196.     BC_FileBoxFilterMenu *filter_popup;
  197.     BC_Title *directory_title;
  198.     BC_Button *icon_button, *text_button, *folder_button, *updir_button;
  199.     BC_Button *ok_button, *cancel_button;
  200.     char caption[BCTEXTLEN];
  201.     char path[BCTEXTLEN];
  202.     char directory[BCTEXTLEN];
  203.     char filename[BCTEXTLEN];
  204.     char string[BCTEXTLEN];
  205.     int want_directory;
  206.     int select_multiple;
  207.     static char *column_titles[FILEBOX_COLUMNS];
  208.     int column_width[FILEBOX_COLUMNS];
  209.     ArrayList<BC_ListBoxItem*> list_column[FILEBOX_COLUMNS];
  210.     ArrayList<BC_ListBoxItem*> filter_list;
  211.     char new_folder_title[BCTEXTLEN];
  212.     BC_NewFolderThread *newfolder_thread;
  213.     int h_padding;
  214. };
  215.  
  216. #endif
  217.