@@ -90,14 +90,14 @@ MenuItemType MenuItem::GetType() const {
9090 return pimpl_->type_ ;
9191}
9292
93- void MenuItem::SetText (const std::string& text ) {
94- pimpl_->title_ = text ;
93+ void MenuItem::SetLabel (const std::string& label ) {
94+ pimpl_->title_ = label ;
9595 if (pimpl_->gtk_menu_item_ && pimpl_->type_ != MenuItemType::Separator) {
96- gtk_menu_item_set_label (GTK_MENU_ITEM (pimpl_->gtk_menu_item_ ), text .c_str ());
96+ gtk_menu_item_set_label (GTK_MENU_ITEM (pimpl_->gtk_menu_item_ ), label .c_str ());
9797 }
9898}
9999
100- std::string MenuItem::GetText () const {
100+ std::string MenuItem::GetLabel () const {
101101 return pimpl_->title_ ;
102102}
103103
@@ -186,7 +186,7 @@ int MenuItem::GetRadioGroup() const {
186186void MenuItem::SetSubmenu (std::shared_ptr<Menu> submenu) {
187187 pimpl_->submenu_ = submenu;
188188 if (pimpl_->gtk_menu_item_ && submenu) {
189- gtk_menu_item_set_submenu (GTK_MENU_ITEM (pimpl_->gtk_menu_item_ ), (GtkWidget*)submenu->GetNativeMenu ());
189+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (pimpl_->gtk_menu_item_ ), (GtkWidget*)submenu->GetNativeObject ());
190190 }
191191}
192192
@@ -210,7 +210,7 @@ bool MenuItem::Trigger() {
210210 return false ;
211211}
212212
213- void * MenuItem::GetNativeItem () const {
213+ void * MenuItem::GetNativeObject () const {
214214 return (void *)pimpl_->gtk_menu_item_ ;
215215}
216216
@@ -264,9 +264,9 @@ Menu::~Menu() {
264264}
265265
266266void Menu::AddItem (std::shared_ptr<MenuItem> item) {
267- if (pimpl_->gtk_menu_ && item && item->GetNativeItem ()) {
267+ if (pimpl_->gtk_menu_ && item && item->GetNativeObject ()) {
268268 pimpl_->items_ .push_back (item);
269- gtk_menu_shell_append (GTK_MENU_SHELL (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeItem ());
269+ gtk_menu_shell_append (GTK_MENU_SHELL (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeObject ());
270270 }
271271}
272272
@@ -279,17 +279,17 @@ void Menu::InsertItem(size_t index, std::shared_ptr<MenuItem> item) {
279279 }
280280
281281 pimpl_->items_ .insert (pimpl_->items_ .begin () + index, item);
282- if (pimpl_->gtk_menu_ && item->GetNativeItem ()) {
283- gtk_menu_shell_insert (GTK_MENU_SHELL (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeItem (), index);
282+ if (pimpl_->gtk_menu_ && item->GetNativeObject ()) {
283+ gtk_menu_shell_insert (GTK_MENU_SHELL (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeObject (), index);
284284 }
285285}
286286
287287bool Menu::RemoveItem (std::shared_ptr<MenuItem> item) {
288- if (pimpl_->gtk_menu_ && item && item->GetNativeItem ()) {
288+ if (pimpl_->gtk_menu_ && item && item->GetNativeObject ()) {
289289 auto it = std::find (pimpl_->items_ .begin (), pimpl_->items_ .end (), item);
290290 if (it != pimpl_->items_ .end ()) {
291291 pimpl_->items_ .erase (it);
292- gtk_container_remove (GTK_CONTAINER (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeItem ());
292+ gtk_container_remove (GTK_CONTAINER (pimpl_->gtk_menu_ ), (GtkWidget*)item->GetNativeObject ());
293293 return true ;
294294 }
295295 }
@@ -355,7 +355,7 @@ std::vector<std::shared_ptr<MenuItem>> Menu::GetAllItems() const {
355355
356356std::shared_ptr<MenuItem> Menu::FindItemByText (const std::string& text, bool case_sensitive) const {
357357 for (const auto & item : pimpl_->items_ ) {
358- std::string item_text = item->GetText ();
358+ std::string item_text = item->GetLabel ();
359359 if (case_sensitive) {
360360 if (item_text == text) {
361361 return item;
@@ -430,7 +430,7 @@ std::shared_ptr<MenuItem> Menu::CreateAndAddSubmenu(const std::string& text, std
430430 return item;
431431}
432432
433- void * Menu::GetNativeMenu () const {
433+ void * Menu::GetNativeObject () const {
434434 return (void *)pimpl_->gtk_menu_ ;
435435}
436436
0 commit comments