titler fixes, auto paste bug, resize popup hang, focus policy fix, chk lang
[goodguy/history.git] / cinelerra-5.1 / guicast / bctextbox.h
index 3d1106e6e48f38bde571df2c6b04a4f205b06ddd..a46661cdc5f3d6dec33ccd9baca409341ed2ee8a 100644 (file)
@@ -40,6 +40,14 @@ class BC_ScrollTextBoxYScroll;
 
 class BC_TextBox : public BC_SubWindow
 {
+       static inline int nib(int ch) {
+               if( ch >= '0' && ch <= '9' ) ch -= '0';
+               else if( ch >= 'A' && ch <= 'F' ) ch -= 'A'-10;
+               else if( ch >= 'a' && ch <= 'f' ) ch -= 'a'-10;
+               else ch = -1;
+               return ch;
+       }
+
        char *text;
        wchar_t *wtext;
 public:
@@ -68,6 +76,7 @@ public:
 // Whenever the position of the text changes
        virtual int motion_event() { return 0; };
        void set_selection(int char1, int char2, int ibeam);
+       void wset_selection(int char1, int char2, int ibeam);
        int update(const char *text);
        int update(const wchar_t *wtext);
        int update(int64_t value);
@@ -92,20 +101,19 @@ public:
        int deactivate();
        const char* get_text();
        const wchar_t* get_wtext();
-       const char* get_utf8text();
        void set_text(char *text, int isz);
        int get_text_rows();
 // Set top left of text view
        void set_text_row(int row);
        int get_text_row();
+
        int reposition_window(int x, int y, int w = -1, int rows = -1);
        int uses_text();
-#ifdef X_HAVE_UTF8_STRING
-       int utf8seek(int i, int reverse);
-#endif
        static int calculate_h(BC_WindowBase *gui, int font, int has_border, int rows);
        static int calculate_row_h(int rows, BC_WindowBase *parent_window, int has_border = 1, int font = MEDIUMFONT);
        static int pixels_to_rows(BC_WindowBase *window, int font, int pixels);
+       static int wcpos(const char *text, const char *ep);
+
        void set_precision(int precision);
 // Whether to draw every time there is a keypress or rely on user to
 // follow up every keypress with an update().
@@ -125,7 +133,7 @@ public:
 
 // Compute suggestions for a path
 // If entries is null, just search absolute paths
-       int calculate_suggestions(ArrayList<BC_ListBoxItem*> *entries);
+       int calculate_suggestions(ArrayList<BC_ListBoxItem*> *entries=0, const char *filter=0);
 
 
 // User computes suggestions after handle_event.
@@ -133,6 +141,7 @@ public:
 // A highlighted extension is added if 1 suggestion or a popup appears
 // if multiple suggestions.
 // column - starting column to replace
+       void no_suggestions();
        void set_suggestions(ArrayList<char*> *suggestions, int column);
        BC_ScrollTextBoxYScroll *yscroll;
 
@@ -169,7 +178,7 @@ private:
 // Top left of cursor relative to text
        int ibeam_x, ibeam_y;
 
-       int ibeam_letter;
+       int ibeam_letter, unicode_active;
        int highlight_letter1, highlight_letter2;
        int highlight_letter3, highlight_letter4;
        int text_x1, text_start, text_end;
@@ -209,10 +218,8 @@ public:
        BC_TextBoxSuggestions(BC_TextBox *text_box, int x, int y);
        virtual ~BC_TextBoxSuggestions();
 
-       int selection_changed();
        int handle_event();
 
-
        BC_TextBox *text_box;
 };
 
