]> code.citadel.org Git - citadel.git/commitdiff
Got the autolayout stuff working with the two-pane thing
authorArt Cancro <ajc@citadel.org>
Sun, 14 Mar 1999 18:56:19 +0000 (18:56 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 14 Mar 1999 18:56:19 +0000 (18:56 +0000)
daphne/main.cpp

index b7be8cb78a5284e682c5eeb533d9b155cf03db81..5899bcc2e95e0680b747816f7067d529e4874380 100644 (file)
@@ -56,7 +56,6 @@ public:
 private:
        void OnUsersMenu(wxCommandEvent& cmd);
        void OnWindowMenu(wxCommandEvent& cmd);
-       void OnSize(wxSizeEvent& WXUNUSED(event) );
        wxTextCtrl *textWindow;
        wxButton *do_cmd;
        void InitToolBar(wxToolBar* toolBar);
@@ -106,7 +105,6 @@ BEGIN_EVENT_TABLE(  MyFrame, wxMDIParentFrame)
        EVT_MENU(       WMENU_ARRANGE,          MyFrame::OnWindowMenu)
        EVT_MENU(       WMENU_NEXT,             MyFrame::OnWindowMenu)
        EVT_MENU(       WMENU_PREVIOUS,         MyFrame::OnWindowMenu)
-       EVT_SIZE(                               MyFrame::OnSize)
        EVT_BUTTON(     BUTTON_DO_CMD,          MyFrame::OnDoCmd)
 END_EVENT_TABLE()
 
@@ -142,6 +140,7 @@ bool Daphne::OnInit()
 
     // Show it and tell the application that it's our main window
     // @@@ what does it do exactly, in fact? is it necessary here?
+    frame->SetAutoLayout(TRUE);
     frame->Show(TRUE);
     SetTopWindow(frame);
 
@@ -173,6 +172,21 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
                        wxTE_MULTILINE|wxSUNKEN_BORDER);
        textWindow->SetValue("Hic!  A maus!");
 
+        wxLayoutConstraints *t2 = new wxLayoutConstraints;
+        t2->top.SameAs(this, wxTop, 4);
+        t2->left.SameAs(this, wxLeft, 0);
+       t2->right.PercentOf(this, wxWidth, 25);
+        t2->bottom.SameAs(this, wxBottom, 0);
+        textWindow->SetConstraints(t2);
+
+       wxLayoutConstraints *t3 = new wxLayoutConstraints;
+       t3->top.SameAs(this, wxTop, 4);
+       t3->left.PercentOf(this, wxWidth, 25);
+       t3->right.SameAs(this, wxRight, 0);
+       t3->bottom.SameAs(this, wxBottom, 0);
+       wxMDIClientWindow *children = GetClientWindow();
+       children->SetConstraints(t3);
+
 
        // Set up the toolbar
 
@@ -355,13 +369,3 @@ void MyFrame::OnConnect(wxCommandEvent& unused) {
        }
 }
 
-
-void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event) ) {
-
-    int w, h;
-    GetClientSize(&w, &h);
-
-    textWindow->SetSize(0, 0, 200, h);
-    GetClientWindow()->SetSize(200, 0, w - 200, h);
-
-}