]> git.saurik.com Git - wxWidgets.git/commitdiff
Minor changes to samples.
authorRobert Roebling <robert@roebling.de>
Fri, 6 Aug 1999 13:06:11 +0000 (13:06 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 6 Aug 1999 13:06:11 +0000 (13:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/copy_src.bat
samples/text/makefile.g95
samples/text/text.cpp
samples/treectrl/treetest.cpp

index 13a133c5abfc15d02cf3237c65bcb7cf6a3e4944..7b3f4908935fa860580988e537d29e751cda8b0a 100755 (executable)
@@ -671,13 +671,16 @@ echo TreeCtrl sample..
 cd treectrl
 md \wxmsw_dist\wxMSW\samples\treectrl
 copy Makefile.* \wxmsw_dist\wxMSW\samples\treectrl
-copy *.rc \wxmsw_dist\wxMSW\samples\toolbar
-copy *.def \wxmsw_dist\wxMSW\samples\toolbar
+copy *.rc \wxmsw_dist\wxMSW\samples\treectrl
+copy *.def \wxmsw_dist\wxMSW\samples\treectrl
 copy *.cpp \wxmsw_dist\wxMSW\samples\treectrl
 copy *.h \wxmsw_dist\wxMSW\samples\treectrl
 copy *.xpm \wxmsw_dist\wxMSW\samples\treectrl
 copy *.ico \wxmsw_dist\wxMSW\samples\treectrl
-cd ..
+cd bitmaps
+md \wxmsw_dist\wxMSW\samples\treectrl\bitmaps
+copy *.* \wxmsw_dist\wxMSW\samples\treectrl\bitmaps
+cd ..\..
 
 echo typetest sample..
 
index 28a81c25cf0d27faaa3d17cb110ad3a522f8ace5..f2ab9e5b9f87f0d2b2888acff27bcb49d9e73940 100644 (file)
@@ -9,7 +9,7 @@
 
 WXDIR = ../..
 
-TARGET=controls
+TARGET=text
 OBJECTS = $(TARGET).o
 
 include $(WXDIR)/src/makeprog.g95
index f19bd1159c2d44e165a326ebb1c93fb18ae9a7cd..c60909d53f3ef5eb51c681be1d06c3e9f2183d01 100644 (file)
@@ -87,6 +87,8 @@ public:
     void DoMoveToEndOfText();
     void DoMoveToEndOfEntry();
 
+    void OnSize( wxSizeEvent &event );
+
     MyTextCtrl    *m_text;
     MyTextCtrl    *m_password;
     MyTextCtrl    *m_enter;
@@ -97,6 +99,9 @@ public:
     MyTextCtrl    *m_horizontal;
 
     wxTextCtrl    *m_log;
+
+private:
+    DECLARE_EVENT_TABLE()
 };
 
 class MyFrame: public wxFrame
@@ -167,7 +172,8 @@ bool MyApp::OnInit()
     // Create the main frame window
     MyFrame *frame = new MyFrame((wxFrame *) NULL,
             "Text wxWindows App",
-            50, 50, 640, 420);
+           50, 50, 640, 420);
+    frame->SetSizeHints( 500, 400 );
 
     wxMenu *file_menu = new wxMenu;
     file_menu->Append(TEXT_LOAD, "&Load file\tCtrl-O",
@@ -228,9 +234,6 @@ void MyTextCtrl::LogEvent(const wxChar *name, wxKeyEvent& event) const
 {
     wxString key;
     long keycode = event.KeyCode();
-    if ( wxIsprint((int)keycode) )
-        key.Printf( _T("'%c'") , (char)keycode);
-    else
     {
         switch ( keycode )
         {
@@ -336,8 +339,13 @@ void MyTextCtrl::LogEvent(const wxChar *name, wxKeyEvent& event) const
             case WXK_NUMPAD_SUBTRACT: key = "NUMPAD_SUBTRACT"; break;
             case WXK_NUMPAD_DECIMAL: key = "NUMPAD_DECIMAL"; break;
 
-            default:
-                key.Printf( _T("unknown (%ld)"), keycode);
+           default:
+            {
+               if ( wxIsprint((int)keycode) )
+                   key.Printf( _T("'%c'") , (char)keycode);
+               else
+                  key.Printf( _T("unknown (%ld)"), keycode);
+           }
         }
     }
 
@@ -415,12 +423,18 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event)
 // MyPanel
 //----------------------------------------------------------------------
 
+BEGIN_EVENT_TABLE(MyPanel, wxPanel)
+    EVT_SIZE(MyPanel::OnSize)
+END_EVENT_TABLE()
+
 MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
        : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
 {
     m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(5,260), wxSize(630,100), wxTE_MULTILINE );
 
-    delete wxLog::SetActiveTarget(new wxLogStderr);
+    wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
+
+    delete old_log;
 
     // single line text controls
 
@@ -459,6 +473,13 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
       wxPoint(180,170), wxSize(240,70), wxTE_MULTILINE);
 }
 
+void MyPanel::OnSize( wxSizeEvent &event )
+{
+    wxSize client_area( GetClientSize() );
+    m_log->SetSize( 0, 260, client_area.x, client_area.y - 260 );
+    event.Skip();
+}
+
 #if wxUSE_CLIPBOARD
 void MyPanel::DoPasteFromClipboard()
 {
@@ -647,7 +668,7 @@ void MyFrame::OnToggleTooltips(wxCommandEvent& event)
 
 void MyFrame::OnFileLoad(wxCommandEvent& event)
 {
-    if ( m_panel->m_multitext->LoadFile("controls.cpp") )
+    if ( m_panel->m_multitext->LoadFile("text.cpp") )
         wxLogStatus(this, _T("Successfully loaded file"));
     else
         wxLogStatus(this, _T("Couldn't load the file"));
index 6b585f079cefdaf1b3f52bc32d98b724d4d329f7..4c07872661ef57a60a629f3adadf85520a621867 100644 (file)
 
 #include "math.h"
 
-#ifdef __WXMSW__
-    //#define NO_MULTIPLE_SELECTION
+//#ifdef __WXMSW__
+    #define NO_MULTIPLE_SELECTION
     #define NO_VARIABLE_HEIGHT
-#endif
+//#endif
 
 #include "treetest.h"
 
@@ -184,9 +184,13 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
                                 wxDefaultPosition, wxDefaultSize,
                                 wxTR_HAS_BUTTONS |
                                 wxTR_EDIT_LABELS |
-                                wxTR_MULTIPLE |
-                                wxTR_HAS_VARIABLE_ROW_HEIGHT |
-                                wxSUNKEN_BORDER);
+#ifndef NO_MULTIPLE_SELECTION
+                               wxTR_MULTIPLE |
+#endif
+#ifndef NO_VARIABLE_HEIGHT
+                               wxTR_HAS_VARIABLE_ROW_HEIGHT |
+#endif
+                               wxSUNKEN_BORDER);
     wxTextCtrl *textCtrl = new wxTextCtrl(this, -1, "",
                                 wxDefaultPosition, wxDefaultSize,
                                 wxTE_MULTILINE | wxSUNKEN_BORDER);