]> git.saurik.com Git - wxWidgets.git/commitdiff
Added XPM icon; minor mods
authorJulian Smart <julian@anthemion.co.uk>
Mon, 11 Mar 2002 12:50:06 +0000 (12:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 11 Mar 2002 12:50:06 +0000 (12:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

demos/forty/card.cpp
utils/emulator/src/emulator.cpp
utils/emulator/src/emulator.h
utils/emulator/src/emulator.xpm [new file with mode: 0644]

index 8c3df09b0c313a7950442b82dc1b47c9d541fa94..295e7c5947c387b2a9c0cc262dec29012338e707 100644 (file)
@@ -41,7 +41,7 @@
 #include "forty.h"
 #include "card.h"
 
-#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXX11__)
 #include "pictures.xpm"
 #include "symbols.xbm"
 #endif
index ccc15aa3ea3f86f860baba766eceeac8b60e57da..ecfd4b2903f226acacfcb14d9167860accb71d72 100644 (file)
@@ -63,6 +63,7 @@
 BEGIN_EVENT_TABLE(wxEmulatorFrame, wxFrame)
     EVT_MENU(Emulator_Quit,  wxEmulatorFrame::OnQuit)
     EVT_MENU(Emulator_About, wxEmulatorFrame::OnAbout)
+    EVT_CLOSE(wxEmulatorFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 // Create a new application object: this macro will allow wxWindows to create
@@ -98,11 +99,14 @@ wxEmulatorApp::wxEmulatorApp()
     m_xnestWindow = NULL;
     m_containerWindow = NULL;
     m_displayNumber = wxT("100");
+    m_xnestPID = 0;
+
 }
 
 // 'Main program' equivalent: the program execution "starts" here
 bool wxEmulatorApp::OnInit()
 {
+    wxLog::SetTimestamp(NULL);
     wxInitAllImageHandlers();
 
     wxString currentDir = wxGetCwd();
@@ -194,13 +198,14 @@ bool wxEmulatorApp::OnInit()
     m_xnestWindow = new wxAdoptedWindow;
 
     wxString cmd;
-    cmd.Printf(wxT("Xnest %s -geometry %dx%d"),
+    cmd.Printf(wxT("Xnest :%s -geometry %dx%d"),
         m_displayNumber.c_str(),
         (int) m_emulatorInfo.m_emulatorScreenSize.x,
         (int) m_emulatorInfo.m_emulatorScreenSize.y);
 
-    // Asynchronously executes Xnest    
-    if (0 == wxExecute(cmd))
+    // Asynchronously executes Xnest
+    m_xnestPID = wxExecute(cmd);
+    if (0 == m_xnestPID)
     {
         frame->Destroy();
         wxMessageBox(wxT("Sorry, could not run Xnest. Please check your PATH."));
@@ -301,6 +306,22 @@ void wxEmulatorFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
     wxMessageBox(msg, _T("About wxEmulator"), wxOK | wxICON_INFORMATION, this);
 }
 
+void wxEmulatorFrame::OnCloseWindow(wxCloseEvent& event)
+{
+#ifdef __WXX11__
+    if (wxGetApp().m_xnestWindow)
+    {
+        wxGetApp().m_xnestWindow->SetHandle((WXWindow) NULL);
+    }
+#endif
+    this->Destroy();
+    if (wxGetApp().m_xnestPID > 0)
+    {
+        wxKill(wxGetApp().m_xnestPID);
+        wxGetApp().m_xnestPID = 0;
+    }
+}
+
 IMPLEMENT_CLASS(wxEmulatorContainer, wxWindow)
 
 BEGIN_EVENT_TABLE(wxEmulatorContainer, wxWindow)
@@ -322,7 +343,11 @@ void wxEmulatorContainer::OnSize(wxSizeEvent& event)
 void wxEmulatorContainer::DoResize()
 {
     wxSize sz = GetClientSize();
-    if (wxGetApp().m_xnestWindow)
+    if (wxGetApp().m_xnestWindow
+#ifdef __WXX11__
+        && wxGetApp().m_xnestWindow->GetMainWindow()
+#endif
+        )
     {
         int deviceWidth = wxGetApp().m_emulatorInfo.m_emulatorDeviceSize.x;
         int deviceHeight = wxGetApp().m_emulatorInfo.m_emulatorDeviceSize.y;
index 5cde3128f4fec3a76b1ba679ecf10037604d0ec8..ee02672792a267d6b5cebea6f1420290f01f266d 100644 (file)
@@ -96,6 +96,7 @@ public:
     wxEmulatorContainer*    m_containerWindow;
     wxString                m_appDir;
     wxString                m_displayNumber;
+    long                    m_xnestPID;
 };
 
 // The container for the Xnest window. The decorations
@@ -124,9 +125,10 @@ public:
     // ctor(s)
     wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 
-    // event handlers (these functions should _not_ be virtual)
+    // event handlers
     void OnQuit(wxCommandEvent& event);
     void OnAbout(wxCommandEvent& event);
+    void OnCloseWindow(wxCloseEvent& event);
 
 private:
     // any class wishing to process wxWindows events must use this macro
diff --git a/utils/emulator/src/emulator.xpm b/utils/emulator/src/emulator.xpm
new file mode 100644 (file)
index 0000000..229a896
--- /dev/null
@@ -0,0 +1,52 @@
+/* XPM */
+static char * emulator_xpm[] = {
+"32 32 17 1",
+"(     c #000000",
+".     c #000000",
+"+     c #008484",
+"@     c #848484",
+"#     c #A5A5A5",
+"$     c None",
+"%     c #FFFFF7",
+"&     c #FFFFFF",
+"*     c #FFFFFF",
+"=     c #FFFFFF",
+"-     c #FFFFFF",
+";     c #FFFFFF",
+">     c #FFFFFF",
+",     c #FFFFFF",
+"'     c #FFFFFF",
+")     c #FFFFFF",
+"!     c #FFFFFF",
+"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
+"$$$%%%%%%%%%%%%%%%%%%%%%%%&@$$$$",
+"$$$%######################@.$$$$",
+"$$$%######################@.$$$$",
+"$$$%##++++++++++++++++++##@.$$$$",
+"$$$%##++++++++++++++++++##@.$$.$",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%##++++++++++++++++++##@.$&.#",
+"$$$%######################@.$&.#",
+"$$$%######################@.$&.#",
+"$$$%##@####@##########@###@.$&.#",
+"$$$%#@@@##@@@########@@@##@.$&.#",
+"$$$%##@####@##########@###@.$&.#",
+"$$$%######################@.$&.#",
+"$$$&@@@@@@@@@@@@@@@@@@@@@@@.$&.#",
+"$$$@........................$$$$"};