const wxString &helpStr = "", bool checkable = FALSE);
void Append(int id, const wxString &item,
wxMenu *subMenu, const wxString &helpStr = "" );
+ void Append(wxMenuItem *pItem);
void Break() {};
// find item by name/id
const wxString &helpStr = "", bool checkable = FALSE);
void Append(int id, const wxString &item,
wxMenu *subMenu, const wxString &helpStr = "" );
+ void Append(wxMenuItem *pItem);
void Break() {};
// find item by name/id
m_menubar = gtk_menu_bar_new();
- m_widget = GTK_WIDGET(m_menubar);
+ m_widget = GTK_WIDGET(m_menubar);
PostCreation();
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(text);
+ mitem->SetHelp(helpStr);
GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText());
- mitem->SetHelp(helpStr);
mitem->SetMenuItem(menuItem);
mitem->SetSubMenu(subMenu);
m_items.Append( mitem );
}
+void wxMenu::Append( wxMenuItem *item )
+{
+ m_items.Append( item );
+
+ GtkWidget *menuItem = (GtkWidget*) NULL;
+
+ if (item->IsSeparator())
+ menuItem = gtk_menu_item_new();
+ else if (item->IsSubMenu())
+ menuItem = gtk_menu_item_new_with_label(item->GetText());
+ else
+ menuItem = item->IsCheckable() ? gtk_check_menu_item_new_with_label(item->GetText())
+ : gtk_menu_item_new_with_label(item->GetText());
+
+ if (!item->IsSeparator())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "select",
+ GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
+ (gpointer*)this );
+
+ gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
+ GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
+ (gpointer*)this );
+
+ if (!item->IsSubMenu())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
+ GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
+ (gpointer*)this );
+ }
+ }
+
+ gtk_menu_append( GTK_MENU(m_menu), menuItem );
+ gtk_widget_show( menuItem );
+ item->SetMenuItem(menuItem);
+}
+
int wxMenu::FindItem( const wxString itemString ) const
{
wxString s( itemString );
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ win->GetEventHandler()->ProcessEvent( cevent );
}
//-----------------------------------------------------------------------------
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
-
+
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
event.SetOrientation( wxVERTICAL );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
}
//-----------------------------------------------------------------------------
{
/* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos;
+
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
/* bring editable's cursor uptodate. bug in GTK. */
float diff = win->m_vAdjust->value - win->m_oldVerticalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldVerticalPos = win->m_vAdjust->value;
wxEventType command = wxEVT_NULL;
float diff = win->m_hAdjust->value - win->m_oldHorizontalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldHorizontalPos = win->m_hAdjust->value;
wxEventType command = wxEVT_NULL;
void wxWindow::SetFont( const wxFont &font )
{
wxCHECK_RET( m_widget != NULL, "invalid window" );
-
+
+ if (m_font == font) return;
+
if (((wxFont*)&font)->Ok())
m_font = font;
else
m_menubar = gtk_menu_bar_new();
- m_widget = GTK_WIDGET(m_menubar);
+ m_widget = GTK_WIDGET(m_menubar);
PostCreation();
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(text);
+ mitem->SetHelp(helpStr);
GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText());
- mitem->SetHelp(helpStr);
mitem->SetMenuItem(menuItem);
mitem->SetSubMenu(subMenu);
m_items.Append( mitem );
}
+void wxMenu::Append( wxMenuItem *item )
+{
+ m_items.Append( item );
+
+ GtkWidget *menuItem = (GtkWidget*) NULL;
+
+ if (item->IsSeparator())
+ menuItem = gtk_menu_item_new();
+ else if (item->IsSubMenu())
+ menuItem = gtk_menu_item_new_with_label(item->GetText());
+ else
+ menuItem = item->IsCheckable() ? gtk_check_menu_item_new_with_label(item->GetText())
+ : gtk_menu_item_new_with_label(item->GetText());
+
+ if (!item->IsSeparator())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "select",
+ GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
+ (gpointer*)this );
+
+ gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
+ GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
+ (gpointer*)this );
+
+ if (!item->IsSubMenu())
+ {
+ gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
+ GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
+ (gpointer*)this );
+ }
+ }
+
+ gtk_menu_append( GTK_MENU(m_menu), menuItem );
+ gtk_widget_show( menuItem );
+ item->SetMenuItem(menuItem);
+}
+
int wxMenu::FindItem( const wxString itemString ) const
{
wxString s( itemString );
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ win->GetEventHandler()->ProcessEvent( cevent );
}
//-----------------------------------------------------------------------------
{
if (!win->HasVMT()) return;
if (g_blockEventsOnDrag) return;
-
+
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldPos = win->m_adjust->value;
wxEventType command = wxEVT_NULL;
event.SetOrientation( wxVERTICAL );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
}
//-----------------------------------------------------------------------------
{
/* this moves the cursor pos to behind the inserted text */
gint len = GTK_EDITABLE(m_text)->current_pos;
+
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
/* bring editable's cursor uptodate. bug in GTK. */
float diff = win->m_vAdjust->value - win->m_oldVerticalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldVerticalPos = win->m_vAdjust->value;
wxEventType command = wxEVT_NULL;
float diff = win->m_hAdjust->value - win->m_oldHorizontalPos;
if (fabs(diff) < 0.2) return;
+ win->m_oldHorizontalPos = win->m_hAdjust->value;
wxEventType command = wxEVT_NULL;
void wxWindow::SetFont( const wxFont &font )
{
wxCHECK_RET( m_widget != NULL, "invalid window" );
-
+
+ if (m_font == font) return;
+
if (((wxFont*)&font)->Ok())
m_font = font;
else
gtk_signal_connect( GTK_OBJECT(m_glWidget), "draw",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+ /* connect to key press and mouse handlers etc. */
+ ConnectWidget( m_glWidget );
+
gtk_widget_show( m_glWidget );
m_glContext = new wxGLContext( TRUE, this, palette );