Generate image for disabled toolbar buttons and menu items.

Fixes #13.

Removed IconMenu class, use add_menu_item/add_menu_item_tr instead.
Added _tr variants that automatically do locale translation
This commit is contained in:
Twan van Laarhoven
2020-05-01 03:26:02 +02:00
parent 8468c5bd93
commit 1fb3f15aff
37 changed files with 355 additions and 414 deletions
+1 -2
View File
@@ -12,7 +12,6 @@
#include <gui/control/card_editor.hpp>
#include <render/value/viewer.hpp>
class IconMenu;
class ValueAction;
DECLARE_POINTER_TYPE(ValueActionPerformer);
@@ -56,7 +55,7 @@ class ValueEditor {
/// a context menu is requested, add extra items to the menu m
/** return false to suppress menu */
virtual bool onContextMenu(IconMenu& m, wxContextMenuEvent& ev) { return true; }
virtual bool onContextMenu(wxMenu& m, wxContextMenuEvent& ev) { return true; }
/// Get a special menu, events will be sent to onMenu
virtual wxMenu* getMenu(int type) const { return nullptr; }
/// A menu item was selected, return true if the command was processed
+2 -3
View File
@@ -8,7 +8,6 @@
#include <util/prec.hpp>
#include <gui/value/text.hpp>
#include <gui/icon_menu.hpp>
#include <gui/util.hpp>
#include <gui/drop_down_list.hpp>
#include <data/word_list.hpp>
@@ -552,12 +551,12 @@ void TextValueEditor::onLoseFocus() {
//selection_start_i = selection_end_i = 0;
}
bool TextValueEditor::onContextMenu(IconMenu& m, wxContextMenuEvent& ev) {
bool TextValueEditor::onContextMenu(wxMenu& m, wxContextMenuEvent& ev) {
// in a keword? => "reminder text" option
size_t kwpos = in_tag(value().value(), _("<kw-"), selection_start_i, selection_start_i);
if (kwpos != String::npos) {
m.InsertSeparator(0);
m.Insert(0,ID_FORMAT_REMINDER, _("reminder"), _MENU_("reminder text"), _HELP_("reminder text"), wxITEM_CHECK);
m.Insert(0, make_menu_item_tr(&m, ID_FORMAT_REMINDER, "reminder", "reminder_text", wxITEM_CHECK));
}
// in a spelling error? => show suggestions and "add to dictionary"
size_t error_pos = in_tag(value().value(), _("<error-spelling"), selection_start_i, selection_start_i);
+1 -1
View File
@@ -45,7 +45,7 @@ class TextValueEditor : public TextValueViewer, public ValueEditor {
virtual void onMouseLeave(const RealPoint& pos, wxMouseEvent&);
virtual bool onMouseWheel(const RealPoint& pos, wxMouseEvent&);
virtual bool onContextMenu(IconMenu& m, wxContextMenuEvent&);
virtual bool onContextMenu(wxMenu& m, wxContextMenuEvent&);
virtual wxMenu* getMenu(int type) const;
virtual bool onCommand(int);