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 / bctextbox.h < prev    next >
C/C++ Source or Header  |  2000-11-29  |  4KB  |  175 lines

  1. #ifndef BCTEXTBOX_H
  2. #define BCTEXTBOX_H
  3.  
  4. #include "bclistbox.h"
  5. #include "bcsubwindow.h"
  6. #include "bctumble.h"
  7. #include "fonts.h"
  8.  
  9. #define BCCURSORW 2
  10.  
  11.  
  12.  
  13. class BC_TextBox : public BC_SubWindow
  14. {
  15. public:
  16.     BC_TextBox(int x, int y, int w, int rows, char *text, int has_border = 1, int font = MEDIUMFONT);
  17.     BC_TextBox(int x, int y, int w, int rows, long text, int has_border = 1, int font = MEDIUMFONT);
  18.     BC_TextBox(int x, int y, int w, int rows, int text, int has_border = 1, int font = MEDIUMFONT);
  19.     BC_TextBox(int x, int y, int w, int rows, float text, int has_border = 1, int font = MEDIUMFONT);
  20.     virtual ~BC_TextBox();
  21.  
  22.     virtual int handle_event() { return 0; };
  23.     int update(char *text);
  24.     int update(long value);
  25.     int update(float value);
  26.  
  27.     int initialize();
  28.     int cursor_enter_event();
  29.     int cursor_leave_event();
  30.     int cursor_motion_event();
  31.     int button_press_event();
  32.     int button_release_event();
  33.     int repeat_event(long repeat_id);
  34.     int keypress_event();
  35.     int activate();
  36.     int deactivate();
  37.     char* get_text();
  38.     int reposition_window(int x, int y, int w = -1, int rows = -1);
  39.     int uses_text();
  40.  
  41. private:
  42.     int reset_parameters(int rows, int has_border, int font);
  43.     void draw();
  44.     void draw_border();
  45.     void draw_cursor();
  46.     void delete_selection(int letter1, int letter2, int text_len);
  47.     void insert_text(char *string);
  48.     void get_ibeam_position(int &x, int &y);
  49.     void find_ibeam();
  50.     void select_word(int &letter1, int &letter2, int ibeam_letter);
  51.     int get_cursor_letter(int cursor_x, int cursor_y);
  52.     int get_row_h(int rows);
  53.  
  54.  
  55. // Top left of text relative to window
  56.     int text_x, text_y;
  57. // Top left of cursor relative to window
  58.     int ibeam_x, ibeam_y;
  59.  
  60.     int ibeam_letter;
  61.     int highlight_letter1, highlight_letter2;
  62.     int highlight_letter3, highlight_letter4;
  63.     int text_x1, text_start, text_end, text_selected, word_selected;
  64.     int text_ascent, text_descent, text_height;
  65.     int left_margin, right_margin, top_margin, bottom_margin;
  66.     int has_border;
  67.     int font;
  68.     int rows;
  69.     int highlighted;
  70.     int high_color, back_color;
  71.     int background_color;
  72.     char text[BCTEXTLEN], text_row[BCTEXTLEN], temp_string[2];
  73.     int active;
  74.     long repeat_id;
  75. };
  76.  
  77. class BC_PopupTextBoxText;
  78. class BC_PopupTextBoxList;
  79.  
  80. class BC_PopupTextBox
  81. {
  82. public:
  83.     BC_PopupTextBox(BC_WindowBase *parent_window, 
  84.         ArrayList<BC_ListBoxItem*> *list_items,
  85.         char *default_text,
  86.         int x, 
  87.         int y, 
  88.         int text_w,
  89.         int list_h);
  90.     virtual ~BC_PopupTextBox();
  91.     int create_objects();
  92.     virtual int handle_event();
  93.     char* get_text();
  94.     int get_number();
  95.     int get_w();
  96.     int get_h();
  97.     void update(char *text);
  98.     
  99.     
  100.     int x, y, text_w, list_h;
  101.     char *default_text;
  102.     ArrayList<BC_ListBoxItem*> *list_items;
  103.     BC_PopupTextBoxText *textbox;
  104.     BC_PopupTextBoxList *listbox;
  105.     BC_WindowBase *parent_window;
  106. };
  107.  
  108. class BC_PopupTextBoxText : public BC_TextBox
  109. {
  110. public:
  111.     BC_PopupTextBoxText(BC_PopupTextBox *popup, int x, int y);
  112.     int handle_event();
  113.     BC_PopupTextBox *popup;
  114. };
  115.  
  116. class BC_PopupTextBoxList : public BC_ListBox
  117. {
  118. public:
  119.     BC_PopupTextBoxList(BC_PopupTextBox *popup, int x, int y);
  120.     int handle_event();
  121.     BC_PopupTextBox *popup;
  122. };
  123.  
  124.  
  125. class BC_TumbleTextBoxText;
  126. class BC_TumbleTextBoxTumble;
  127.  
  128. class BC_TumbleTextBox
  129. {
  130. public:
  131.     BC_TumbleTextBox(BC_WindowBase *parent_window, 
  132.         long default_value,
  133.         long min,
  134.         long max,
  135.         int x, 
  136.         int y, 
  137.         int text_w);
  138.     virtual ~BC_TumbleTextBox();
  139.     int create_objects();
  140.     virtual int handle_event();
  141.     char* get_text();
  142.     int get_w();
  143.     int get_h();
  144.     void set_boundaries(long min, long max);
  145.     
  146.     int x, y, text_w;
  147.     long default_value, min, max;
  148.     BC_TumbleTextBoxText *textbox;
  149.     BC_TumbleTextBoxTumble *tumbler;
  150.     BC_WindowBase *parent_window;
  151. };
  152.  
  153. class BC_TumbleTextBoxText : public BC_TextBox
  154. {
  155. public:
  156.     BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int x, int y);
  157.     int handle_event();
  158.     BC_TumbleTextBox *popup;
  159. };
  160.  
  161. class BC_TumbleTextBoxTumble : public BC_ITumbler
  162. {
  163. public:
  164.     BC_TumbleTextBoxTumble(BC_TumbleTextBox *popup, 
  165.         long min,
  166.         long max,
  167.         int x, 
  168.         int y);
  169.     
  170.     BC_TumbleTextBox *popup;
  171. };
  172.  
  173.  
  174. #endif
  175.