// key code mapping routines
//-----------------------------------------------------------------------------
-static long map_to_unmodified_wx_keysym( KeySym keysym )
+static long map_to_unmodified_wx_keysym( GdkEventKey *event )
{
+ KeySym keysym = event->keyval;
guint key_code = 0;
switch (keysym)
case GDK_F12: key_code = WXK_F12; break;
default:
{
- if ((keysym & 0xF000) == 0)
+ if (event->length == 1)
+ {
+ key_code = toupper( (unsigned char)*event->string );
+ }
+ else if ((keysym & 0xFF) == keysym)
{
guint upper = gdk_keyval_to_upper( (guint)keysym );
keysym = (upper != 0 ? upper : keysym ); /* to be MSW compatible */
return (key_code);
}
-static long map_to_wx_keysym( KeySym keysym )
+static long map_to_wx_keysym( GdkEventKey *event )
{
+ KeySym keysym = event->keyval;
guint key_code = 0;
switch (keysym)
case GDK_F12: key_code = WXK_F12; break;
default:
{
- if ((keysym & 0xF000) == 0)
+ if (event->length == 1)
+ {
+ key_code = (unsigned char)*event->string;
+ }
+ else if ((keysym & 0xFF) == keysym)
{
key_code = (guint)keysym;
}
bool ret = FALSE;
- long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
+ long key_code = map_to_unmodified_wx_keysym( gdk_event );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
/* wxMSW doesn't send char events with Alt pressed */
/* Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
will only be sent if it is not in an accelerator table. */
- key_code = map_to_wx_keysym( gdk_event->keyval );
+ key_code = map_to_wx_keysym( gdk_event );
if ( (!ret) &&
(key_code != 0))
printf( "\n" );
*/
- long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
+ long key_code = map_to_unmodified_wx_keysym( gdk_event );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
return TRUE;
}
+static void wxWindowNotifyEnable(wxWindow* win, bool enable)
+{
+ win->OnParentEnable(enable);
+
+ // Recurse, so that children have the opportunity to Do The Right Thing
+ // and reset colours that have been messed up by a parent's (really ancestor's)
+ // Enable call
+ for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
+ wxWindowNotifyEnable(child, enable);
+ }
+}
+
bool wxWindow::Enable( bool enable )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
if ( m_wxwindow )
gtk_widget_set_sensitive( m_wxwindow, enable );
- // Recurse, so that children have the opportunity to Do The Right Thing.
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = node->GetData();
- if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
- child->Enable(enable);
- }
+ wxWindowNotifyEnable(this, enable);
return TRUE;
}