projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add sections to advanced library for each unix-based platform
[wxWidgets.git]
/
src
/
gtk1
/
menu.cpp
diff --git
a/src/gtk1/menu.cpp
b/src/gtk1/menu.cpp
index 89b6206f64591d45f98ce8c425c59e7ff3c94d6f..fa3f149dd054385613bb75c1d021055647c90e97 100644
(file)
--- a/
src/gtk1/menu.cpp
+++ b/
src/gtk1/menu.cpp
@@
-11,10
+11,14
@@
#include "wx/wxprec.h"
#include "wx/menu.h"
#include "wx/wxprec.h"
#include "wx/menu.h"
-#include "wx/log.h"
-#include "wx/intl.h"
-#include "wx/app.h"
-#include "wx/bitmap.h"
+#include "wx/stockitem.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/app.h"
+ #include "wx/bitmap.h"
+#endif
#if wxUSE_ACCEL
#include "wx/accel.h"
#if wxUSE_ACCEL
#include "wx/accel.h"
@@
-762,8
+766,16
@@
wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
return label;
}
return label;
}
-void wxMenuItem::SetText( const wxString& str )
+void wxMenuItem::SetText( const wxString& str
ing
)
{
{
+ wxString str = string;
+ if ( str.empty() && !IsSeparator() )
+ {
+ wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
+ str = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR |
+ wxSTOCK_WITH_MNEMONIC);
+ }
+
// Some optimization to avoid flicker
wxString oldLabel = m_text;
oldLabel = wxStripMenuCodes(oldLabel);
// Some optimization to avoid flicker
wxString oldLabel = m_text;
oldLabel = wxStripMenuCodes(oldLabel);
@@
-854,8
+866,6
@@
void wxMenuItem::DoSetText( const wxString& str )
pc++;
m_hotKey = pc;
}
pc++;
m_hotKey = pc;
}
-
- // wxPrintf( wxT("DoSetText(): str %s m_text %s hotkey %s\n"), str.c_str(), m_text.c_str(), m_hotKey.c_str() );
}
#if wxUSE_ACCEL
}
#if wxUSE_ACCEL
@@
-868,11
+878,12
@@
wxAcceleratorEntry *wxMenuItem::GetAccel() const
return (wxAcceleratorEntry *)NULL;
}
return (wxAcceleratorEntry *)NULL;
}
- // as wxGetAccelFromString() looks for TAB, insert a dummy one here
+ // accelerator parsing code looks for them after a TAB, so insert a dummy
+ // one here
wxString label;
label << wxT('\t') << GetHotKey();
wxString label;
label << wxT('\t') << GetHotKey();
- return wx
GetAccelFromString
(label);
+ return wx
AcceleratorEntry::Create
(label);
}
#endif // wxUSE_ACCEL
}
#endif // wxUSE_ACCEL
@@
-984,7
+995,7
@@
bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
text = mitem->GetText();
const wxBitmap *bitmap = &mitem->GetBitmap();
text = mitem->GetText();
const wxBitmap *bitmap = &mitem->GetBitmap();
- // TODO
+
// TODO
wxUnusedVar(bitmap);
menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
label = GTK_LABEL( GTK_BIN(menuItem)->child );
wxUnusedVar(bitmap);
menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
label = GTK_LABEL( GTK_BIN(menuItem)->child );
@@
-1412,7
+1423,7
@@
static wxString GetGtkHotKey( const wxMenuItem& item )
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
break;
*/
hotkey += wxString::Format(wxT("Special%d"), code - WXK_SPECIAL1 + 1);
break;
*/
- // if there are any other keys wx
GetAccelFromString
() may
+ // if there are any other keys wx
AcceleratorEntry::Create
() may
// return, we should process them here
default:
// return, we should process them here
default:
@@
-1446,7
+1457,7
@@
static wxString GetGtkHotKey( const wxMenuItem& item )
extern "C" WXDLLIMPEXP_CORE
void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{
extern "C" WXDLLIMPEXP_CORE
void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{
- *is_waiting =
FALSE
;
+ *is_waiting =
false
;
}
WXDLLIMPEXP_CORE void SetInvokingWindow( wxMenu *menu, wxWindow* win )
}
WXDLLIMPEXP_CORE void SetInvokingWindow( wxMenu *menu, wxWindow* win )