@@ -224,6 +231,16 @@ class BC_ScrollTextBoxYScroll;
 
 class BC_ScrollTextBox
 {
+       BC_ScrollTextBoxText *text;
+       BC_ScrollTextBoxYScroll *yscroll;
+       BC_WindowBase *parent_window;
+       const char *default_text;
+       const wchar_t *default_wtext;
+       int default_size;
+       int x, y, w, rows;
+
+       friend class BC_ScrollTextBoxText;
+       friend class BC_ScrollTextBoxYScroll;
 public:
        BC_ScrollTextBox(BC_WindowBase *parent_window,
                int x, int y, int w, int rows,
@@ -233,34 +250,31 @@ public:
                 const wchar_t *default_wtext, int default_size=BCTEXTLEN);
        virtual ~BC_ScrollTextBox();
        void create_objects();
-       virtual int handle_event();
 
-       const char* get_text();
-       const wchar_t* get_wtext();
+       virtual int handle_event() { return 1; }
+       virtual int button_press_event();
+       virtual int button_release_event();
+
        void set_text(char *text, int isz);
        int set_text_row(int n);
        void update(const char *text);
        void update(const wchar_t *wtext);
-       void set_selection(int char1, int char2, int ibeam);
        void reposition_window(int x, int y, int w, int rows);
-       int get_x();
-       int get_y();
-       int get_w();
-       int get_h();
+// accessors
+       int get_x() { return x; }
+       int get_y() { return y; }
+       int get_w() { return w; }
 // Visible rows for resizing
-       int get_rows();
-
-       friend class BC_ScrollTextBoxText;
-       friend class BC_ScrollTextBoxYScroll;
+       int get_rows() { return rows; }
 
-private:
-       BC_ScrollTextBoxText *text;
-       BC_ScrollTextBoxYScroll *yscroll;
-       BC_WindowBase *parent_window;
-       const char *default_text;
-       const wchar_t *default_wtext;
-       int default_size;
-       int x, y, w, rows;
+// forward functions
+       int get_h();
+       const char *get_text();
+       const wchar_t *get_wtext();
+       int get_buttonpress();
+       void wset_selection(int char1, int char2, int ibeam);
+       void set_selection(int char1, int char2, int ibeam);
+       int get_ibeam_letter();
 };
 
 class BC_ScrollTextBoxText : public BC_TextBox
@@ -272,6 +286,8 @@ public:
        int handle_event();
        int motion_event();
        BC_ScrollTextBox *gui;
+       int button_press_event() { return gui->button_press_event(); }
+       int button_release_event() { return gui->button_release_event(); }
 };
 
 class BC_ScrollTextBoxYScroll : public BC_ScrollBar
@@ -306,6 +322,9 @@ public:
        int get_y();
        int get_w();
        int get_h();
+       int get_show_query();
+       void set_show_query(int v);
+
        void update(const char *text);
        void update_list(ArrayList<BC_ListBoxItem*> *data);
        void reposition_window(int x, int y);
@@ -385,7 +404,7 @@ public:
        int get_y();
        int get_w();
        int get_h();
-       void disable();
+       void disable(int hide_text=0);
        void enable();
        int get_enabled();
        void reposition_window(int x, int y);
@@ -394,6 +413,7 @@ public:
        void set_precision(int precision);
        void set_increment(float value);
        void set_log_floatincrement(int value);
+       void set_tooltip(const char *text);
 
        friend class BC_TumbleTextBoxText;
        friend class BC_TumbleTextBoxTumble;
@@ -414,19 +434,8 @@ private:
 class BC_TumbleTextBoxText : public BC_TextBox
 {
 public:
-       BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
-               int64_t default_value,
-               int64_t min,
-               int64_t max,
-               int x,
-               int y);
-       BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
-               float default_value,
-               float min,
-               float max,
-               int x,
-               int y);
-       BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int x, int y);
+       BC_TumbleTextBoxText(BC_TumbleTextBox *popup, int64_t default_value, int x, int y);
+       BC_TumbleTextBoxText(BC_TumbleTextBox *popup, float default_value, int x, int y);
        virtual ~BC_TumbleTextBoxText();
        int handle_event();
        int button_press_event();