wxFrame::SetIcon()
it's possible now to call Close() after ShowModal() dialog sample works changed wxString::First() etc to return -1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,7 +54,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxWindow)
|
||||
wxDialog::wxDialog(void)
|
||||
{
|
||||
m_title = "";
|
||||
m_modalShowing = TRUE;
|
||||
m_modalShowing = FALSE;
|
||||
wxTopLevelWindows.Insert( this );
|
||||
};
|
||||
|
||||
@@ -63,6 +63,7 @@ wxDialog::wxDialog( wxWindow *parent,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxString &name )
|
||||
{
|
||||
m_modalShowing = FALSE;
|
||||
wxTopLevelWindows.Insert( this );
|
||||
Create( parent, id, title, pos, size, style, name );
|
||||
};
|
||||
@@ -76,8 +77,6 @@ bool wxDialog::Create( wxWindow *parent,
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_modalShowing = ((m_windowStyle & wxDIALOG_MODAL) == wxDIALOG_MODAL);
|
||||
|
||||
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||
|
||||
@@ -189,7 +188,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
|
||||
bool wxDialog::Show( bool show )
|
||||
{
|
||||
if (!show && m_modalShowing)
|
||||
if (!show && IsModal() && m_modalShowing)
|
||||
{
|
||||
EndModal( wxID_CANCEL );
|
||||
};
|
||||
@@ -198,25 +197,31 @@ bool wxDialog::Show( bool show )
|
||||
|
||||
if (show) InitDialog();
|
||||
|
||||
if (show && m_modalShowing)
|
||||
{
|
||||
gtk_grab_add( m_widget );
|
||||
gtk_main();
|
||||
gtk_grab_remove( m_widget );
|
||||
};
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
int wxDialog::ShowModal(void)
|
||||
{
|
||||
if (m_modalShowing) return GetReturnCode();
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
m_modalShowing = TRUE;
|
||||
|
||||
gtk_grab_add( m_widget );
|
||||
gtk_main();
|
||||
gtk_grab_remove( m_widget );
|
||||
|
||||
return GetReturnCode();
|
||||
};
|
||||
|
||||
void wxDialog::EndModal( int retCode )
|
||||
{
|
||||
SetReturnCode( retCode );
|
||||
|
||||
if (!m_modalShowing) return;
|
||||
m_modalShowing = FALSE;
|
||||
|
||||
gtk_main_quit();
|
||||
};
|
||||
|
||||
|
@@ -442,3 +442,16 @@ void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(
|
||||
gdk_window_set_hints( m_wxwindow->window, -1, -1,
|
||||
minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
|
||||
}
|
||||
|
||||
void wxFrame::SetIcon( const wxIcon &icon )
|
||||
{
|
||||
m_icon = icon;
|
||||
if (!icon.Ok()) return;
|
||||
|
||||
wxMask *mask = icon.GetMask();
|
||||
GdkBitmap *bm = NULL;
|
||||
if (mask) bm = mask->GetBitmap();
|
||||
|
||||
gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
|
||||
}
|
||||
|
||||
|
@@ -48,11 +48,11 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
|
||||
m_menus.Append( menu );
|
||||
menu->m_title = title; // ??????
|
||||
|
||||
size_t pos;
|
||||
int pos;
|
||||
do {
|
||||
pos = menu->m_title.First( '&' );
|
||||
if (pos != wxString::npos) menu->m_title.Remove( pos, 1 );
|
||||
} while (pos != wxString::npos);
|
||||
if (pos != -1) menu->m_title.Remove( pos, 1 );
|
||||
} while (pos != -1);
|
||||
|
||||
GtkWidget *root_menu;
|
||||
root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) );
|
||||
@@ -262,11 +262,11 @@ int wxMenu::FindItem( const wxString itemString ) const
|
||||
{
|
||||
wxString s( itemString );
|
||||
|
||||
size_t pos;
|
||||
int pos;
|
||||
do {
|
||||
pos = s.First( '&' );
|
||||
if (pos != wxString::npos) s.Remove( pos, 1 );
|
||||
} while (pos != wxString::npos);
|
||||
if (pos != -1) s.Remove( pos, 1 );
|
||||
} while (pos != -1);
|
||||
|
||||
wxNode *node = m_items.First();
|
||||
while (node)
|
||||
|
Reference in New Issue
Block a user