// get the panel which represents the given page
wxWindow *GetPage(int nPage) const;
+ void OnNavigationKey(wxNavigationKeyEvent& event);
// implementation
size_t m_idHandler; // the change page handler id
DECLARE_DYNAMIC_CLASS(wxNotebook)
+ DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// get the panel which represents the given page
wxWindow *GetPage(int nPage) const;
+ void OnNavigationKey(wxNavigationKeyEvent& event);
// implementation
size_t m_idHandler; // the change page handler id
DECLARE_DYNAMIC_CLASS(wxNotebook)
+ DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
currentX += width + 5;
toolBar->AddSeparator();
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
+
+ toolBar->EnableTool( wxID_PRINT, FALSE );
toolBar->Realize();
if (g_blockEventsOnDrag) return FALSE;
if (!notebook->HasVMT()) return FALSE;
+
+ /* this code makes jumping down from the handles of the notebooks
+ to the actual items in the visible notebook page possible with
+ the down-arrow key */
if (gdk_event->keyval != GDK_Down) return FALSE;
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+ EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
+END_EVENT_TABLE()
+
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
if (bForward)
SetSelection( sel == max ? 0 : sel + 1 );
else
- SetSelection( sel == 0 ? max : sel - 1 );
+ SetSelection( sel == 0 ? max-1 : sel - 1 );
}
void wxNotebook::SetImageList( wxImageList* imageList )
return TRUE;
}
+void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
+{
+ if (event.IsWindowChange())
+ AdvanceSelection( event.GetDirection() );
+ else
+ event.Skip();
+}
+
wxWindow *wxNotebook::GetPage( int page ) const
{
wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );
GdkEventCrossing *WXUNUSED(gdk_event), wxToolBarTool *tool )
{
if (g_blockEventsOnDrag) return TRUE;
+
+ /* we grey-out the tip text of disabled tool */
+
+ wxToolBar *tb = tool->m_owner;
+
+ if (tool->m_enabled)
+ {
+ if (tb->m_fg->red != 0)
+ {
+ tb->m_fg->red = 0;
+ tb->m_fg->green = 0;
+ tb->m_fg->blue = 0;
+ gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg );
+ gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
+ }
+ }
+ else
+ {
+ if (tb->m_fg->red == 0)
+ {
+ tb->m_fg->red = 33000;
+ tb->m_fg->green = 33000;
+ tb->m_fg->blue = 33000;
+ gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg );
+ gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
+ }
+ }
+
+ /* emit the event */
- tool->m_owner->OnMouseEnter( tool->m_index );
+ tb->OnMouseEnter( tool->m_index );
return FALSE;
}
{
tool->m_enabled = enable;
+/* we don't disable the tools for now as the bitmaps don't get
+ greyed anyway and this also disables tooltips
+
if (tool->m_item)
gtk_widget_set_sensitive( tool->m_item, enable );
+*/
return;
}
((win->m_windowStyle & wxTE_PROCESS_TAB) == 0))
{
wxNavigationKeyEvent new_event;
+ /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
- new_event.SetWindowChange( FALSE );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
+ if ( (!ret) &&
+ (gdk_event->keyval == GDK_Escape) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( win );
+ ret = win->GetEventHandler()->ProcessEvent( new_event );
+ }
+
/*
+ Damn, I forgot why this didn't work, but it didn't work.
+
// win is a panel: up can be propagated to the panel
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
(gdk_event->keyval == GDK_Up))
if (ret)
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
}
return ret;
if (g_blockEventsOnDrag) return FALSE;
if (!notebook->HasVMT()) return FALSE;
+
+ /* this code makes jumping down from the handles of the notebooks
+ to the actual items in the visible notebook page possible with
+ the down-arrow key */
if (gdk_event->keyval != GDK_Down) return FALSE;
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+ EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
+END_EVENT_TABLE()
+
void wxNotebook::Init()
{
m_imageList = (wxImageList *) NULL;
if (bForward)
SetSelection( sel == max ? 0 : sel + 1 );
else
- SetSelection( sel == 0 ? max : sel - 1 );
+ SetSelection( sel == 0 ? max-1 : sel - 1 );
}
void wxNotebook::SetImageList( wxImageList* imageList )
return TRUE;
}
+void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
+{
+ if (event.IsWindowChange())
+ AdvanceSelection( event.GetDirection() );
+ else
+ event.Skip();
+}
+
wxWindow *wxNotebook::GetPage( int page ) const
{
wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, "invalid notebook" );
GdkEventCrossing *WXUNUSED(gdk_event), wxToolBarTool *tool )
{
if (g_blockEventsOnDrag) return TRUE;
+
+ /* we grey-out the tip text of disabled tool */
+
+ wxToolBar *tb = tool->m_owner;
+
+ if (tool->m_enabled)
+ {
+ if (tb->m_fg->red != 0)
+ {
+ tb->m_fg->red = 0;
+ tb->m_fg->green = 0;
+ tb->m_fg->blue = 0;
+ gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg );
+ gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
+ }
+ }
+ else
+ {
+ if (tb->m_fg->red == 0)
+ {
+ tb->m_fg->red = 33000;
+ tb->m_fg->green = 33000;
+ tb->m_fg->blue = 33000;
+ gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg );
+ gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
+ }
+ }
+
+ /* emit the event */
- tool->m_owner->OnMouseEnter( tool->m_index );
+ tb->OnMouseEnter( tool->m_index );
return FALSE;
}
{
tool->m_enabled = enable;
+/* we don't disable the tools for now as the bitmaps don't get
+ greyed anyway and this also disables tooltips
+
if (tool->m_item)
gtk_widget_set_sensitive( tool->m_item, enable );
+*/
return;
}
((win->m_windowStyle & wxTE_PROCESS_TAB) == 0))
{
wxNavigationKeyEvent new_event;
+ /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
- new_event.SetWindowChange( FALSE );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
new_event.SetCurrentFocus( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
+ if ( (!ret) &&
+ (gdk_event->keyval == GDK_Escape) )
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( win );
+ ret = win->GetEventHandler()->ProcessEvent( new_event );
+ }
+
/*
+ Damn, I forgot why this didn't work, but it didn't work.
+
// win is a panel: up can be propagated to the panel
if ((!ret) && (win->m_wxwindow) && (win->m_parent) && (win->m_parent->AcceptsFocus()) &&
(gdk_event->keyval == GDK_Up))
if (ret)
{
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
}
return ret;