]> git.saurik.com Git - wxWidgets.git/commitdiff
wxFrame::SetIcon()
authorRobert Roebling <robert@roebling.de>
Mon, 27 Jul 1998 23:01:43 +0000 (23:01 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 27 Jul 1998 23:01:43 +0000 (23:01 +0000)
  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

19 files changed:
include/wx/fontdlg.h
include/wx/gtk/bitmap.h
include/wx/gtk/frame.h
include/wx/gtk1/bitmap.h
include/wx/gtk1/frame.h
include/wx/string.h
install/gtk/INSTALL
samples/dialogs/Makefile [new file with mode: 0644]
samples/dialogs/Makefile.in [new file with mode: 0644]
samples/dialogs/dialogs.cpp
samples/minimal/minimal.cpp
samples/minimal/mondrian.xpm [new file with mode: 0644]
src/common/string.cpp
src/gtk/dialog.cpp
src/gtk/frame.cpp
src/gtk/menu.cpp
src/gtk1/dialog.cpp
src/gtk1/frame.cpp
src/gtk1/menu.cpp

index e30ce09aaf8221a96def6cde5a23468e7d35fe21..4d83cf4e0d33197089e7cc50bfca01d8c5d21f93 100644 (file)
@@ -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
index 379e0065e8d258f257de47e83edcef0410fbd518..f0eb372f92e25273892a737360615d905d6d6a05 100644 (file)
@@ -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;
index f0fd76b8854c1c5e2d09979b8c8faebfdfebfaa7..788761d769254c869c460df0a53c323b209789bf 100644 (file)
@@ -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()
 };
index 379e0065e8d258f257de47e83edcef0410fbd518..f0eb372f92e25273892a737360615d905d6d6a05 100644 (file)
@@ -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;
index f0fd76b8854c1c5e2d09979b8c8faebfdfebfaa7..788761d769254c869c460df0a53c323b209789bf 100644 (file)
@@ -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()
 };
index 7aa6819b9202817e1db14498ff96955138a05442..af979150b0d0319b12584cf872ca229d0b456413 100644 (file)
@@ -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(); }
index 511613954fe036f294caeb1ffab6eac48ca5154c..f9376902d47de43b0cf20c723769e16a9c2ecaab 100644 (file)
@@ -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,
diff --git a/samples/dialogs/Makefile b/samples/dialogs/Makefile
new file mode 100644 (file)
index 0000000..027d82a
--- /dev/null
@@ -0,0 +1 @@
+include ../../src/gtk/setup/general/makeapp
diff --git a/samples/dialogs/Makefile.in b/samples/dialogs/Makefile.in
new file mode 100644 (file)
index 0000000..a4529f0
--- /dev/null
@@ -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
index 939efa6cb8ee6c040880f83c1f2d6d96004d9026..7a501ba5efe60d0c488a7f8201328c75d3e67fba 100644 (file)
@@ -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);
index b6ce6c8d980c1779141e091159e32396dc9b0c1a..7f9821bbd92a3f53ba97d89f93638307a2e324df 100644 (file)
 #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
diff --git a/samples/minimal/mondrian.xpm b/samples/minimal/mondrian.xpm
new file mode 100644 (file)
index 0000000..409f27a
--- /dev/null
@@ -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 ++++ ",
+"                                "
+};
index 677d6a832a015ef3ac653917f174880a301c7a06..407d143e3c3ec2f337722b8dcf9e04966cd0ba78 100644 (file)
@@ -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);
index f472f31e6c3e6a66976492b7f2d8f6c451263a8f..6411ba19302f836e7a5db86312cefe0263ad1c1c 100644 (file)
@@ -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();
 };
 
index 9e4f52a448129351c22ad10f3aa93ceb1b110eaa..704c2e6500d73252a042bd1d36b764c650f37897 100644 (file)
@@ -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 );
+}
+
index 2e1002c982fc1d5309d74339d6b9f5e5166578c1..6b44b2f27108c8b2590acf6361673fda371d707d 100644 (file)
@@ -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)
index f472f31e6c3e6a66976492b7f2d8f6c451263a8f..6411ba19302f836e7a5db86312cefe0263ad1c1c 100644 (file)
@@ -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();
 };
 
index 9e4f52a448129351c22ad10f3aa93ceb1b110eaa..704c2e6500d73252a042bd1d36b764c650f37897 100644 (file)
@@ -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 );
+}
+
index 2e1002c982fc1d5309d74339d6b9f5e5166578c1..6b44b2f27108c8b2590acf6361673fda371d707d 100644 (file)
@@ -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)