Merge with "Beep6581/dev"
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <type_traits>
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
@@ -74,6 +75,17 @@ private:
|
||||
MyMutex mutex;
|
||||
};
|
||||
|
||||
struct ScopedEnumHash {
|
||||
template<typename T, typename std::enable_if<std::is_enum<T>::value && !std::is_convertible<T, int>::value, int>::type = 0>
|
||||
size_t operator ()(T val) const noexcept
|
||||
{
|
||||
using type = typename std::underlying_type<T>::type;
|
||||
|
||||
return std::hash<type>{}(static_cast<type>(val));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// TODO: The documentation says gdk_threads_enter and gdk_threads_leave should be replaced
|
||||
// by g_main_context_invoke(), g_idle_add() and related functions, but this will require more extensive changes.
|
||||
// We silence those warnings until then so that we notice the others.
|
||||
@@ -478,17 +490,56 @@ public:
|
||||
TextOrIcon (const Glib::ustring &icon_name, 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;
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> pimpl;
|
||||
|
||||
public:
|
||||
MyImageMenuItem (Glib::ustring label, Glib::ustring iconName);
|
||||
ImageAndLabel(const Glib::ustring& label, const Glib::ustring& iconName);
|
||||
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& iconName);
|
||||
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
|
||||
|
Reference in New Issue
Block a user