+ wxPanel *panel = new wxPanel(this, -1);
+ wxBoxSizer *sizer1 = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer *sizer2 = new wxBoxSizer(wxHORIZONTAL);
+
+ // create bitmaps and masks for the buttons
+ wxBitmap
+ bmpn = wxBITMAP(north),
+ bmpw = wxBITMAP(west),
+ bmpc = wxBITMAP(center),
+ bmpe = wxBITMAP(east),
+ bmps = wxBITMAP(south);
+
+#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
+ bmpn.SetMask(new wxMask(bmpn, *wxLIGHT_GREY));
+ bmpw.SetMask(new wxMask(bmpw, *wxLIGHT_GREY));
+ bmpc.SetMask(new wxMask(bmpc, *wxLIGHT_GREY));
+ bmpe.SetMask(new wxMask(bmpe, *wxLIGHT_GREY));
+ bmps.SetMask(new wxMask(bmps, *wxLIGHT_GREY));
+#endif
+
+ // create the buttons and attach tooltips to them
+ wxBitmapButton
+ *bn = new wxBitmapButton(panel, ID_NORTH, bmpn),
+ *bw = new wxBitmapButton(panel, ID_WEST , bmpw),
+ *bc = new wxBitmapButton(panel, ID_CENTER, bmpc),
+ *be = new wxBitmapButton(panel, ID_EAST , bmpe),
+ *bs = new wxBitmapButton(panel, ID_SOUTH, bmps);
+
+#if wxUSE_TOOLTIPS
+ bn->SetToolTip(_("Find northernmost cell"));
+ bw->SetToolTip(_("Find westernmost cell"));
+ bc->SetToolTip(_("Find center of mass"));
+ be->SetToolTip(_("Find easternmost cell"));
+ bs->SetToolTip(_("Find southernmost cell"));
+#endif
+
+ // add buttons to sizers
+ sizer2->Add( bw, 0, wxCENTRE | wxWEST, 4 );
+ sizer2->Add( bc, 0, wxCENTRE);
+ sizer2->Add( be, 0, wxCENTRE | wxEAST, 4 );
+ sizer1->Add( bn, 0, wxCENTRE | wxNORTH, 4 );
+ sizer1->Add( sizer2 );
+ sizer1->Add( bs, 0, wxCENTRE | wxSOUTH, 4 );
+
+ // set the miniframe size
+ panel->SetSizer(sizer1);
+ panel->SetAutoLayout(TRUE);
+ sizer1->Fit(this);
+ sizer1->SetSizeHints(this);
+
+ // move it to a sensible position
+ wxRect parentRect = parent->GetRect();
+ wxSize childSize = GetSize();
+ int x = parentRect.GetX() +
+ parentRect.GetWidth();
+ int y = parentRect.GetY() +
+ (parentRect.GetHeight() - childSize.GetHeight()) / 4;
+ Move(x, y);
+
+ // done
+ Show(TRUE);
+}
+
+void LifeNavigator::OnClose(wxCloseEvent& event)
+{
+ // avoid if we can
+ if (event.CanVeto())
+ event.Veto();
+ else
+ Destroy();
+}
+