Add radio indicator to external editor selector

Make it easier to see that the selector is for changing the current
editor and not for immediately sending the image to the clicked-on
editor.
This commit is contained in:
Lawrence Lee
2023-01-15 15:10:54 -08:00
parent 194ef397a6
commit 22edf5f069
9 changed files with 186 additions and 56 deletions

View File

@@ -482,20 +482,56 @@ public:
TextOrIcon (const Glib::ustring &filename, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx);
};
class MyImageMenuItem final : public Gtk::MenuItem
/**
* Widget with image and label placed horizontally.
*/
class ImageAndLabel final : public Gtk::Box
{
private:
Gtk::Grid *box;
RTImage *image;
Gtk::Label *label;
void construct(Glib::ustring label, RTImage* image);
class Impl;
std::unique_ptr<Impl> pimpl;
public:
MyImageMenuItem (Glib::ustring label, Glib::ustring imageFileName);
MyImageMenuItem (Glib::ustring label, RTImage* image);
ImageAndLabel(const Glib::ustring& label, const Glib::ustring& imageFileName);
ImageAndLabel(const Glib::ustring& label, RTImage* image);
const RTImage* getImage() const;
const Gtk::Label* getLabel() const;
};
/**
* Menu item with an image and label.
*/
class MyImageMenuItemInterface
{
public:
virtual const Gtk::Label* getLabel() const = 0;
};
/**
* Basic image menu item.
*/
class MyImageMenuItem final : public Gtk::MenuItem, public MyImageMenuItemInterface
{
class Impl;
std::unique_ptr<Impl> pimpl;
public:
MyImageMenuItem (const Glib::ustring& label, const Glib::ustring& imageFileName);
MyImageMenuItem (const Glib::ustring& label, RTImage* image);
const RTImage *getImage () const;
const Gtk::Label* getLabel () const;
const Gtk::Label* getLabel() const override;
};
/**
* Image menu item with radio selector.
*/
class MyRadioImageMenuItem final : public Gtk::RadioMenuItem, public MyImageMenuItemInterface
{
class Impl;
std::unique_ptr<Impl> pimpl;
public:
MyRadioImageMenuItem(const Glib::ustring& label, RTImage* image, Gtk::RadioButton::Group& group);
const Gtk::Label* getLabel() const override;
};
class MyProgressBar final : public Gtk::ProgressBar