Improve pop-up common with gicons and item ops
Add ability to use gicon images, insert pop-up entries in any location, and remove entries.
This commit is contained in:
@@ -20,12 +20,19 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "glibmm/refptr.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
namespace Gio
|
||||
{
|
||||
class Icon;
|
||||
}
|
||||
|
||||
namespace Gtk
|
||||
{
|
||||
|
||||
@@ -33,6 +40,7 @@ class Grid;
|
||||
class Menu;
|
||||
class Button;
|
||||
class ImageMenuItem;
|
||||
class Widget;
|
||||
|
||||
}
|
||||
|
||||
@@ -53,9 +61,12 @@ public:
|
||||
explicit PopUpCommon (Gtk::Button* button, const Glib::ustring& label = "");
|
||||
virtual ~PopUpCommon ();
|
||||
bool addEntry (const Glib::ustring& fileName, const Glib::ustring& label);
|
||||
bool insertEntry(int position, const Glib::ustring& fileName, const Glib::ustring& label);
|
||||
bool insertEntry(int position, const Glib::RefPtr<const Gio::Icon>& gIcon, const Glib::ustring& label);
|
||||
int getEntryCount () const;
|
||||
bool setSelected (int entryNum);
|
||||
int getSelected () const;
|
||||
void removeEntry(int position);
|
||||
void setButtonHint();
|
||||
void show ();
|
||||
void set_tooltip_text (const Glib::ustring &text);
|
||||
@@ -65,16 +76,22 @@ private:
|
||||
type_signal_changed messageChanged;
|
||||
type_signal_item_selected messageItemSelected;
|
||||
|
||||
std::vector<Glib::RefPtr<const Gio::Icon>> imageIcons;
|
||||
std::vector<Glib::ustring> imageFilenames;
|
||||
std::vector<const RTImage*> images;
|
||||
Glib::ustring buttonHint;
|
||||
RTImage* buttonImage;
|
||||
Gtk::Grid* imageContainer;
|
||||
Gtk::Menu* menu;
|
||||
std::unique_ptr<Gtk::Menu> menu;
|
||||
Gtk::Button* button;
|
||||
Gtk::Button* arrowButton;
|
||||
int selected;
|
||||
bool hasMenu;
|
||||
|
||||
void changeImage(int position);
|
||||
void changeImage(const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon);
|
||||
void entrySelected(Gtk::Widget* menuItem);
|
||||
bool insertEntryImpl(int position, const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon, RTImage* image, const Glib::ustring& label);
|
||||
void showMenu(GdkEventButton* event);
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user