-// -----------------------------------------------------------------------
-// wxPGCanvas
-// -----------------------------------------------------------------------
-
-//
-// wxPGCanvas acts as a graphics sub-window of the
-// wxScrolledWindow that wxPropertyGrid is.
-//
-class wxPGCanvas : public wxPanel
-{
-public:
- wxPGCanvas() : wxPanel()
- {
- }
- virtual ~wxPGCanvas() { }
-
-protected:
- void OnMouseMove( wxMouseEvent &event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnMouseMove( event );
- }
-
- void OnMouseClick( wxMouseEvent &event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnMouseClick( event );
- }
-
- void OnMouseUp( wxMouseEvent &event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnMouseUp( event );
- }
-
- void OnMouseRightClick( wxMouseEvent &event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnMouseRightClick( event );
- }
-
- void OnMouseDoubleClick( wxMouseEvent &event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnMouseDoubleClick( event );
- }
-
- void OnKey( wxKeyEvent& event )
- {
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- pg->OnKey( event );
- }
-
- void OnPaint( wxPaintEvent& event );
-
- // Always be focussable, even with child windows
- virtual void SetCanFocus(bool WXUNUSED(canFocus))
- { wxPanel::SetCanFocus(true); }
-
-
-private:
- DECLARE_EVENT_TABLE()
- DECLARE_ABSTRACT_CLASS(wxPGCanvas)
-};
-
-
-IMPLEMENT_ABSTRACT_CLASS(wxPGCanvas,wxPanel)
-
-BEGIN_EVENT_TABLE(wxPGCanvas, wxPanel)
- EVT_MOTION(wxPGCanvas::OnMouseMove)
- EVT_PAINT(wxPGCanvas::OnPaint)
- EVT_LEFT_DOWN(wxPGCanvas::OnMouseClick)
- EVT_LEFT_UP(wxPGCanvas::OnMouseUp)
- EVT_RIGHT_UP(wxPGCanvas::OnMouseRightClick)
- EVT_LEFT_DCLICK(wxPGCanvas::OnMouseDoubleClick)
- EVT_KEY_DOWN(wxPGCanvas::OnKey)
-END_EVENT_TABLE()
-
-
-void wxPGCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
-{
- wxPropertyGrid* pg = wxStaticCast(GetParent(), wxPropertyGrid);
- wxASSERT( pg->IsKindOf(CLASSINFO(wxPropertyGrid)) );
-
- wxPaintDC dc(this);
-
- // Don't paint after destruction has begun
- if ( !(pg->GetInternalFlags() & wxPG_FL_INITIALIZED) )
- return;
-
- // Update everything inside the box
- wxRect r = GetUpdateRegion().GetBox();
-
- // FIXME: This is just a workaround for a bug that causes splitters not
- // to paint when other windows are being dragged over the grid.
- wxRect fullRect = GetRect();
- r.x = fullRect.x;
- r.width = fullRect.width;
-
- // Repaint this rectangle
- pg->DrawItems( dc, r.y, r.y + r.height, &r );
-
- // We assume that the size set when grid is shown
- // is what is desired.
- pg->SetInternalFlag(wxPG_FL_GOOD_SIZE_SET);
-}
-