mirror of https://gitlab.com/cppit/jucipp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
|
11 years ago
|
#ifndef JUCI_SELECTIONDIALOG_H_
|
||
|
|
#define JUCI_SELECTIONDIALOG_H_
|
||
|
|
|
||
|
11 years ago
|
#include "gtkmm.h"
|
||
|
|
#include "logging.h"
|
||
|
11 years ago
|
#include "tooltips.h"
|
||
|
11 years ago
|
#include <unordered_map>
|
||
|
11 years ago
|
|
||
|
11 years ago
|
class SelectionDialogBase {
|
||
|
11 years ago
|
public:
|
||
|
11 years ago
|
SelectionDialogBase(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark, bool show_search_entry);
|
||
|
|
~SelectionDialogBase();
|
||
|
|
virtual void add_row(const std::string& row, const std::string& tooltip="");
|
||
|
11 years ago
|
virtual void show();
|
||
|
|
virtual void hide();
|
||
|
|
virtual void move();
|
||
|
11 years ago
|
|
||
|
11 years ago
|
std::function<void()> on_hide;
|
||
|
11 years ago
|
std::function<void(const std::string& selected, bool hide_window)> on_select;
|
||
|
11 years ago
|
Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark;
|
||
|
11 years ago
|
protected:
|
||
|
|
virtual void resize();
|
||
|
11 years ago
|
virtual void update_tooltips();
|
||
|
11 years ago
|
Gtk::TextView& text_view;
|
||
|
11 years ago
|
|
||
|
11 years ago
|
std::unique_ptr<Gtk::Window> window;
|
||
|
11 years ago
|
Gtk::ScrolledWindow scrolled_window;
|
||
|
|
Gtk::ListViewText list_view_text;
|
||
|
|
Gtk::Entry search_entry;
|
||
|
|
bool show_search_entry;
|
||
|
11 years ago
|
std::unique_ptr<Tooltips> tooltips;
|
||
|
11 years ago
|
std::unordered_map<std::string, std::string> tooltip_texts;
|
||
|
11 years ago
|
std::string last_row;
|
||
|
11 years ago
|
};
|
||
|
|
|
||
|
|
class SelectionDialog : public SelectionDialogBase {
|
||
|
|
public:
|
||
|
11 years ago
|
SelectionDialog(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark);
|
||
|
11 years ago
|
void show();
|
||
|
|
};
|
||
|
|
|
||
|
11 years ago
|
class CompletionDialog : public SelectionDialogBase {
|
||
|
11 years ago
|
public:
|
||
|
11 years ago
|
CompletionDialog(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark);
|
||
|
11 years ago
|
void show();
|
||
|
|
bool on_key_release(GdkEventKey* key);
|
||
|
|
bool on_key_press(GdkEventKey* key);
|
||
|
|
|
||
|
|
private:
|
||
|
|
void select(bool hide_window=true);
|
||
|
|
|
||
|
|
int show_offset;
|
||
|
11 years ago
|
bool row_in_entry=false;
|
||
|
11 years ago
|
};
|
||
|
|
|
||
|
|
#endif // JUCI_SELECTIONDIALOG_H_
|