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;
}
else {
#if 0 // this is not supported by GTK+, apparently
// several special cases
current.MakeUpper();
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") ) {
keyCode = VK_PRIOR;
}
else if ( current == wxT("PGDN") ) {
keyCode = VK_NEXT;
}
#endif
else
#endif // 0
{
wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
current.c_str());

View File

@@ -755,10 +755,10 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
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, 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+ww, yy+rr, xx+ww, yy+hh-rr );
gdk_draw_line( m_window, m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
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+1, xx, 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+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 );

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 -
// otherwise GTK+ 1.2.2 manages to override the memory we pass to it
// somehow! (VZ)
static char s_accel[32]; // must be big enough for <control><alt><shift>F12
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel));
static char s_accel[50]; // must be big enougg
wxString tmp( GetHotKey(*mitem) );
strncpy(s_accel, tmp.mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel;
#else // !wxUSE_ACCEL
entry.accelerator = (char*) NULL;
@@ -1090,6 +1091,20 @@ static wxString GetHotKey( const wxMenuItem& item )
case WXK_F12:
hotkey << wxT('F') << code - WXK_F1 + 1;
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,
// 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 ))
{
wxFAIL_MSG( wxT("wxStaticLine creation failed") );
return FALSE;
return FALSE;
}
if ( IsVertical() )
{
m_widget = gtk_vseparator_new();
if (size.x == -1)
{
wxSize new_size( size );
new_size.x = 4;
SetSize( new_size );
}
if (size.x == -1)
{
wxSize new_size( size );
new_size.x = 4;
SetSize( new_size );
}
}
else
{
m_widget = gtk_hseparator_new();
if (size.y == -1)
{
wxSize new_size( size );
new_size.y = 4;
SetSize( new_size );
}
if (size.y == -1)
{
wxSize new_size( size );
new_size.y = 4;
SetSize( new_size );
}
}
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)
{
gdk_draw_line( m_window, m_penGC, xx+rr, 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, yy+rr, 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+rr+1, yy, xx+ww-rr, yy );
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+1, xx, 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+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 );

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 -
// otherwise GTK+ 1.2.2 manages to override the memory we pass to it
// somehow! (VZ)
static char s_accel[32]; // must be big enough for <control><alt><shift>F12
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel));
static char s_accel[50]; // must be big enougg
wxString tmp( GetHotKey(*mitem) );
strncpy(s_accel, tmp.mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel;
#else // !wxUSE_ACCEL
entry.accelerator = (char*) NULL;
@@ -1090,6 +1091,20 @@ static wxString GetHotKey( const wxMenuItem& item )
case WXK_F12:
hotkey << wxT('F') << code - WXK_F1 + 1;
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,
// 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 ))
{
wxFAIL_MSG( wxT("wxStaticLine creation failed") );
return FALSE;
return FALSE;
}
if ( IsVertical() )
{
m_widget = gtk_vseparator_new();
if (size.x == -1)
{
wxSize new_size( size );
new_size.x = 4;
SetSize( new_size );
}
if (size.x == -1)
{
wxSize new_size( size );
new_size.x = 4;
SetSize( new_size );
}
}
else
{
m_widget = gtk_hseparator_new();
if (size.y == -1)
{
wxSize new_size( size );
new_size.y = 4;
SetSize( new_size );
}
if (size.y == -1)
{
wxSize new_size( size );
new_size.y = 4;
SetSize( new_size );
}
}
m_parent->DoAddChild( this );