-
-bool wxSimpleCheckBox::ProcessEvent(wxEvent& event)
-{
- wxPropertyGrid* propGrid = (wxPropertyGrid*) GetParent()->GetParent();
- wxASSERT( propGrid->IsKindOf(CLASSINFO(wxPropertyGrid)) );
-
- if ( ( (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK)
- && ((wxMouseEvent&)event).m_x > (wxPG_XBEFORETEXT-2)
- && ((wxMouseEvent&)event).m_x <= (wxPG_XBEFORETEXT-2+m_boxHeight) )
- )
- {
- SetValue(2);
- return true;
- }
- else if ( event.GetEventType() == wxEVT_PAINT )
- {
- wxSize clientSize = GetClientSize();
- wxPaintDC dc(this);
-
- /*
- // Buffered paint DC doesn't seem to do much good
- if ( !ms_doubleBuffer ||
- clientSize.x > ms_doubleBuffer->GetWidth() ||
- clientSize.y > ms_doubleBuffer->GetHeight() )
- {
- delete ms_doubleBuffer;
- ms_doubleBuffer = new wxBitmap(clientSize.x+25,clientSize.y+25);
- }
-
- wxBufferedPaintDC dc(this,*ms_doubleBuffer);
- */
-
- wxRect rect(0,0,clientSize.x,clientSize.y);
- //rect.x -= 1;
- rect.y += 1;
- rect.width += 1;
-
- m_boxHeight = propGrid->GetFontHeight();
-
- wxColour bgcol = GetBackgroundColour();
- dc.SetBrush( bgcol );
- dc.SetPen( bgcol );
- dc.DrawRectangle( rect );
-
- wxColour txcol = GetForegroundColour();
-
- int state = m_state;
- if ( m_font.GetWeight() == wxBOLD )
- state |= 2;
-
- DrawSimpleCheckBox(dc,rect,m_boxHeight,state,txcol);
-
- // If focused, indicate it somehow.
- /*
- if ( wxWindow::FindFocus() == this )
- {
- rect.x += 1;
- rect.width -= 1;
-
- wxPGDrawFocusRect(dc,rect);
- }
- */
-
- return true;
- }
- else if ( event.GetEventType() == wxEVT_SIZE ||
- event.GetEventType() == wxEVT_SET_FOCUS ||
- event.GetEventType() == wxEVT_KILL_FOCUS
- )
- {
- Refresh();
- }
- else if ( event.GetEventType() == wxEVT_KEY_DOWN )
- {
- wxKeyEvent& keyEv = (wxKeyEvent&) event;
-
- if ( keyEv.GetKeyCode() == WXK_SPACE )
- {
- SetValue(2);
- return true;
- }
- }
- return wxControl::ProcessEvent(event);
-}
-
-