*/
// use native docking
#define wxMB_DOCKABLE 0x0001
+// make all menus tearoff menus, even if not set on per-menu basis
+#define wxMB_TEAROFF 0x0002
+/*
+ * wxMenu style flags
+ */
+#define wxMENU_TEAROFF 0x0001
/*
* Apply to all panel items
wxCURSOR_WAIT,
wxCURSOR_WATCH,
wxCURSOR_BLANK,
+#ifdef __WXGTK__
+ wxCURSOR_DEFAULT, // standard X11 cursor
+#endif
#ifdef __X__
// Not yet implemented for Windows
wxCURSOR_CROSS_REVERSE,
#include "wx/defs.h"
-#if wxUSE_CHOICE
-
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
void ApplyWidgetStyle();
};
-#endif
#endif // __GTKCHOICEH__
GtkItemFactory *m_factory;
wxList m_menus;
GtkWidget *m_menubar;
+ long m_style;
};
//-----------------------------------------------------------------------------
public:
wxMenu( const wxString& title = wxEmptyString,
- const wxFunction func = (wxFunction) NULL );
+ const wxFunction func = (wxFunction) NULL,
+ long style = 0);
+ wxMenu( long style );
~wxMenu();
// operations
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
-private:
+ // used by wxMenuBar
+ inline long GetStyle(void) const { return m_style; }
+ private:
+ // common code for both constructors:
+ void Init( const wxString& title,
+ const wxFunction func,
+ long style);
wxString m_title;
wxList m_items;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
void *m_clientData;
+ long m_style;
};
#endif // __GTKMENUH__
#include "wx/defs.h"
-#if wxUSE_CHOICE
-
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
void ApplyWidgetStyle();
};
-#endif
#endif // __GTKCHOICEH__
GtkItemFactory *m_factory;
wxList m_menus;
GtkWidget *m_menubar;
+ long m_style;
};
//-----------------------------------------------------------------------------
public:
wxMenu( const wxString& title = wxEmptyString,
- const wxFunction func = (wxFunction) NULL );
+ const wxFunction func = (wxFunction) NULL,
+ long style = 0);
+ wxMenu( long style );
~wxMenu();
// operations
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
-private:
+ // used by wxMenuBar
+ inline long GetStyle(void) const { return m_style; }
+ private:
+ // common code for both constructors:
+ void Init( const wxString& title,
+ const wxFunction func,
+ long style);
wxString m_title;
wxList m_items;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
void *m_clientData;
+ long m_style;
};
#endif // __GTKMENUH__
SetIcon(wxICON(mondrian));
// create a menu bar
- wxMenu *menuFile = new wxMenu;
+ wxMenu *menuFile = new wxMenu("File",NULL,wxMENU_TEAROFF);
menuFile->Append(Minimal_About, "&About...\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator();
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar...
- wxMenuBar *menuBar = new wxMenuBar;
+ wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame
// global data
//-----------------------------------------------------------------------------
+extern wxCursor g_globalCursor;
+
wxApp *wxTheApp = (wxApp *) NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
wxImage::InitStandardHandlers();
- /* no global cursor under X
- g_globalCursor = new wxCursor; */
+ g_globalCursor = wxCursor(wxCURSOR_DEFAULT);
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId)
{
+ case wxCURSOR_DEFAULT: gdk_cur = GDK_X_CURSOR; break;
case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
{
/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
-
+ m_style = style;
+
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" );
m_menus.DeleteContents( TRUE );
{
/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
-
+ m_style = 0;
+
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" );
m_menus.DeleteContents( TRUE );
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
- entry.item_type = "<Branch>";
+ entry.item_type = (m_style & wxMB_TEAROFF || menu->GetStyle() &
+ wxMENU_TEAROFF) ?
+ "<Tearoff>" : "<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
-wxMenu::wxMenu( const wxString& title, const wxFunction func )
+wxMenu::wxMenu( const wxString& title, const wxFunction func, long style )
+{
+ Init(title, func, style);
+}
+
+wxMenu::wxMenu(long style)
+{
+ Init(wxEmptyString, (wxFunction) NULL, style);
+}
+
+void
+wxMenu::Init( const wxString& title, const wxFunction func, long style )
{
m_title = title;
m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL;
+ m_style = style;
#if (GTK_MINOR_VERSION > 0)
m_accel = gtk_accel_group_new();
entry.path = buf;
entry.callback = (GtkItemFactoryCallback) 0;
entry.callback_action = 0;
- entry.item_type = "<Branch>";
+ entry.item_type = (m_style & wxMENU_TEAROFF) ? "<Tearoff>" : "<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
// global data
//-----------------------------------------------------------------------------
+extern wxCursor g_globalCursor;
+
wxApp *wxTheApp = (wxApp *) NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
wxImage::InitStandardHandlers();
- /* no global cursor under X
- g_globalCursor = new wxCursor; */
+ g_globalCursor = wxCursor(wxCURSOR_DEFAULT);
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId)
{
+ case wxCURSOR_DEFAULT: gdk_cur = GDK_X_CURSOR; break;
case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
{
/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
-
+ m_style = style;
+
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" );
m_menus.DeleteContents( TRUE );
{
/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
-
+ m_style = 0;
+
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" );
m_menus.DeleteContents( TRUE );
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
- entry.item_type = "<Branch>";
+ entry.item_type = (m_style & wxMB_TEAROFF || menu->GetStyle() &
+ wxMENU_TEAROFF) ?
+ "<Tearoff>" : "<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
-wxMenu::wxMenu( const wxString& title, const wxFunction func )
+wxMenu::wxMenu( const wxString& title, const wxFunction func, long style )
+{
+ Init(title, func, style);
+}
+
+wxMenu::wxMenu(long style)
+{
+ Init(wxEmptyString, (wxFunction) NULL, style);
+}
+
+void
+wxMenu::Init( const wxString& title, const wxFunction func, long style )
{
m_title = title;
m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL;
+ m_style = style;
#if (GTK_MINOR_VERSION > 0)
m_accel = gtk_accel_group_new();
entry.path = buf;
entry.callback = (GtkItemFactoryCallback) 0;
entry.callback_action = 0;
- entry.item_type = "<Branch>";
+ entry.item_type = (m_style & wxMENU_TEAROFF) ? "<Tearoff>" : "<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */