git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65628
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
@library{wxpropgrid}
@category{propgrid}
*/
@library{wxpropgrid}
@category{propgrid}
*/
-class WXDLLIMPEXP_PROPGRID
- wxPropertyGrid : public wxScrolledWindow, public wxPropertyGridInterface
+class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxControl,
+ public wxScrollHelper,
+ public wxPropertyGridInterface
{
friend class wxPropertyGridEvent;
friend class wxPropertyGridPageState;
{
friend class wxPropertyGridEvent;
friend class wxPropertyGridPageState;
#endif
/** The default constructor. The styles to be used are styles valid for
#endif
/** The default constructor. The styles to be used are styles valid for
- the wxWindow and wxScrolledWindow.
@see @link wndflags Additional Window Styles @endlink
*/
@see @link wndflags Additional Window Styles @endlink
*/
@param pt
Coordinates in the virtual grid space. You may need to use
@param pt
Coordinates in the virtual grid space. You may need to use
- wxScrolledWindow::CalcScrolledPosition() for translating
+ wxScrolled<T>::CalcScrolledPosition() for translating
wxPropertyGrid client coordinates into something this member
function can use.
*/
wxPropertyGrid client coordinates into something this member
function can use.
*/
/** Current cursor id. */
int m_curcursor;
/** Current cursor id. */
int m_curcursor;
- /**
- This captionFont is made equal to the font of the wxScrolledWindow.
-
- As extra the bold face is set on it when this is wanted by the user
- (see flags)
- */
+ // Caption font. Same as normal font plus bold style.
wxFont m_captionFont;
int m_fontHeight; // Height of the font.
wxFont m_captionFont;
int m_fontHeight; // Height of the font.
void CorrectEditorWidgetPosY();
int DoDrawItems( wxDC& dc,
void CorrectEditorWidgetPosY();
int DoDrawItems( wxDC& dc,
- const wxRect* drawRect,
+ const wxRect* itemsRect,
bool isBuffered ) const;
/** Draws an expand/collapse (ie. +/-) button.
bool isBuffered ) const;
/** Draws an expand/collapse (ie. +/-) button.
void DrawItems( wxDC& dc,
unsigned int topItemY,
unsigned int bottomItemY,
void DrawItems( wxDC& dc,
unsigned int topItemY,
unsigned int bottomItemY,
- const wxRect* drawRect = NULL );
+ const wxRect* itemsRect = NULL );
// Translate wxKeyEvent to wxPG_ACTION_XXX
int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
// Translate wxKeyEvent to wxPG_ACTION_XXX
int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
@param pt
Logical coordinates in the virtual grid space. Use
@param pt
Logical coordinates in the virtual grid space. Use
- wxScrolledWindow::CalcUnscrolledPosition() if you need to
+ wxScrolled<T>::CalcUnscrolledPosition() if you need to
translate a scrolled position into a logical one.
*/
wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
translate a scrolled position into a logical one.
*/
wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
@category{propgrid}
@appearance{propertygrid.png}
*/
@category{propgrid}
@appearance{propertygrid.png}
*/
-class wxPropertyGrid : public wxScrolledWindow, public wxPropertyGridInterface
+class wxPropertyGrid : public wxControl,
+ public wxScrollHelper,
+ public wxPropertyGridInterface
- The styles to be used are styles valid for the wxWindow and wxScrolledWindow.
+ The styles to be used are styles valid for the wxWindow.
@see @ref propgrid_window_styles.
*/
@see @ref propgrid_window_styles.
*/
@param pt
Coordinates in the virtual grid space. You may need to use
@param pt
Coordinates in the virtual grid space. You may need to use
- wxScrolledWindow::CalcScrolledPosition() for translating
+ wxScrolled<T>::CalcScrolledPosition() for translating
wxPropertyGrid client coordinates into something this member
function can use.
*/
wxPropertyGrid client coordinates into something this member
function can use.
*/
// wxPropertyGrid
// -----------------------------------------------------------------------
// wxPropertyGrid
// -----------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxPropertyGrid, wxScrolledWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyGrid, wxControl)
-BEGIN_EVENT_TABLE(wxPropertyGrid, wxScrolledWindow)
+BEGIN_EVENT_TABLE(wxPropertyGrid, wxControl)
EVT_IDLE(wxPropertyGrid::OnIdle)
EVT_PAINT(wxPropertyGrid::OnPaint)
EVT_SIZE(wxPropertyGrid::OnResize)
EVT_IDLE(wxPropertyGrid::OnIdle)
EVT_PAINT(wxPropertyGrid::OnPaint)
EVT_SIZE(wxPropertyGrid::OnResize)
// -----------------------------------------------------------------------
wxPropertyGrid::wxPropertyGrid()
// -----------------------------------------------------------------------
wxPropertyGrid::wxPropertyGrid()
+ : wxControl(), wxScrollHelper(this)
const wxSize& size,
long style,
const wxString& name )
const wxSize& size,
long style,
const wxString& name )
+ : wxControl(), wxScrollHelper(this)
{
Init1();
Create(parent,id,pos,size,style,name);
{
Init1();
Create(parent,id,pos,size,style,name);
style &= ~(wxTAB_TRAVERSAL);
style |= wxWANTS_CHARS;
style &= ~(wxTAB_TRAVERSAL);
style |= wxWANTS_CHARS;
- wxScrolledWindow::Create(parent,id,pos,size,style,name);
+ wxControl::Create(parent, id, pos, size,
+ style | wxScrolledWindowStyle,
+ wxDefaultValidator,
+ name);
m_timeCreated = ::wxGetLocalTimeMillis();
m_timeCreated = ::wxGetLocalTimeMillis();
- //m_canvas->Create(this, wxID_ANY, wxPoint(0, 0), GetClientSize(),
- // wxWANTS_CHARS | wxCLIP_CHILDREN);
- SetBackgroundStyle( wxBG_STYLE_CUSTOM );
-
m_iFlags |= wxPG_FL_INITIALIZED;
m_ncWidth = wndsize.GetWidth();
m_iFlags |= wxPG_FL_INITIALIZED;
m_ncWidth = wndsize.GetWidth();
if ( m_iFlags & wxPG_FL_MOUSE_CAPTURED )
ReleaseMouse();
if ( m_iFlags & wxPG_FL_MOUSE_CAPTURED )
ReleaseMouse();
- return wxScrolledWindow::Destroy();
+ return wxControl::Destroy();
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------
//
// Tooltips disabled
//
//
// Tooltips disabled
//
- wxScrolledWindow::SetToolTip( NULL );
- wxScrolledWindow::SetWindowStyleFlag ( style );
+ wxControl::SetWindowStyleFlag ( style );
if ( m_iFlags & wxPG_FL_INITIALIZED )
{
if ( m_iFlags & wxPG_FL_INITIALIZED )
{
- wxScrolledWindow::Freeze();
- wxScrolledWindow::Thaw();
RecalculateVirtualSize();
#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
Refresh();
RecalculateVirtualSize();
#if wxPG_REFRESH_CONTROLS_AFTER_REPAINT
Refresh();
- wxScrolledWindow::SetExtraStyle( exStyle );
+ wxControl::SetExtraStyle( exStyle );
if ( exStyle & wxPG_EX_INIT_NOCAT )
m_pState->InitNonCatMode();
if ( exStyle & wxPG_EX_INIT_NOCAT )
m_pState->InitNonCatMode();
{
OnTLPChanging((wxWindow*)newParent);
{
OnTLPChanging((wxWindow*)newParent);
- bool res = wxScrolledWindow::Reparent(newParent);
+ bool res = wxControl::Reparent(newParent);
- m_captionFont = wxScrolledWindow::GetFont();
+ m_captionFont = wxControl::GetFont();
GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont);
m_subgroup_extramargin = x + (x/2);
GetTextExtent(wxS("jG"), &x, &y, 0, 0, &m_captionFont);
m_subgroup_extramargin = x + (x/2);
// Must disable active editor.
DoClearSelection();
// Must disable active editor.
DoClearSelection();
- bool res = wxScrolledWindow::SetFont( font );
+ bool res = wxControl::SetFont( font );
if ( res && GetParent()) // may not have been Create()ed yet if SetFont called from SetWindowVariant
{
CalculateFontAndBitmapStuff( m_vspacing );
if ( res && GetParent()) // may not have been Create()ed yet if SetFont called from SetWindowVariant
{
CalculateFontAndBitmapStuff( m_vspacing );
r.x = 0;
r.width = GetClientSize().x;
r.x = 0;
r.width = GetClientSize().x;
+ r.y = vy;
+ r.height = GetClientSize().y;
+
// Repaint this rectangle
DrawItems( dc, r.y, r.y + r.height, &r );
// Repaint this rectangle
DrawItems( dc, r.y, r.y + r.height, &r );
void wxPropertyGrid::DrawItems( wxDC& dc,
unsigned int topItemY,
unsigned int bottomItemY,
void wxPropertyGrid::DrawItems( wxDC& dc,
unsigned int topItemY,
unsigned int bottomItemY,
- const wxRect* drawRect )
+ const wxRect* itemsRect )
{
if ( m_frozen ||
m_height < 1 ||
{
if ( m_frozen ||
m_height < 1 ||
m_pState->EnsureVirtualHeight();
m_pState->EnsureVirtualHeight();
- wxRect tempDrawRect;
- if ( !drawRect )
+ wxRect tempItemsRect;
+ if ( !itemsRect )
- tempDrawRect = wxRect(0, topItemY,
- m_pState->m_width,
- bottomItemY);
- drawRect = &tempDrawRect;
+ tempItemsRect = wxRect(0, topItemY,
+ m_pState->m_width,
+ bottomItemY);
+ itemsRect = &tempItemsRect;
+ int vx, vy;
+ GetViewStart(&vx, &vy);
+ vx *= wxPG_PIXELS_PER_UNIT;
+ vy *= wxPG_PIXELS_PER_UNIT;
+
+ wxRect drawRect(itemsRect->x - vx,
+ itemsRect->y - vy,
+ itemsRect->width,
+ itemsRect->height);
+
// items added check
if ( m_pState->m_itemsAdded ) PrepareAfterItemsAdded();
// items added check
if ( m_pState->m_itemsAdded ) PrepareAfterItemsAdded();
{
if ( !m_doubleBuffer )
{
{
if ( !m_doubleBuffer )
{
- paintFinishY = drawRect->y;
+ paintFinishY = itemsRect->y;
- dc.SetClippingRegion( *drawRect );
- paintFinishY = DoDrawItems( *dcPtr, drawRect, isBuffered );
- int drawBottomY = drawRect->y + drawRect->height;
+ paintFinishY = DoDrawItems( *dcPtr, itemsRect, isBuffered );
+ int drawBottomY = itemsRect->y + itemsRect->height;
// Clear area beyond last painted property
if ( paintFinishY < drawBottomY )
{
// Clear area beyond last painted property
if ( paintFinishY < drawBottomY )
{
+ wxLogDebug("%i", paintFinishY);
dcPtr->SetPen(m_colEmptySpace);
dcPtr->SetBrush(m_colEmptySpace);
dcPtr->DrawRectangle(0, paintFinishY,
m_width,
drawBottomY );
}
dcPtr->SetPen(m_colEmptySpace);
dcPtr->SetBrush(m_colEmptySpace);
dcPtr->DrawRectangle(0, paintFinishY,
m_width,
drawBottomY );
}
-
- dc.DestroyClippingRegion();
}
#if wxPG_DOUBLE_BUFFER
if ( bufferDC )
{
}
#if wxPG_DOUBLE_BUFFER
if ( bufferDC )
{
- dc.Blit( drawRect->x, drawRect->y, drawRect->width,
- drawRect->height,
+ dc.Blit( drawRect.x, drawRect.y, drawRect.width,
+ drawRect.height,
bufferDC, 0, 0, wxCOPY );
delete bufferDC;
}
bufferDC, 0, 0, wxCOPY );
delete bufferDC;
}
// Just clear the area
dc.SetPen(m_colEmptySpace);
dc.SetBrush(m_colEmptySpace);
// Just clear the area
dc.SetPen(m_colEmptySpace);
dc.SetBrush(m_colEmptySpace);
- dc.DrawRectangle(*drawRect);
+ dc.DrawRectangle(drawRect);
}
}
// -----------------------------------------------------------------------
int wxPropertyGrid::DoDrawItems( wxDC& dc,
}
}
// -----------------------------------------------------------------------
int wxPropertyGrid::DoDrawItems( wxDC& dc,
- const wxRect* drawRect,
+ const wxRect* itemsRect,
bool isBuffered ) const
{
const wxPGProperty* firstItem;
const wxPGProperty* lastItem;
bool isBuffered ) const
{
const wxPGProperty* firstItem;
const wxPGProperty* lastItem;
- firstItem = DoGetItemAtY(drawRect->y);
- lastItem = DoGetItemAtY(drawRect->y+drawRect->height-1);
+ firstItem = DoGetItemAtY(itemsRect->y);
+ lastItem = DoGetItemAtY(itemsRect->y+itemsRect->height-1);
if ( !lastItem )
lastItem = GetLastItem( wxPG_ITERATE_VISIBLE );
if ( m_frozen || m_height < 1 || firstItem == NULL )
if ( !lastItem )
lastItem = GetLastItem( wxPG_ITERATE_VISIBLE );
if ( m_frozen || m_height < 1 || firstItem == NULL )
- wxCHECK_MSG( !m_pState->m_itemsAdded, drawRect->y,
+ wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->y,
"no items added" );
wxASSERT( m_pState->m_properties->GetChildCount() );
"no items added" );
wxASSERT( m_pState->m_properties->GetChildCount() );
int firstItemTopY;
int lastItemBottomY;
int firstItemTopY;
int lastItemBottomY;
- firstItemTopY = drawRect->y;
- lastItemBottomY = drawRect->y + drawRect->height;
+ firstItemTopY = itemsRect->y;
+ lastItemBottomY = itemsRect->y + itemsRect->height;
// Align y coordinates to item boundaries
firstItemTopY -= firstItemTopY % lh;
// Align y coordinates to item boundaries
firstItemTopY -= firstItemTopY % lh;
// Entire range outside scrolled, visible area?
if ( firstItemTopY >= (int)m_pState->GetVirtualHeight() ||
lastItemBottomY <= 0 )
// Entire range outside scrolled, visible area?
if ( firstItemTopY >= (int)m_pState->GetVirtualHeight() ||
lastItemBottomY <= 0 )
wxCHECK_MSG( firstItemTopY < lastItemBottomY,
wxCHECK_MSG( firstItemTopY < lastItemBottomY,
"invalid y values" );
/*
wxLogDebug(" -> DoDrawItems ( \"%s\" -> \"%s\"
"invalid y values" );
/*
wxLogDebug(" -> DoDrawItems ( \"%s\" -> \"%s\"
- "height=%i (ch=%i), drawRect = 0x%lX )",
+ "height=%i (ch=%i), itemsRect = 0x%lX )",
firstItem->GetLabel().c_str(),
lastItem->GetLabel().c_str(),
(int)(lastItemBottomY - firstItemTopY),
(int)m_height,
firstItem->GetLabel().c_str(),
lastItem->GetLabel().c_str(),
(int)(lastItemBottomY - firstItemTopY),
(int)m_height,
- (unsigned long)drawRect );
+ (unsigned long)&itemsRect );
//
// With wxPG_DOUBLE_BUFFER, do double buffering
//
// With wxPG_DOUBLE_BUFFER, do double buffering
- // - buffer's y = 0, so align drawRect and coordinates to that
+ // - buffer's y = 0, so align itemsRect and coordinates to that
//
#if wxPG_DOUBLE_BUFFER
int yRelMod = 0;
//
#if wxPG_DOUBLE_BUFFER
int yRelMod = 0;
- xRelMod = drawRect->x;
- yRelMod = drawRect->y;
+ xRelMod = itemsRect->x;
+ yRelMod = itemsRect->y;
- // drawRect conversion
- cr2 = *drawRect;
+ // itemsRect conversion
+ cr2 = *itemsRect;
cr2.x -= xRelMod;
cr2.y -= yRelMod;
cr2.x -= xRelMod;
cr2.y -= yRelMod;
firstItemTopY -= yRelMod;
lastItemBottomY -= yRelMod;
}
firstItemTopY -= yRelMod;
lastItemBottomY -= yRelMod;
}
void wxPropertyGrid::SetFocusOnCanvas()
{
void wxPropertyGrid::SetFocusOnCanvas()
{
- SetFocusIgnoringChildren();
else DoExpand( p, true );
}
else DoExpand( p, true );
}
+ // Do not Skip() the event after selection has been made.
+ // Otherwise default event handling behavior kicks in
+ // and may revert focus back to the main canvas.
+ res = true;
int x, y;
if ( OnMouseCommon( event, &x, &y ) )
{
int x, y;
if ( OnMouseCommon( event, &x, &y ) )
{
- HandleMouseClick(x,y,event);
+ if ( !HandleMouseClick(x, y, event) )
+ event.Skip();
+ }
+ else
+ {
+ event.Skip();
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------
int x, y;
CalcUnscrolledPosition( event.m_x, event.m_y, &x, &y );
HandleMouseDoubleClick(x,y,event);
int x, y;
CalcUnscrolledPosition( event.m_x, event.m_y, &x, &y );
HandleMouseDoubleClick(x,y,event);
+
+ // Do not Skip() event here - OnMouseClick() call above
+ // should have already taken care of it.
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------
int x, y;
if ( OnMouseCommon( event, &x, &y ) )
{
int x, y;
if ( OnMouseCommon( event, &x, &y ) )
{
- HandleMouseUp(x,y,event);
+ if ( !HandleMouseUp(x, y, event) )
+ event.Skip();
+ }
+ else
+ {
+ event.Skip();
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------