Added supprot for INSERT and DELETE in wxGTK menus,

Applied Dima's correction for DrawRoundedRectangle,
  Corrected indentation.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7750 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-07-17 11:50:35 +00:00
parent afe121c935
commit f9e9953e80
7 changed files with 80 additions and 41 deletions

View File

@@ -498,20 +498,29 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
keyCode = WXK_F1 + n - 1; keyCode = WXK_F1 + n - 1;
} }
else { else {
#if 0 // this is not supported by GTK+, apparently
// several special cases // several special cases
current.MakeUpper(); current.MakeUpper();
if ( current == wxT("DEL") ) { if ( current == wxT("DEL") ) {
keyCode = VK_DELETE; keyCode = WXK_DELETE;
} }
else if ( current == wxT("DELETE") ) {
keyCode = WXK_DELETE;
}
else if ( current == wxT("INS") ) {
keyCode = WXK_INSERT;
}
else if ( current == wxT("INSERT") ) {
keyCode = WXK_INSERT;
}
#if 0
else if ( current == wxT("PGUP") ) { else if ( current == wxT("PGUP") ) {
keyCode = VK_PRIOR; keyCode = VK_PRIOR;
} }
else if ( current == wxT("PGDN") ) { else if ( current == wxT("PGDN") ) {
keyCode = VK_NEXT; keyCode = VK_NEXT;
} }
#endif
else else
#endif // 0
{ {
wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."), wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
current.c_str()); current.c_str());

View File

@@ -755,10 +755,10 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
gdk_draw_line( m_window, m_penGC, xx+rr, yy, xx+ww-rr, yy ); gdk_draw_line( m_window, m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
gdk_draw_line( m_window, m_penGC, xx+rr, yy+hh, xx+ww-rr, yy+hh ); gdk_draw_line( m_window, m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
gdk_draw_line( m_window, m_penGC, xx, yy+rr, xx, yy+hh-rr ); gdk_draw_line( m_window, m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr, xx+ww, yy+hh-rr ); gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );

View File

@@ -948,8 +948,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
// due to an apparent bug in GTK+, we have to use a static buffer here - // due to an apparent bug in GTK+, we have to use a static buffer here -
// otherwise GTK+ 1.2.2 manages to override the memory we pass to it // otherwise GTK+ 1.2.2 manages to override the memory we pass to it
// somehow! (VZ) // somehow! (VZ)
static char s_accel[32]; // must be big enough for <control><alt><shift>F12 static char s_accel[50]; // must be big enougg
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel)); wxString tmp( GetHotKey(*mitem) );
strncpy(s_accel, tmp.mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel; entry.accelerator = s_accel;
#else // !wxUSE_ACCEL #else // !wxUSE_ACCEL
entry.accelerator = (char*) NULL; entry.accelerator = (char*) NULL;
@@ -1091,6 +1092,20 @@ static wxString GetHotKey( const wxMenuItem& item )
hotkey << wxT('F') << code - WXK_F1 + 1; hotkey << wxT('F') << code - WXK_F1 + 1;
break; break;
// GTK seems to use XStringToKeySym here
case WXK_NUMPAD_INSERT:
hotkey << wxT("KP_Insert" );
break;
case WXK_NUMPAD_DELETE:
hotkey << wxT("KP_Delete" );
break;
case WXK_INSERT:
hotkey << wxT("Insert" );
break;
case WXK_DELETE:
hotkey << wxT("Delete" );
break;
// if there are any other keys wxGetAccelFromString() may return, // if there are any other keys wxGetAccelFromString() may return,
// we should process them here // we should process them here

View File

@@ -45,28 +45,28 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxStaticLine creation failed") ); wxFAIL_MSG( wxT("wxStaticLine creation failed") );
return FALSE; return FALSE;
} }
if ( IsVertical() ) if ( IsVertical() )
{ {
m_widget = gtk_vseparator_new(); m_widget = gtk_vseparator_new();
if (size.x == -1) if (size.x == -1)
{ {
wxSize new_size( size ); wxSize new_size( size );
new_size.x = 4; new_size.x = 4;
SetSize( new_size ); SetSize( new_size );
} }
} }
else else
{ {
m_widget = gtk_hseparator_new(); m_widget = gtk_hseparator_new();
if (size.y == -1) if (size.y == -1)
{ {
wxSize new_size( size ); wxSize new_size( size );
new_size.y = 4; new_size.y = 4;
SetSize( new_size ); SetSize( new_size );
} }
} }
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );

View File

@@ -755,10 +755,10 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
gdk_draw_line( m_window, m_penGC, xx+rr, yy, xx+ww-rr, yy ); gdk_draw_line( m_window, m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
gdk_draw_line( m_window, m_penGC, xx+rr, yy+hh, xx+ww-rr, yy+hh ); gdk_draw_line( m_window, m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
gdk_draw_line( m_window, m_penGC, xx, yy+rr, xx, yy+hh-rr ); gdk_draw_line( m_window, m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr, xx+ww, yy+hh-rr ); gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );

View File

@@ -948,8 +948,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
// due to an apparent bug in GTK+, we have to use a static buffer here - // due to an apparent bug in GTK+, we have to use a static buffer here -
// otherwise GTK+ 1.2.2 manages to override the memory we pass to it // otherwise GTK+ 1.2.2 manages to override the memory we pass to it
// somehow! (VZ) // somehow! (VZ)
static char s_accel[32]; // must be big enough for <control><alt><shift>F12 static char s_accel[50]; // must be big enougg
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel)); wxString tmp( GetHotKey(*mitem) );
strncpy(s_accel, tmp.mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel; entry.accelerator = s_accel;
#else // !wxUSE_ACCEL #else // !wxUSE_ACCEL
entry.accelerator = (char*) NULL; entry.accelerator = (char*) NULL;
@@ -1091,6 +1092,20 @@ static wxString GetHotKey( const wxMenuItem& item )
hotkey << wxT('F') << code - WXK_F1 + 1; hotkey << wxT('F') << code - WXK_F1 + 1;
break; break;
// GTK seems to use XStringToKeySym here
case WXK_NUMPAD_INSERT:
hotkey << wxT("KP_Insert" );
break;
case WXK_NUMPAD_DELETE:
hotkey << wxT("KP_Delete" );
break;
case WXK_INSERT:
hotkey << wxT("Insert" );
break;
case WXK_DELETE:
hotkey << wxT("Delete" );
break;
// if there are any other keys wxGetAccelFromString() may return, // if there are any other keys wxGetAccelFromString() may return,
// we should process them here // we should process them here

View File

@@ -45,28 +45,28 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{ {
wxFAIL_MSG( wxT("wxStaticLine creation failed") ); wxFAIL_MSG( wxT("wxStaticLine creation failed") );
return FALSE; return FALSE;
} }
if ( IsVertical() ) if ( IsVertical() )
{ {
m_widget = gtk_vseparator_new(); m_widget = gtk_vseparator_new();
if (size.x == -1) if (size.x == -1)
{ {
wxSize new_size( size ); wxSize new_size( size );
new_size.x = 4; new_size.x = 4;
SetSize( new_size ); SetSize( new_size );
} }
} }
else else
{ {
m_widget = gtk_hseparator_new(); m_widget = gtk_hseparator_new();
if (size.y == -1) if (size.y == -1)
{ {
wxSize new_size( size ); wxSize new_size( size );
new_size.y = 4; new_size.y = 4;
SetSize( new_size ); SetSize( new_size );
} }
} }
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );