mirror of https://github.com/bsnes-emu/bsnes.git
36 lines
917 B
C++
36 lines
917 B
C++
#if defined(Hiro_MenuItem)
|
|
|
|
namespace hiro {
|
|
|
|
static auto MenuItem_activate(GtkMenuItem*, pMenuItem* p) -> void {
|
|
p->self().doActivate();
|
|
}
|
|
|
|
auto pMenuItem::construct() -> void {
|
|
widget = gtk_image_menu_item_new_with_mnemonic("");
|
|
g_signal_connect(G_OBJECT(widget), "activate", G_CALLBACK(MenuItem_activate), (gpointer)this);
|
|
setImage(state().image);
|
|
setText(state().text);
|
|
}
|
|
|
|
auto pMenuItem::destruct() -> void {
|
|
if(widget) gtk_widget_destroy(widget), widget = nullptr;
|
|
}
|
|
|
|
auto pMenuItem::setImage(const Image& image) -> void {
|
|
if(image) {
|
|
GtkImage* gtkImage = CreateImage(image, true);
|
|
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), (GtkWidget*)gtkImage);
|
|
} else {
|
|
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), nullptr);
|
|
}
|
|
}
|
|
|
|
auto pMenuItem::setText(const string& text) -> void {
|
|
gtk_menu_item_set_label(GTK_MENU_ITEM(widget), _mnemonic(text));
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|