X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c5ab89b18854aac3e92f703d6adeb4df57deb79..58bd3862b82749175bd04809607d82f1b22f0300:/samples/image/image.cpp?ds=sidebyside diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 14c1c82d47..01af647f11 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -152,9 +152,10 @@ private: enum { - ID_ROTATE_LEFT = 100, + ID_ROTATE_LEFT = wxID_HIGHEST+1, ID_ROTATE_RIGHT, - ID_RESIZE + ID_RESIZE, + ID_PAINT_BG }; class MyImageFrame : public wxFrame @@ -170,6 +171,8 @@ public: wxMenu *menu = new wxMenu; menu->Append(wxID_SAVE); menu->AppendSeparator(); + m_pClearBgMenu = menu->AppendCheckItem(ID_PAINT_BG, _T("&Paint background")); + menu->AppendSeparator(); menu->Append(ID_RESIZE, _T("&Fit to window\tCtrl-F")); menu->AppendSeparator(); menu->Append(ID_ROTATE_LEFT, _T("Rotate &left\tCtrl-L")); @@ -184,8 +187,8 @@ public: SetClientSize(bitmap.GetWidth(), bitmap.GetHeight()); UpdateStatusBar(); - - SetBackgroundColour(*wxWHITE); + +// SetBackgroundColour(*wxWHITE); } void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) @@ -196,9 +199,10 @@ public: void OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); - - ClearBackground(); - + + if (m_pClearBgMenu->IsChecked()) + ClearBackground(); + const wxSize size = GetClientSize(); dc.DrawBitmap(m_bitmap, (size.x - m_bitmap.GetWidth())/2, @@ -373,6 +377,7 @@ private: } wxBitmap m_bitmap; + wxMenuItem* m_pClearBgMenu; DECLARE_EVENT_TABLE() };