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:
parent
e3e65dac0c
commit
d355d3fe69
@ -7,6 +7,8 @@
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
# define wxFontDialog wxGenericFontDialog
|
||||
# define classwxFontDialog classwxGenericFontDialog
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -31,6 +31,7 @@ class wxMemoryDC;
|
||||
class wxToolBar;
|
||||
class wxBitmapButton;
|
||||
class wxStaticBitmap;
|
||||
class wxFrame;
|
||||
|
||||
class wxMask;
|
||||
class wxBitmap;
|
||||
@ -59,6 +60,7 @@ class wxMask: public wxObject
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
friend wxFrame;
|
||||
|
||||
GdkBitmap *GetBitmap() const;
|
||||
|
||||
@ -119,6 +121,7 @@ class wxBitmap: public wxObject
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
friend wxFrame;
|
||||
|
||||
GdkPixmap *GetPixmap() const;
|
||||
GdkBitmap *GetBitmap() const;
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
|
||||
void SetTitle( const wxString &title );
|
||||
wxString GetTitle() const { return m_title; }
|
||||
|
||||
void SetIcon( const wxIcon &icon );
|
||||
|
||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
||||
void OnSize( wxSizeEvent &event );
|
||||
@ -104,6 +106,7 @@ private:
|
||||
bool m_doingOnSize;
|
||||
bool m_addPrivateChild; // for toolbar (and maybe menubar)
|
||||
wxString m_title;
|
||||
wxIcon m_icon;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -31,6 +31,7 @@ class wxMemoryDC;
|
||||
class wxToolBar;
|
||||
class wxBitmapButton;
|
||||
class wxStaticBitmap;
|
||||
class wxFrame;
|
||||
|
||||
class wxMask;
|
||||
class wxBitmap;
|
||||
@ -59,6 +60,7 @@ class wxMask: public wxObject
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
friend wxFrame;
|
||||
|
||||
GdkBitmap *GetBitmap() const;
|
||||
|
||||
@ -119,6 +121,7 @@ class wxBitmap: public wxObject
|
||||
friend wxToolBar;
|
||||
friend wxBitmapButton;
|
||||
friend wxStaticBitmap;
|
||||
friend wxFrame;
|
||||
|
||||
GdkPixmap *GetPixmap() const;
|
||||
GdkBitmap *GetBitmap() const;
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
|
||||
void SetTitle( const wxString &title );
|
||||
wxString GetTitle() const { return m_title; }
|
||||
|
||||
void SetIcon( const wxIcon &icon );
|
||||
|
||||
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
|
||||
void OnSize( wxSizeEvent &event );
|
||||
@ -104,6 +106,7 @@ private:
|
||||
bool m_doingOnSize;
|
||||
bool m_addPrivateChild; // for toolbar (and maybe menubar)
|
||||
wxString m_title;
|
||||
wxIcon m_icon;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -537,13 +537,13 @@ public:
|
||||
wxString& Remove(size_t nStart, size_t nLen)
|
||||
{ return erase( nStart, nLen ); }
|
||||
|
||||
size_t First( const char ch ) const { return find(ch); }
|
||||
size_t First( const char* psz ) const { return find(psz); }
|
||||
size_t First( const wxString &str ) const { return find(str); }
|
||||
int First( const char ch ) const { size_t res = find(ch); return res == wxString::npos ? -1 : res; }
|
||||
int First( const char* psz ) const { size_t res = find(psz); return res == wxString::npos ? -1 : res; }
|
||||
int First( const wxString &str ) const { size_t res = find(str); return res == wxString::npos ? -1 : res; }
|
||||
|
||||
size_t Last( const char ch ) const { return rfind(ch,0); }
|
||||
size_t Last( const char* psz ) const { return rfind(psz,0); }
|
||||
size_t Last( const wxString &str ) const { return rfind(str,0); }
|
||||
int Last( const char ch ) const { size_t res = rfind(ch,0); return res == wxString::npos ? -1 : res; }
|
||||
int Last( const char* psz ) const { size_t res = rfind(psz,0); return res == wxString::npos ? -1 : res; }
|
||||
int Last( const wxString &str ) const { size_t res = rfind(str,0); return res == wxString::npos ? -1 : res; }
|
||||
|
||||
/// same as IsEmpty
|
||||
bool IsNull() const { return IsEmpty(); }
|
||||
|
@ -110,15 +110,17 @@ implemented.
|
||||
* Compiling
|
||||
-------------
|
||||
|
||||
This must be done in ~/wxGTK
|
||||
The following must be done in ~/wxGTK
|
||||
|
||||
First you have to create all makefiles in all subdirectories:
|
||||
|
||||
make makefiles
|
||||
make Makefiles
|
||||
|
||||
Dependencies are generated automatically using
|
||||
|
||||
make depend
|
||||
|
||||
for some reason, this doesn't seem to work.
|
||||
|
||||
Now the makefiles are created you can compile everything is as simple
|
||||
as typing:
|
||||
@ -160,7 +162,7 @@ will do the work for you.
|
||||
--------------------------
|
||||
|
||||
I propose to put all contributed programs in the directory
|
||||
"~/wcGTK/user", with a directory of its own.
|
||||
"~/wxGTK/user", with a directory of its own.
|
||||
|
||||
This directory then should include the following files:
|
||||
|
||||
@ -186,7 +188,7 @@ this will include all the necessary definitions for creating the applications
|
||||
|
||||
the only case where you might want to add another line is the following:
|
||||
this version of configure also supports creation of source archives of the
|
||||
application for easy distribution and updates to newer version of wxxt.
|
||||
application for easy distribution and updates to newer version of wxGTK.
|
||||
For this purpose all files in the application-directory will be put into
|
||||
a gziped tar-file in the full notation user/<your application>/*
|
||||
if you want to include some other files that you want "more visible", like
|
||||
@ -206,7 +208,7 @@ distribution is:
|
||||
|
||||
make distrib
|
||||
|
||||
NOTE: If you are in the base directory of wxxt it will create
|
||||
NOTE: If you are in the base directory of wxGTK it will create
|
||||
distribution packages for wxxt as well as for all packages in the
|
||||
user directory.
|
||||
So if you want to create only packages for the files in user,
|
||||
|
1
samples/dialogs/Makefile
Normal file
1
samples/dialogs/Makefile
Normal file
@ -0,0 +1 @@
|
||||
include ../../src/gtk/setup/general/makeapp
|
26
samples/dialogs/Makefile.in
Normal file
26
samples/dialogs/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
||||
# WXXT base directory
|
||||
WXBASEDIR=@WXBASEDIR@
|
||||
|
||||
# set the OS type for compilation
|
||||
OS=@OS@
|
||||
# compile a library only
|
||||
RULE=bin
|
||||
|
||||
# define library name
|
||||
BIN_TARGET=test
|
||||
# define library sources
|
||||
BIN_SRC=\
|
||||
dialogs.cpp
|
||||
|
||||
#define library objects
|
||||
BIN_OBJ=\
|
||||
dialogs.o
|
||||
|
||||
# additional things needed to link
|
||||
BIN_LINK=
|
||||
|
||||
# additional things needed to compile
|
||||
ADD_COMPILE=
|
||||
|
||||
# include the definitions now
|
||||
include ../../../template.mak
|
@ -103,7 +103,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, co
|
||||
wxFrame(parent, -1, title, pos, size)
|
||||
{}
|
||||
|
||||
void MyFrame::ChooseColour(wxCommandEvent& event)
|
||||
void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxColourData data;
|
||||
data.SetChooseFull(TRUE);
|
||||
@ -126,7 +126,7 @@ void MyFrame::ChooseColour(wxCommandEvent& event)
|
||||
dialog->Close();
|
||||
}
|
||||
|
||||
void MyFrame::ChooseFont(wxCommandEvent& event)
|
||||
void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxFontData data;
|
||||
data.SetInitialFont(wxGetApp().m_canvasFont);
|
||||
@ -144,7 +144,7 @@ void MyFrame::ChooseFont(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
#if !defined(__WXMSW__) || USE_GENERIC_DIALOGS_IN_MSW
|
||||
void MyFrame::ChooseColourGeneric(wxCommandEvent& event)
|
||||
void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxColourData data;
|
||||
data.SetChooseFull(TRUE);
|
||||
@ -167,7 +167,7 @@ void MyFrame::ChooseColourGeneric(wxCommandEvent& event)
|
||||
dialog->Close();
|
||||
}
|
||||
|
||||
void MyFrame::ChooseFontGeneric(wxCommandEvent& event)
|
||||
void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxFontData data;
|
||||
data.SetInitialFont(wxGetApp().m_canvasFont);
|
||||
@ -185,7 +185,7 @@ void MyFrame::ChooseFontGeneric(wxCommandEvent& event)
|
||||
}
|
||||
#endif
|
||||
|
||||
void MyFrame::MessageBox(wxCommandEvent& event)
|
||||
void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxMessageDialog dialog(this, "This is a message box\nA long, long string to test out the message box properly",
|
||||
"Message box text", wxYES_NO|wxCANCEL);
|
||||
@ -193,7 +193,7 @@ void MyFrame::MessageBox(wxCommandEvent& event)
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::TextEntry(wxCommandEvent& event)
|
||||
void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxTextEntryDialog dialog(this, "This is a small sample\nA long, long string to test out the text entrybox",
|
||||
"Please enter a string", "Default value", wxOK|wxCANCEL);
|
||||
@ -205,7 +205,7 @@ void MyFrame::TextEntry(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::SingleChoice(wxCommandEvent& event)
|
||||
void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
const wxString choices[] = { "One", "Two", "Three", "Four", "Five" } ;
|
||||
int n = 5;
|
||||
@ -222,7 +222,7 @@ void MyFrame::SingleChoice(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::FileOpen(wxCommandEvent& event)
|
||||
void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0);
|
||||
|
||||
@ -233,7 +233,7 @@ void MyFrame::FileOpen(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::FileSave(wxCommandEvent& event)
|
||||
void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxFileDialog dialog(this, "Testing save file dialog", "", "",
|
||||
"Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
|
||||
@ -248,8 +248,9 @@ void MyFrame::FileSave(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::DirChoose(wxCommandEvent& event)
|
||||
void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
wxDirDialog dialog(this, "Testing directory picker", "");
|
||||
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
@ -257,14 +258,15 @@ void MyFrame::DirChoose(wxCommandEvent& event)
|
||||
wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
|
||||
dialog2.ShowModal();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyFrame::OnExit(wxCommandEvent& event)
|
||||
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void MyCanvas::OnPaint(wxPaintEvent& event)
|
||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
dc.SetFont(wxGetApp().m_canvasFont);
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
// Define a new application type
|
||||
class MyApp: public wxApp
|
||||
{ public:
|
||||
@ -68,8 +72,8 @@ bool MyApp::OnInit(void)
|
||||
#ifdef __WXMSW__
|
||||
frame->SetIcon(wxIcon("mondrian"));
|
||||
#endif
|
||||
#ifdef __X__
|
||||
frame->SetIcon(wxIcon("aiai.xbm"));
|
||||
#ifdef __WXGTK__
|
||||
frame->SetIcon(wxIcon( mondrian_xpm ));
|
||||
#endif
|
||||
|
||||
// Make a menubar
|
||||
|
44
samples/minimal/mondrian.xpm
Normal file
44
samples/minimal/mondrian.xpm
Normal file
@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *mondrian_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Black",
|
||||
". c Blue",
|
||||
"X c #00bf00",
|
||||
"o c Red",
|
||||
"O c Yellow",
|
||||
"+ c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
@ -1270,7 +1270,7 @@ void wxArrayString::Remove(const char *sz)
|
||||
|
||||
// sort array elements using passed comparaison function
|
||||
|
||||
void wxArrayString::Sort(bool bCase, bool bReverse)
|
||||
void wxArrayString::Sort(bool WXUNUSED(bCase), bool WXUNUSED(bReverse) )
|
||||
{
|
||||
//@@@@ TO DO
|
||||
//qsort(m_pItems, m_nCount, sizeof(char *), fCmp);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user