+BEGIN_EVENT_TABLE(MainFrame, wxFrame)
+ EVT_MENU(Show_Shaped, MainFrame::OnShowShaped)
+ EVT_MENU(Show_Transparent, MainFrame::OnShowTransparent)
+ EVT_MENU_RANGE(Show_Effect_First, Show_Effect_Last, MainFrame::OnShowEffect)
+END_EVENT_TABLE()
+
+MainFrame::MainFrame()
+ : wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample",
+ wxDefaultPosition, wxSize(200, 100))
+{
+ wxMenuBar * const mbar = new wxMenuBar;
+ wxMenu * const menuFrames = new wxMenu;
+ menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S");
+ menuFrames->Append(Show_Transparent, "Show &transparent window\tCtrl-T");
+ menuFrames->AppendSeparator();
+ menuFrames->Append(Show_Effect_Roll, "Show &rolled effect\tCtrl-R");
+ menuFrames->Append(Show_Effect_Slide, "Show s&lide effect\tCtrl-L");
+ menuFrames->Append(Show_Effect_Blend, "Show &fade effect\tCtrl-F");
+ menuFrames->Append(Show_Effect_Expand, "Show &expand effect\tCtrl-E");
+ menuFrames->AppendSeparator();
+ menuFrames->Append(wxID_EXIT, "E&xit");
+
+ mbar->Append(menuFrames, "&Show");
+ SetMenuBar(mbar);
+
+ Show();
+}
+
+void MainFrame::OnShowShaped(wxCommandEvent& WXUNUSED(event))
+{
+ ShapedFrame *shapedFrame = new ShapedFrame(this);
+ shapedFrame->Show(true);
+}
+
+void MainFrame::OnShowTransparent(wxCommandEvent& WXUNUSED(event))
+{
+ SeeThroughFrame *seeThroughFrame = new SeeThroughFrame();
+ seeThroughFrame->Show(true);
+}
+
+void MainFrame::OnShowEffect(wxCommandEvent& event)
+{
+ int effect = wxSHOW_EFFECT_ROLL + event.GetId() - Show_Effect_Roll;
+ static wxDirection direction = wxLEFT;
+ direction = (wxDirection)(((int)direction)<< 1);
+ if ( direction > wxDOWN )
+ direction = wxLEFT ;
+ new EffectFrame(this, wx_static_cast(wxShowEffect, effect),1000,direction);
+}
+
+// ----------------------------------------------------------------------------
+// shaped frame
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(ShapedFrame, wxFrame)
+ EVT_LEFT_DCLICK(ShapedFrame::OnDoubleClick)
+ EVT_LEFT_DOWN(ShapedFrame::OnLeftDown)
+ EVT_LEFT_UP(ShapedFrame::OnLeftUp)
+ EVT_MOTION(ShapedFrame::OnMouseMove)
+ EVT_RIGHT_UP(ShapedFrame::OnExit)
+
+ EVT_PAINT(ShapedFrame::OnPaint)
+
+#ifdef __WXGTK__
+ EVT_WINDOW_CREATE(ShapedFrame::OnWindowCreate)
+#endif
+END_EVENT_TABLE()
+
+