Add RMB pulldown menu to Fl_Help_View, #75

- append underscores to private varaibles per CMP
- add public Fl_Help_View::copy() and Fl_Help_View::text_selected()
- add public Fl_Help_View::copy_menu_text
- fixes some of the focus handling
- add pulldown menu to copy selected text
This commit is contained in:
Matthias Melcher
2024-07-29 14:03:16 +02:00
parent e7b8a24685
commit 089f31018b
2 changed files with 153 additions and 91 deletions
+22 -14
View File
@@ -235,20 +235,20 @@ class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget
Fl_Scrollbar scrollbar_, ///< Vertical scrollbar for document
hscrollbar_; ///< Horizontal scrollbar
static int selection_first;
static int selection_last;
static int selection_push_first;
static int selection_push_last;
static int selection_drag_first;
static int selection_drag_last;
static int selected;
static int draw_mode;
static int mouse_x;
static int mouse_y;
static int current_pos;
static Fl_Help_View *current_view;
static Fl_Color hv_selection_color;
static Fl_Color hv_selection_text_color;
static int selection_first_;
static int selection_last_;
static int selection_push_first_;
static int selection_push_last_;
static int selection_drag_first_;
static int selection_drag_last_;
static int selected_;
static int draw_mode_;
static int mouse_x_;
static int mouse_y_;
static int current_pos_;
static Fl_Help_View *current_view_;
static Fl_Color hv_selection_color_;
static Fl_Color hv_selection_text_color_;
void initfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { f = textfont_; s = textsize_; c = textcolor_; fstack_.init(f, s, c); }
@@ -286,6 +286,8 @@ private:
public:
static const char *copy_menu_text;
Fl_Help_View(int xx, int yy, int ww, int hh, const char *l = 0);
~Fl_Help_View();
/** Returns the current directory for the text in the buffer. */
@@ -383,6 +385,12 @@ public:
void scrollbar_size(int newSize) {
scrollbar_size_ = newSize;
}
// Check if the user selected text in this view.
int text_selected();
// If text is selected in this view, copy it to a clipboard.
int copy(int clipboard=1);
};
#endif // !Fl_Help_View_H