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.
59 lines
1.5 KiB
59 lines
1.5 KiB
|
8 years ago
|
#pragma once
|
||
|
8 years ago
|
#include <functional>
|
||
|
6 years ago
|
#include <gtkmm.h>
|
||
|
8 years ago
|
#include <list>
|
||
|
10 years ago
|
#include <string>
|
||
|
8 years ago
|
#include <unordered_map>
|
||
|
10 years ago
|
#include <vector>
|
||
|
11 years ago
|
|
||
|
|
class EntryBox : public Gtk::Box {
|
||
|
|
public:
|
||
|
|
class Entry : public Gtk::Entry {
|
||
|
|
public:
|
||
|
8 years ago
|
Entry(const std::string &content = "", std::function<void(const std::string &content)> on_activate_ = nullptr, unsigned width_chars = -1);
|
||
|
|
std::function<void(const std::string &content)> on_activate;
|
||
|
|
|
||
|
10 years ago
|
private:
|
||
|
6 years ago
|
long selected_history;
|
||
|
|
std::string last_content;
|
||
|
|
bool set_text_from_history = false;
|
||
|
11 years ago
|
};
|
||
|
|
class Button : public Gtk::Button {
|
||
|
|
public:
|
||
|
8 years ago
|
Button(const std::string &label, std::function<void()> on_activate_ = nullptr);
|
||
|
11 years ago
|
std::function<void()> on_activate;
|
||
|
|
};
|
||
|
11 years ago
|
class ToggleButton : public Gtk::ToggleButton {
|
||
|
|
public:
|
||
|
8 years ago
|
ToggleButton(const std::string &label, std::function<void()> on_activate_ = nullptr);
|
||
|
11 years ago
|
std::function<void()> on_activate;
|
||
|
|
};
|
||
|
|
class Label : public Gtk::Label {
|
||
|
|
public:
|
||
|
8 years ago
|
Label(std::function<void(int state, const std::string &message)> update_ = nullptr);
|
||
|
|
std::function<void(int state, const std::string &message)> update;
|
||
|
11 years ago
|
};
|
||
|
8 years ago
|
|
||
|
10 years ago
|
private:
|
||
|
11 years ago
|
EntryBox();
|
||
|
8 years ago
|
|
||
|
10 years ago
|
public:
|
||
|
|
static EntryBox &get() {
|
||
|
|
static EntryBox singleton;
|
||
|
|
return singleton;
|
||
|
|
}
|
||
|
8 years ago
|
|
||
|
11 years ago
|
Gtk::Box upper_box;
|
||
|
|
Gtk::Box lower_box;
|
||
|
11 years ago
|
void clear();
|
||
|
8 years ago
|
void hide() { clear(); }
|
||
|
11 years ago
|
void show();
|
||
|
|
std::list<Entry> entries;
|
||
|
|
std::list<Button> buttons;
|
||
|
11 years ago
|
std::list<ToggleButton> toggle_buttons;
|
||
|
|
std::list<Label> labels;
|
||
|
8 years ago
|
|
||
|
10 years ago
|
private:
|
||
|
8 years ago
|
static std::unordered_map<std::string, std::vector<std::string>> entry_histories;
|
||
|
11 years ago
|
};
|