mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the last 2.9 release before the 3.0 stable release. Since the full wxWidgets distribution is rather large, I have imported only the parts that we use, on a subdirectory basis: art include/wx/*.* include/wx/aui include/wx/cocoa include/wx/generic include/wx/gtk include/wx/meta include/wx/msw include/wx/osx include/wx/persist include/wx/private include/wx/protocol include/wx/unix src/aui src/common src/generic src/gtk src/msw src/osx src/unix git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
856
Externals/wxWidgets3/include/wx/generic/private/grid.h
vendored
Normal file
856
Externals/wxWidgets3/include/wx/generic/private/grid.h
vendored
Normal file
@ -0,0 +1,856 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/private/grid.h
|
||||
// Purpose: Private wxGrid structures
|
||||
// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
|
||||
// Modified by: Santiago Palacios
|
||||
// Created: 1/08/1999
|
||||
// RCS-ID: $Id: grid.h 66792 2011-01-27 18:35:01Z SC $
|
||||
// Copyright: (c) Michael Bedward
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_GRID_PRIVATE_H_
|
||||
#define _WX_GENERIC_GRID_PRIVATE_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_GRID
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// array classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DEFINE_ARRAY_WITH_DECL_PTR(wxGridCellAttr *, wxArrayAttrs,
|
||||
class WXDLLIMPEXP_ADV);
|
||||
|
||||
struct wxGridCellWithAttr
|
||||
{
|
||||
wxGridCellWithAttr(int row, int col, wxGridCellAttr *attr_)
|
||||
: coords(row, col), attr(attr_)
|
||||
{
|
||||
wxASSERT( attr );
|
||||
}
|
||||
|
||||
wxGridCellWithAttr(const wxGridCellWithAttr& other)
|
||||
: coords(other.coords),
|
||||
attr(other.attr)
|
||||
{
|
||||
attr->IncRef();
|
||||
}
|
||||
|
||||
wxGridCellWithAttr& operator=(const wxGridCellWithAttr& other)
|
||||
{
|
||||
coords = other.coords;
|
||||
if (attr != other.attr)
|
||||
{
|
||||
attr->DecRef();
|
||||
attr = other.attr;
|
||||
attr->IncRef();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ChangeAttr(wxGridCellAttr* new_attr)
|
||||
{
|
||||
if (attr != new_attr)
|
||||
{
|
||||
// "Delete" (i.e. DecRef) the old attribute.
|
||||
attr->DecRef();
|
||||
attr = new_attr;
|
||||
// Take ownership of the new attribute, i.e. no IncRef.
|
||||
}
|
||||
}
|
||||
|
||||
~wxGridCellWithAttr()
|
||||
{
|
||||
attr->DecRef();
|
||||
}
|
||||
|
||||
wxGridCellCoords coords;
|
||||
wxGridCellAttr *attr;
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellWithAttr, wxGridCellWithAttrArray,
|
||||
class WXDLLIMPEXP_ADV);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// header column providing access to the column information stored in wxGrid
|
||||
// via wxHeaderColumn interface
|
||||
class wxGridHeaderColumn : public wxHeaderColumn
|
||||
{
|
||||
public:
|
||||
wxGridHeaderColumn(wxGrid *grid, int col)
|
||||
: m_grid(grid),
|
||||
m_col(col)
|
||||
{
|
||||
}
|
||||
|
||||
virtual wxString GetTitle() const { return m_grid->GetColLabelValue(m_col); }
|
||||
virtual wxBitmap GetBitmap() const { return wxNullBitmap; }
|
||||
virtual int GetWidth() const { return m_grid->GetColSize(m_col); }
|
||||
virtual int GetMinWidth() const { return 0; }
|
||||
virtual wxAlignment GetAlignment() const
|
||||
{
|
||||
int horz,
|
||||
vert;
|
||||
m_grid->GetColLabelAlignment(&horz, &vert);
|
||||
|
||||
return static_cast<wxAlignment>(horz);
|
||||
}
|
||||
|
||||
virtual int GetFlags() const
|
||||
{
|
||||
// we can't know in advance whether we can sort by this column or not
|
||||
// with wxGrid API so suppose we can by default
|
||||
int flags = wxCOL_SORTABLE;
|
||||
if ( m_grid->CanDragColSize(m_col) )
|
||||
flags |= wxCOL_RESIZABLE;
|
||||
if ( m_grid->CanDragColMove() )
|
||||
flags |= wxCOL_REORDERABLE;
|
||||
if ( GetWidth() == 0 )
|
||||
flags |= wxCOL_HIDDEN;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
virtual bool IsSortKey() const
|
||||
{
|
||||
return m_grid->IsSortingBy(m_col);
|
||||
}
|
||||
|
||||
virtual bool IsSortOrderAscending() const
|
||||
{
|
||||
return m_grid->IsSortOrderAscending();
|
||||
}
|
||||
|
||||
private:
|
||||
// these really should be const but are not because the column needs to be
|
||||
// assignable to be used in a wxVector (in STL build, in non-STL build we
|
||||
// avoid the need for this)
|
||||
wxGrid *m_grid;
|
||||
int m_col;
|
||||
};
|
||||
|
||||
// header control retreiving column information from the grid
|
||||
class wxGridHeaderCtrl : public wxHeaderCtrl
|
||||
{
|
||||
public:
|
||||
wxGridHeaderCtrl(wxGrid *owner)
|
||||
: wxHeaderCtrl(owner,
|
||||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxHD_ALLOW_HIDE |
|
||||
(owner->CanDragColMove() ? wxHD_ALLOW_REORDER : 0))
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const
|
||||
{
|
||||
return m_columns[idx];
|
||||
}
|
||||
|
||||
private:
|
||||
wxGrid *GetOwner() const { return static_cast<wxGrid *>(GetParent()); }
|
||||
|
||||
static wxMouseEvent GetDummyMouseEvent()
|
||||
{
|
||||
// make up a dummy event for the grid event to use -- unfortunately we
|
||||
// can't do anything else here
|
||||
wxMouseEvent e;
|
||||
e.SetState(wxGetMouseState());
|
||||
return e;
|
||||
}
|
||||
|
||||
// override the base class method to update our m_columns array
|
||||
virtual void OnColumnCountChanging(unsigned int count)
|
||||
{
|
||||
const unsigned countOld = m_columns.size();
|
||||
if ( count < countOld )
|
||||
{
|
||||
// just discard the columns which don't exist any more (notice that
|
||||
// we can't use resize() here as it would require the vector
|
||||
// value_type, i.e. wxGridHeaderColumn to be default constructible,
|
||||
// which it is not)
|
||||
m_columns.erase(m_columns.begin() + count, m_columns.end());
|
||||
}
|
||||
else // new columns added
|
||||
{
|
||||
// add columns for the new elements
|
||||
for ( unsigned n = countOld; n < count; n++ )
|
||||
m_columns.push_back(wxGridHeaderColumn(GetOwner(), n));
|
||||
}
|
||||
}
|
||||
|
||||
// override to implement column auto sizing
|
||||
virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle)
|
||||
{
|
||||
// TODO: currently grid doesn't support computing the column best width
|
||||
// from its contents so we just use the best label width as is
|
||||
GetOwner()->SetColSize(idx, widthTitle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// overridden to react to the actions using the columns popup menu
|
||||
virtual void UpdateColumnVisibility(unsigned int idx, bool show)
|
||||
{
|
||||
GetOwner()->SetColSize(idx, show ? wxGRID_AUTOSIZE : 0);
|
||||
|
||||
// as this is done by the user we should notify the main program about
|
||||
// it
|
||||
GetOwner()->SendGridSizeEvent(wxEVT_GRID_COL_SIZE, -1, idx,
|
||||
GetDummyMouseEvent());
|
||||
}
|
||||
|
||||
// overridden to react to the columns order changes in the customization
|
||||
// dialog
|
||||
virtual void UpdateColumnsOrder(const wxArrayInt& order)
|
||||
{
|
||||
GetOwner()->SetColumnsOrder(order);
|
||||
}
|
||||
|
||||
|
||||
// event handlers forwarding wxHeaderCtrl events to wxGrid
|
||||
void OnClick(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
GetOwner()->SendEvent(wxEVT_GRID_LABEL_LEFT_CLICK,
|
||||
-1, event.GetColumn(),
|
||||
GetDummyMouseEvent());
|
||||
|
||||
GetOwner()->DoColHeaderClick(event.GetColumn());
|
||||
}
|
||||
|
||||
void OnDoubleClick(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
if ( !GetOwner()->SendEvent(wxEVT_GRID_LABEL_LEFT_DCLICK,
|
||||
-1, event.GetColumn(),
|
||||
GetDummyMouseEvent()) )
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
void OnRightClick(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
if ( !GetOwner()->SendEvent(wxEVT_GRID_LABEL_RIGHT_CLICK,
|
||||
-1, event.GetColumn(),
|
||||
GetDummyMouseEvent()) )
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
void OnBeginResize(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
GetOwner()->DoStartResizeCol(event.GetColumn());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnResizing(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
GetOwner()->DoUpdateResizeColWidth(event.GetWidth());
|
||||
}
|
||||
|
||||
void OnEndResize(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
// we again need to pass a mouse event to be used for the grid event
|
||||
// generation but we don't have it here so use a dummy one as in
|
||||
// UpdateColumnVisibility()
|
||||
wxMouseEvent e;
|
||||
e.SetState(wxGetMouseState());
|
||||
GetOwner()->DoEndDragResizeCol(e);
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnBeginReorder(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
GetOwner()->DoStartMoveCol(event.GetColumn());
|
||||
}
|
||||
|
||||
void OnEndReorder(wxHeaderCtrlEvent& event)
|
||||
{
|
||||
GetOwner()->DoEndMoveCol(event.GetNewOrder());
|
||||
}
|
||||
|
||||
wxVector<wxGridHeaderColumn> m_columns;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridHeaderCtrl);
|
||||
};
|
||||
|
||||
// common base class for various grid subwindows
|
||||
class WXDLLIMPEXP_ADV wxGridSubwindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxGridSubwindow(wxGrid *owner,
|
||||
int additionalStyle = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxWindow(owner, wxID_ANY,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxBORDER_NONE | additionalStyle,
|
||||
name)
|
||||
{
|
||||
m_owner = owner;
|
||||
}
|
||||
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
|
||||
wxGrid *GetOwner() { return m_owner; }
|
||||
|
||||
protected:
|
||||
void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
|
||||
|
||||
wxGrid *m_owner;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridSubwindow);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridRowLabelWindow : public wxGridSubwindow
|
||||
{
|
||||
public:
|
||||
wxGridRowLabelWindow(wxGrid *parent)
|
||||
: wxGridSubwindow(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnMouseEvent( wxMouseEvent& event );
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridRowLabelWindow);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridColLabelWindow : public wxGridSubwindow
|
||||
{
|
||||
public:
|
||||
wxGridColLabelWindow(wxGrid *parent)
|
||||
: wxGridSubwindow(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnMouseEvent( wxMouseEvent& event );
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridColLabelWindow);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridCornerLabelWindow : public wxGridSubwindow
|
||||
{
|
||||
public:
|
||||
wxGridCornerLabelWindow(wxGrid *parent)
|
||||
: wxGridSubwindow(parent)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
void OnMouseEvent( wxMouseEvent& event );
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridCornerLabelWindow);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridWindow : public wxGridSubwindow
|
||||
{
|
||||
public:
|
||||
wxGridWindow(wxGrid *parent)
|
||||
: wxGridSubwindow(parent,
|
||||
wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
"GridWindow")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ScrollWindow( int dx, int dy, const wxRect *rect );
|
||||
|
||||
virtual bool AcceptsFocus() const { return true; }
|
||||
|
||||
private:
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void OnMouseWheel( wxMouseEvent& event );
|
||||
void OnMouseEvent( wxMouseEvent& event );
|
||||
void OnKeyDown( wxKeyEvent& );
|
||||
void OnKeyUp( wxKeyEvent& );
|
||||
void OnChar( wxKeyEvent& );
|
||||
void OnEraseBackground( wxEraseEvent& );
|
||||
void OnFocus( wxFocusEvent& );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridWindow);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the internal data representation used by wxGridCellAttrProvider
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this class stores attributes set for cells
|
||||
class WXDLLIMPEXP_ADV wxGridCellAttrData
|
||||
{
|
||||
public:
|
||||
void SetAttr(wxGridCellAttr *attr, int row, int col);
|
||||
wxGridCellAttr *GetAttr(int row, int col) const;
|
||||
void UpdateAttrRows( size_t pos, int numRows );
|
||||
void UpdateAttrCols( size_t pos, int numCols );
|
||||
|
||||
private:
|
||||
// searches for the attr for given cell, returns wxNOT_FOUND if not found
|
||||
int FindIndex(int row, int col) const;
|
||||
|
||||
wxGridCellWithAttrArray m_attrs;
|
||||
};
|
||||
|
||||
// this class stores attributes set for rows or columns
|
||||
class WXDLLIMPEXP_ADV wxGridRowOrColAttrData
|
||||
{
|
||||
public:
|
||||
// empty ctor to suppress warnings
|
||||
wxGridRowOrColAttrData() {}
|
||||
~wxGridRowOrColAttrData();
|
||||
|
||||
void SetAttr(wxGridCellAttr *attr, int rowOrCol);
|
||||
wxGridCellAttr *GetAttr(int rowOrCol) const;
|
||||
void UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols );
|
||||
|
||||
private:
|
||||
wxArrayInt m_rowsOrCols;
|
||||
wxArrayAttrs m_attrs;
|
||||
};
|
||||
|
||||
// NB: this is just a wrapper around 3 objects: one which stores cell
|
||||
// attributes, and 2 others for row/col ones
|
||||
class WXDLLIMPEXP_ADV wxGridCellAttrProviderData
|
||||
{
|
||||
public:
|
||||
wxGridCellAttrData m_cellAttrs;
|
||||
wxGridRowOrColAttrData m_rowAttrs,
|
||||
m_colAttrs;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// operations classes abstracting the difference between operating on rows and
|
||||
// columns
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// This class allows to write a function only once because by using its methods
|
||||
// it will apply to both columns and rows.
|
||||
//
|
||||
// This is an abstract interface definition, the two concrete implementations
|
||||
// below should be used when working with rows and columns respectively.
|
||||
class wxGridOperations
|
||||
{
|
||||
public:
|
||||
// Returns the operations in the other direction, i.e. wxGridRowOperations
|
||||
// if this object is a wxGridColumnOperations and vice versa.
|
||||
virtual wxGridOperations& Dual() const = 0;
|
||||
|
||||
// Return the number of rows or columns.
|
||||
virtual int GetNumberOfLines(const wxGrid *grid) const = 0;
|
||||
|
||||
// Return the selection mode which allows selecting rows or columns.
|
||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const = 0;
|
||||
|
||||
// Make a wxGridCellCoords from the given components: thisDir is row or
|
||||
// column and otherDir is column or row
|
||||
virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const = 0;
|
||||
|
||||
// Calculate the scrolled position of the given abscissa or ordinate.
|
||||
virtual int CalcScrolledPosition(wxGrid *grid, int pos) const = 0;
|
||||
|
||||
// Selects the horizontal or vertical component from the given object.
|
||||
virtual int Select(const wxGridCellCoords& coords) const = 0;
|
||||
virtual int Select(const wxPoint& pt) const = 0;
|
||||
virtual int Select(const wxSize& sz) const = 0;
|
||||
virtual int Select(const wxRect& r) const = 0;
|
||||
virtual int& Select(wxRect& r) const = 0;
|
||||
|
||||
// Returns width or height of the rectangle
|
||||
virtual int& SelectSize(wxRect& r) const = 0;
|
||||
|
||||
// Make a wxSize such that Select() applied to it returns first component
|
||||
virtual wxSize MakeSize(int first, int second) const = 0;
|
||||
|
||||
// Sets the row or column component of the given cell coordinates
|
||||
virtual void Set(wxGridCellCoords& coords, int line) const = 0;
|
||||
|
||||
|
||||
// Draws a line parallel to the row or column, i.e. horizontal or vertical:
|
||||
// pos is the horizontal or vertical position of the line and start and end
|
||||
// are the coordinates of the line extremities in the other direction
|
||||
virtual void
|
||||
DrawParallelLine(wxDC& dc, int start, int end, int pos) const = 0;
|
||||
|
||||
// Draw a horizontal or vertical line across the given rectangle
|
||||
// (this is implemented in terms of above and uses Select() to extract
|
||||
// start and end from the given rectangle)
|
||||
void DrawParallelLineInRect(wxDC& dc, const wxRect& rect, int pos) const
|
||||
{
|
||||
const int posStart = Select(rect.GetPosition());
|
||||
DrawParallelLine(dc, posStart, posStart + Select(rect.GetSize()), pos);
|
||||
}
|
||||
|
||||
|
||||
// Return the index of the row or column at the given pixel coordinate.
|
||||
virtual int
|
||||
PosToLine(const wxGrid *grid, int pos, bool clip = false) const = 0;
|
||||
|
||||
// Get the top/left position, in pixels, of the given row or column
|
||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const = 0;
|
||||
|
||||
// Get the bottom/right position, in pixels, of the given row or column
|
||||
virtual int GetLineEndPos(const wxGrid *grid, int line) const = 0;
|
||||
|
||||
// Get the height/width of the given row/column
|
||||
virtual int GetLineSize(const wxGrid *grid, int line) const = 0;
|
||||
|
||||
// Get wxGrid::m_rowBottoms/m_colRights array
|
||||
virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const = 0;
|
||||
|
||||
// Get default height row height or column width
|
||||
virtual int GetDefaultLineSize(const wxGrid *grid) const = 0;
|
||||
|
||||
// Return the minimal acceptable row height or column width
|
||||
virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const = 0;
|
||||
|
||||
// Return the minimal row height or column width
|
||||
virtual int GetMinimalLineSize(const wxGrid *grid, int line) const = 0;
|
||||
|
||||
// Set the row height or column width
|
||||
virtual void SetLineSize(wxGrid *grid, int line, int size) const = 0;
|
||||
|
||||
// Set the row default height or column default width
|
||||
virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const = 0;
|
||||
|
||||
|
||||
// Return the index of the line at the given position
|
||||
//
|
||||
// NB: currently this is always identity for the rows as reordering is only
|
||||
// implemented for the lines
|
||||
virtual int GetLineAt(const wxGrid *grid, int pos) const = 0;
|
||||
|
||||
// Return the index of the line just before the given one.
|
||||
virtual int GetLineBefore(const wxGrid* grid, int line) const = 0;
|
||||
|
||||
// Get the row or column label window
|
||||
virtual wxWindow *GetHeaderWindow(wxGrid *grid) const = 0;
|
||||
|
||||
// Get the width or height of the row or column label window
|
||||
virtual int GetHeaderWindowSize(wxGrid *grid) const = 0;
|
||||
|
||||
|
||||
// This class is never used polymorphically but give it a virtual dtor
|
||||
// anyhow to suppress g++ complaints about it
|
||||
virtual ~wxGridOperations() { }
|
||||
};
|
||||
|
||||
class wxGridRowOperations : public wxGridOperations
|
||||
{
|
||||
public:
|
||||
virtual wxGridOperations& Dual() const;
|
||||
|
||||
virtual int GetNumberOfLines(const wxGrid *grid) const
|
||||
{ return grid->GetNumberRows(); }
|
||||
|
||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const
|
||||
{ return wxGrid::wxGridSelectRows; }
|
||||
|
||||
virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const
|
||||
{ return wxGridCellCoords(thisDir, otherDir); }
|
||||
|
||||
virtual int CalcScrolledPosition(wxGrid *grid, int pos) const
|
||||
{ return grid->CalcScrolledPosition(wxPoint(pos, 0)).x; }
|
||||
|
||||
virtual int Select(const wxGridCellCoords& c) const { return c.GetRow(); }
|
||||
virtual int Select(const wxPoint& pt) const { return pt.x; }
|
||||
virtual int Select(const wxSize& sz) const { return sz.x; }
|
||||
virtual int Select(const wxRect& r) const { return r.x; }
|
||||
virtual int& Select(wxRect& r) const { return r.x; }
|
||||
virtual int& SelectSize(wxRect& r) const { return r.width; }
|
||||
virtual wxSize MakeSize(int first, int second) const
|
||||
{ return wxSize(first, second); }
|
||||
virtual void Set(wxGridCellCoords& coords, int line) const
|
||||
{ coords.SetRow(line); }
|
||||
|
||||
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const
|
||||
{ dc.DrawLine(start, pos, end, pos); }
|
||||
|
||||
virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const
|
||||
{ return grid->YToRow(pos, clip); }
|
||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const
|
||||
{ return grid->GetRowTop(line); }
|
||||
virtual int GetLineEndPos(const wxGrid *grid, int line) const
|
||||
{ return grid->GetRowBottom(line); }
|
||||
virtual int GetLineSize(const wxGrid *grid, int line) const
|
||||
{ return grid->GetRowHeight(line); }
|
||||
virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const
|
||||
{ return grid->m_rowBottoms; }
|
||||
virtual int GetDefaultLineSize(const wxGrid *grid) const
|
||||
{ return grid->GetDefaultRowSize(); }
|
||||
virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const
|
||||
{ return grid->GetRowMinimalAcceptableHeight(); }
|
||||
virtual int GetMinimalLineSize(const wxGrid *grid, int line) const
|
||||
{ return grid->GetRowMinimalHeight(line); }
|
||||
virtual void SetLineSize(wxGrid *grid, int line, int size) const
|
||||
{ grid->SetRowSize(line, size); }
|
||||
virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const
|
||||
{ grid->SetDefaultRowSize(size, resizeExisting); }
|
||||
|
||||
virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int line) const
|
||||
{ return line; } // TODO: implement row reordering
|
||||
|
||||
virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const
|
||||
{ return line ? line - 1 : line; }
|
||||
|
||||
virtual wxWindow *GetHeaderWindow(wxGrid *grid) const
|
||||
{ return grid->GetGridRowLabelWindow(); }
|
||||
virtual int GetHeaderWindowSize(wxGrid *grid) const
|
||||
{ return grid->GetRowLabelSize(); }
|
||||
};
|
||||
|
||||
class wxGridColumnOperations : public wxGridOperations
|
||||
{
|
||||
public:
|
||||
virtual wxGridOperations& Dual() const;
|
||||
|
||||
virtual int GetNumberOfLines(const wxGrid *grid) const
|
||||
{ return grid->GetNumberCols(); }
|
||||
|
||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const
|
||||
{ return wxGrid::wxGridSelectColumns; }
|
||||
|
||||
virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const
|
||||
{ return wxGridCellCoords(otherDir, thisDir); }
|
||||
|
||||
virtual int CalcScrolledPosition(wxGrid *grid, int pos) const
|
||||
{ return grid->CalcScrolledPosition(wxPoint(0, pos)).y; }
|
||||
|
||||
virtual int Select(const wxGridCellCoords& c) const { return c.GetCol(); }
|
||||
virtual int Select(const wxPoint& pt) const { return pt.y; }
|
||||
virtual int Select(const wxSize& sz) const { return sz.y; }
|
||||
virtual int Select(const wxRect& r) const { return r.y; }
|
||||
virtual int& Select(wxRect& r) const { return r.y; }
|
||||
virtual int& SelectSize(wxRect& r) const { return r.height; }
|
||||
virtual wxSize MakeSize(int first, int second) const
|
||||
{ return wxSize(second, first); }
|
||||
virtual void Set(wxGridCellCoords& coords, int line) const
|
||||
{ coords.SetCol(line); }
|
||||
|
||||
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const
|
||||
{ dc.DrawLine(pos, start, pos, end); }
|
||||
|
||||
virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const
|
||||
{ return grid->XToCol(pos, clip); }
|
||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const
|
||||
{ return grid->GetColLeft(line); }
|
||||
virtual int GetLineEndPos(const wxGrid *grid, int line) const
|
||||
{ return grid->GetColRight(line); }
|
||||
virtual int GetLineSize(const wxGrid *grid, int line) const
|
||||
{ return grid->GetColWidth(line); }
|
||||
virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const
|
||||
{ return grid->m_colRights; }
|
||||
virtual int GetDefaultLineSize(const wxGrid *grid) const
|
||||
{ return grid->GetDefaultColSize(); }
|
||||
virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const
|
||||
{ return grid->GetColMinimalAcceptableWidth(); }
|
||||
virtual int GetMinimalLineSize(const wxGrid *grid, int line) const
|
||||
{ return grid->GetColMinimalWidth(line); }
|
||||
virtual void SetLineSize(wxGrid *grid, int line, int size) const
|
||||
{ grid->SetColSize(line, size); }
|
||||
virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const
|
||||
{ grid->SetDefaultColSize(size, resizeExisting); }
|
||||
|
||||
virtual int GetLineAt(const wxGrid *grid, int line) const
|
||||
{ return grid->GetColAt(line); }
|
||||
|
||||
virtual int GetLineBefore(const wxGrid* grid, int line) const
|
||||
{ return grid->GetColAt(wxMax(0, grid->GetColPos(line) - 1)); }
|
||||
|
||||
virtual wxWindow *GetHeaderWindow(wxGrid *grid) const
|
||||
{ return grid->GetGridColLabelWindow(); }
|
||||
virtual int GetHeaderWindowSize(wxGrid *grid) const
|
||||
{ return grid->GetColLabelSize(); }
|
||||
};
|
||||
|
||||
// This class abstracts the difference between operations going forward
|
||||
// (down/right) and backward (up/left) and allows to use the same code for
|
||||
// functions which differ only in the direction of grid traversal
|
||||
//
|
||||
// Like wxGridOperations it's an ABC with two concrete subclasses below. Unlike
|
||||
// it, this is a normal object and not just a function dispatch table and has a
|
||||
// non-default ctor.
|
||||
//
|
||||
// Note: the explanation of this discrepancy is the existence of (very useful)
|
||||
// Dual() method in wxGridOperations which forces us to make wxGridOperations a
|
||||
// function dispatcher only.
|
||||
class wxGridDirectionOperations
|
||||
{
|
||||
public:
|
||||
// The oper parameter to ctor selects whether we work with rows or columns
|
||||
wxGridDirectionOperations(wxGrid *grid, const wxGridOperations& oper)
|
||||
: m_grid(grid),
|
||||
m_oper(oper)
|
||||
{
|
||||
}
|
||||
|
||||
// Check if the component of this point in our direction is at the
|
||||
// boundary, i.e. is the first/last row/column
|
||||
virtual bool IsAtBoundary(const wxGridCellCoords& coords) const = 0;
|
||||
|
||||
// Increment the component of this point in our direction
|
||||
virtual void Advance(wxGridCellCoords& coords) const = 0;
|
||||
|
||||
// Find the line at the given distance, in pixels, away from this one
|
||||
// (this uses clipping, i.e. anything after the last line is counted as the
|
||||
// last one and anything before the first one as 0)
|
||||
virtual int MoveByPixelDistance(int line, int distance) const = 0;
|
||||
|
||||
// This class is never used polymorphically but give it a virtual dtor
|
||||
// anyhow to suppress g++ complaints about it
|
||||
virtual ~wxGridDirectionOperations() { }
|
||||
|
||||
protected:
|
||||
wxGrid * const m_grid;
|
||||
const wxGridOperations& m_oper;
|
||||
};
|
||||
|
||||
class wxGridBackwardOperations : public wxGridDirectionOperations
|
||||
{
|
||||
public:
|
||||
wxGridBackwardOperations(wxGrid *grid, const wxGridOperations& oper)
|
||||
: wxGridDirectionOperations(grid, oper)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool IsAtBoundary(const wxGridCellCoords& coords) const
|
||||
{
|
||||
wxASSERT_MSG( m_oper.Select(coords) >= 0, "invalid row/column" );
|
||||
|
||||
return m_oper.Select(coords) == 0;
|
||||
}
|
||||
|
||||
virtual void Advance(wxGridCellCoords& coords) const
|
||||
{
|
||||
wxASSERT( !IsAtBoundary(coords) );
|
||||
|
||||
m_oper.Set(coords, m_oper.Select(coords) - 1);
|
||||
}
|
||||
|
||||
virtual int MoveByPixelDistance(int line, int distance) const
|
||||
{
|
||||
int pos = m_oper.GetLineStartPos(m_grid, line);
|
||||
return m_oper.PosToLine(m_grid, pos - distance + 1, true);
|
||||
}
|
||||
};
|
||||
|
||||
class wxGridForwardOperations : public wxGridDirectionOperations
|
||||
{
|
||||
public:
|
||||
wxGridForwardOperations(wxGrid *grid, const wxGridOperations& oper)
|
||||
: wxGridDirectionOperations(grid, oper),
|
||||
m_numLines(oper.GetNumberOfLines(grid))
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool IsAtBoundary(const wxGridCellCoords& coords) const
|
||||
{
|
||||
wxASSERT_MSG( m_oper.Select(coords) < m_numLines, "invalid row/column" );
|
||||
|
||||
return m_oper.Select(coords) == m_numLines - 1;
|
||||
}
|
||||
|
||||
virtual void Advance(wxGridCellCoords& coords) const
|
||||
{
|
||||
wxASSERT( !IsAtBoundary(coords) );
|
||||
|
||||
m_oper.Set(coords, m_oper.Select(coords) + 1);
|
||||
}
|
||||
|
||||
virtual int MoveByPixelDistance(int line, int distance) const
|
||||
{
|
||||
int pos = m_oper.GetLineStartPos(m_grid, line);
|
||||
return m_oper.PosToLine(m_grid, pos + distance, true);
|
||||
}
|
||||
|
||||
private:
|
||||
const int m_numLines;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// data structures used for the data type registry
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct wxGridDataTypeInfo
|
||||
{
|
||||
wxGridDataTypeInfo(const wxString& typeName,
|
||||
wxGridCellRenderer* renderer,
|
||||
wxGridCellEditor* editor)
|
||||
: m_typeName(typeName), m_renderer(renderer), m_editor(editor)
|
||||
{}
|
||||
|
||||
~wxGridDataTypeInfo()
|
||||
{
|
||||
wxSafeDecRef(m_renderer);
|
||||
wxSafeDecRef(m_editor);
|
||||
}
|
||||
|
||||
wxString m_typeName;
|
||||
wxGridCellRenderer* m_renderer;
|
||||
wxGridCellEditor* m_editor;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxGridDataTypeInfo);
|
||||
};
|
||||
|
||||
|
||||
WX_DEFINE_ARRAY_WITH_DECL_PTR(wxGridDataTypeInfo*, wxGridDataTypeInfoArray,
|
||||
class WXDLLIMPEXP_ADV);
|
||||
|
||||
|
||||
class WXDLLIMPEXP_ADV wxGridTypeRegistry
|
||||
{
|
||||
public:
|
||||
wxGridTypeRegistry() {}
|
||||
~wxGridTypeRegistry();
|
||||
|
||||
void RegisterDataType(const wxString& typeName,
|
||||
wxGridCellRenderer* renderer,
|
||||
wxGridCellEditor* editor);
|
||||
|
||||
// find one of already registered data types
|
||||
int FindRegisteredDataType(const wxString& typeName);
|
||||
|
||||
// try to FindRegisteredDataType(), if this fails and typeName is one of
|
||||
// standard typenames, register it and return its index
|
||||
int FindDataType(const wxString& typeName);
|
||||
|
||||
// try to FindDataType(), if it fails see if it is not one of already
|
||||
// registered data types with some params in which case clone the
|
||||
// registered data type and set params for it
|
||||
int FindOrCloneDataType(const wxString& typeName);
|
||||
|
||||
wxGridCellRenderer* GetRenderer(int index);
|
||||
wxGridCellEditor* GetEditor(int index);
|
||||
|
||||
private:
|
||||
wxGridDataTypeInfoArray m_typeinfo;
|
||||
};
|
||||
|
||||
#endif // wxUSE_GRID
|
||||
#endif // _WX_GENERIC_GRID_PRIVATE_H_
|
818
Externals/wxWidgets3/include/wx/generic/private/listctrl.h
vendored
Normal file
818
Externals/wxWidgets3/include/wx/generic/private/listctrl.h
vendored
Normal file
@ -0,0 +1,818 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/listctrl.h
|
||||
// Purpose: private definitions of wxListCtrl helpers
|
||||
// Author: Robert Roebling
|
||||
// Vadim Zeitlin (virtual list control support)
|
||||
// Id: $Id: listctrl.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_LISTCTRL_PRIVATE_H_
|
||||
#define _WX_GENERIC_LISTCTRL_PRIVATE_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_LISTCTRL
|
||||
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/selstore.h"
|
||||
#include "wx/timer.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
// ============================================================================
|
||||
// private classes
|
||||
// ============================================================================
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxColWidthInfo (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct wxColWidthInfo
|
||||
{
|
||||
int nMaxWidth;
|
||||
bool bNeedsUpdate; // only set to true when an item whose
|
||||
// width == nMaxWidth is removed
|
||||
|
||||
wxColWidthInfo(int w = 0, bool needsUpdate = false)
|
||||
{
|
||||
nMaxWidth = w;
|
||||
bNeedsUpdate = needsUpdate;
|
||||
}
|
||||
};
|
||||
|
||||
WX_DEFINE_ARRAY_PTR(wxColWidthInfo *, ColWidthArray);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListItemData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxListItemData
|
||||
{
|
||||
public:
|
||||
wxListItemData(wxListMainWindow *owner);
|
||||
~wxListItemData();
|
||||
|
||||
void SetItem( const wxListItem &info );
|
||||
void SetImage( int image ) { m_image = image; }
|
||||
void SetData( wxUIntPtr data ) { m_data = data; }
|
||||
void SetPosition( int x, int y );
|
||||
void SetSize( int width, int height );
|
||||
|
||||
bool HasText() const { return !m_text.empty(); }
|
||||
const wxString& GetText() const { return m_text; }
|
||||
void SetText(const wxString& text) { m_text = text; }
|
||||
|
||||
// we can't use empty string for measuring the string width/height, so
|
||||
// always return something
|
||||
wxString GetTextForMeasuring() const
|
||||
{
|
||||
wxString s = GetText();
|
||||
if ( s.empty() )
|
||||
s = wxT('H');
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool IsHit( int x, int y ) const;
|
||||
|
||||
int GetX() const;
|
||||
int GetY() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
|
||||
int GetImage() const { return m_image; }
|
||||
bool HasImage() const { return GetImage() != -1; }
|
||||
|
||||
void GetItem( wxListItem &info ) const;
|
||||
|
||||
void SetAttr(wxListItemAttr *attr) { m_attr = attr; }
|
||||
wxListItemAttr *GetAttr() const { return m_attr; }
|
||||
|
||||
public:
|
||||
// the item image or -1
|
||||
int m_image;
|
||||
|
||||
// user data associated with the item
|
||||
wxUIntPtr m_data;
|
||||
|
||||
// the item coordinates are not used in report mode; instead this pointer is
|
||||
// NULL and the owner window is used to retrieve the item position and size
|
||||
wxRect *m_rect;
|
||||
|
||||
// the list ctrl we are in
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
// custom attributes or NULL
|
||||
wxListItemAttr *m_attr;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
wxString m_text;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListHeaderData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxListHeaderData : public wxObject
|
||||
{
|
||||
public:
|
||||
wxListHeaderData();
|
||||
wxListHeaderData( const wxListItem &info );
|
||||
void SetItem( const wxListItem &item );
|
||||
void SetPosition( int x, int y );
|
||||
void SetWidth( int w );
|
||||
void SetState( int state );
|
||||
void SetFormat( int format );
|
||||
void SetHeight( int h );
|
||||
bool HasImage() const;
|
||||
|
||||
bool HasText() const { return !m_text.empty(); }
|
||||
const wxString& GetText() const { return m_text; }
|
||||
void SetText(const wxString& text) { m_text = text; }
|
||||
|
||||
void GetItem( wxListItem &item );
|
||||
|
||||
bool IsHit( int x, int y ) const;
|
||||
int GetImage() const;
|
||||
int GetWidth() const;
|
||||
int GetFormat() const;
|
||||
int GetState() const;
|
||||
|
||||
protected:
|
||||
long m_mask;
|
||||
int m_image;
|
||||
wxString m_text;
|
||||
int m_format;
|
||||
int m_width;
|
||||
int m_xpos,
|
||||
m_ypos;
|
||||
int m_height;
|
||||
int m_state;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListLineData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxListItemData, wxListItemDataList);
|
||||
|
||||
class wxListLineData
|
||||
{
|
||||
public:
|
||||
// the list of subitems: only may have more than one item in report mode
|
||||
wxListItemDataList m_items;
|
||||
|
||||
// this is not used in report view
|
||||
struct GeometryInfo
|
||||
{
|
||||
// total item rect
|
||||
wxRect m_rectAll;
|
||||
|
||||
// label only
|
||||
wxRect m_rectLabel;
|
||||
|
||||
// icon only
|
||||
wxRect m_rectIcon;
|
||||
|
||||
// the part to be highlighted
|
||||
wxRect m_rectHighlight;
|
||||
|
||||
// extend all our rects to be centered inside the one of given width
|
||||
void ExtendWidth(wxCoord w)
|
||||
{
|
||||
wxASSERT_MSG( m_rectAll.width <= w,
|
||||
wxT("width can only be increased") );
|
||||
|
||||
m_rectAll.width = w;
|
||||
m_rectLabel.x = m_rectAll.x + (w - m_rectLabel.width) / 2;
|
||||
m_rectIcon.x = m_rectAll.x + (w - m_rectIcon.width) / 2;
|
||||
m_rectHighlight.x = m_rectAll.x + (w - m_rectHighlight.width) / 2;
|
||||
}
|
||||
}
|
||||
*m_gi;
|
||||
|
||||
// is this item selected? [NB: not used in virtual mode]
|
||||
bool m_highlighted;
|
||||
|
||||
// back pointer to the list ctrl
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
public:
|
||||
wxListLineData(wxListMainWindow *owner);
|
||||
|
||||
~wxListLineData()
|
||||
{
|
||||
WX_CLEAR_LIST(wxListItemDataList, m_items);
|
||||
delete m_gi;
|
||||
}
|
||||
|
||||
// called by the owner when it toggles report view
|
||||
void SetReportView(bool inReportView)
|
||||
{
|
||||
// we only need m_gi when we're not in report view so update as needed
|
||||
if ( inReportView )
|
||||
{
|
||||
delete m_gi;
|
||||
m_gi = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gi = new GeometryInfo;
|
||||
}
|
||||
}
|
||||
|
||||
// are we in report mode?
|
||||
inline bool InReportView() const;
|
||||
|
||||
// are we in virtual report mode?
|
||||
inline bool IsVirtual() const;
|
||||
|
||||
// these 2 methods shouldn't be called for report view controls, in that
|
||||
// case we determine our position/size ourselves
|
||||
|
||||
// calculate the size of the line
|
||||
void CalculateSize( wxDC *dc, int spacing );
|
||||
|
||||
// remember the position this line appears at
|
||||
void SetPosition( int x, int y, int spacing );
|
||||
|
||||
// wxListCtrl API
|
||||
|
||||
void SetImage( int image ) { SetImage(0, image); }
|
||||
int GetImage() const { return GetImage(0); }
|
||||
void SetImage( int index, int image );
|
||||
int GetImage( int index ) const;
|
||||
|
||||
bool HasImage() const { return GetImage() != -1; }
|
||||
bool HasText() const { return !GetText(0).empty(); }
|
||||
|
||||
void SetItem( int index, const wxListItem &info );
|
||||
void GetItem( int index, wxListItem &info );
|
||||
|
||||
wxString GetText(int index) const;
|
||||
void SetText( int index, const wxString& s );
|
||||
|
||||
wxListItemAttr *GetAttr() const;
|
||||
void SetAttr(wxListItemAttr *attr);
|
||||
|
||||
// return true if the highlighting really changed
|
||||
bool Highlight( bool on );
|
||||
|
||||
void ReverseHighlight();
|
||||
|
||||
bool IsHighlighted() const
|
||||
{
|
||||
wxASSERT_MSG( !IsVirtual(), wxT("unexpected call to IsHighlighted") );
|
||||
|
||||
return m_highlighted;
|
||||
}
|
||||
|
||||
// draw the line on the given DC in icon/list mode
|
||||
void Draw( wxDC *dc, bool current );
|
||||
|
||||
// the same in report mode: it needs more parameters as we don't store
|
||||
// everything in the item in report mode
|
||||
void DrawInReportMode( wxDC *dc,
|
||||
const wxRect& rect,
|
||||
const wxRect& rectHL,
|
||||
bool highlighted,
|
||||
bool current );
|
||||
|
||||
private:
|
||||
// set the line to contain num items (only can be > 1 in report mode)
|
||||
void InitItems( int num );
|
||||
|
||||
// get the mode (i.e. style) of the list control
|
||||
inline int GetMode() const;
|
||||
|
||||
// Apply this item attributes to the given DC: set the text font and colour
|
||||
// and also erase the background appropriately.
|
||||
void ApplyAttributes(wxDC *dc,
|
||||
const wxRect& rectHL,
|
||||
bool highlighted,
|
||||
bool current);
|
||||
|
||||
// draw the text on the DC with the correct justification; also add an
|
||||
// ellipsis if the text is too large to fit in the current width
|
||||
void DrawTextFormatted(wxDC *dc,
|
||||
const wxString &text,
|
||||
int col,
|
||||
int x,
|
||||
int yMid, // this is middle, not top, of the text
|
||||
int width);
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(wxListLineData, wxListLineDataArray);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListHeaderWindow (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxListHeaderWindow : public wxWindow
|
||||
{
|
||||
protected:
|
||||
wxListMainWindow *m_owner;
|
||||
const wxCursor *m_currentCursor;
|
||||
wxCursor *m_resizeCursor;
|
||||
bool m_isDragging;
|
||||
|
||||
// column being resized or -1
|
||||
int m_column;
|
||||
|
||||
// divider line position in logical (unscrolled) coords
|
||||
int m_currentX;
|
||||
|
||||
// minimal position beyond which the divider line
|
||||
// can't be dragged in logical coords
|
||||
int m_minX;
|
||||
|
||||
public:
|
||||
wxListHeaderWindow();
|
||||
|
||||
wxListHeaderWindow( wxWindow *win,
|
||||
wxWindowID id,
|
||||
wxListMainWindow *owner,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxT("wxlistctrlcolumntitles") );
|
||||
|
||||
virtual ~wxListHeaderWindow();
|
||||
|
||||
void DrawCurrent();
|
||||
void AdjustDC( wxDC& dc );
|
||||
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
|
||||
// needs refresh
|
||||
bool m_dirty;
|
||||
|
||||
// Update main window's column later
|
||||
bool m_sendSetColumnWidth;
|
||||
int m_colToSend;
|
||||
int m_widthToSend;
|
||||
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// generate and process the list event of the given type, return true if
|
||||
// it wasn't vetoed, i.e. if we should proceed
|
||||
bool SendListEvent(wxEventType type, const wxPoint& pos);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListRenameTimer (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxListRenameTimer: public wxTimer
|
||||
{
|
||||
private:
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
public:
|
||||
wxListRenameTimer( wxListMainWindow *owner );
|
||||
void Notify();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListTextCtrlWrapper: wraps a wxTextCtrl to make it work for inline editing
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxListTextCtrlWrapper : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
// NB: text must be a valid object but not Create()d yet
|
||||
wxListTextCtrlWrapper(wxListMainWindow *owner,
|
||||
wxTextCtrl *text,
|
||||
size_t itemEdit);
|
||||
|
||||
wxTextCtrl *GetText() const { return m_text; }
|
||||
|
||||
// Different reasons for calling EndEdit():
|
||||
//
|
||||
// It was called because:
|
||||
enum EndReason
|
||||
{
|
||||
End_Accept, // user has accepted the changes.
|
||||
End_Discard, // user has cancelled editing.
|
||||
End_Destroy // the entire control is being destroyed.
|
||||
};
|
||||
|
||||
void EndEdit(EndReason reason);
|
||||
|
||||
protected:
|
||||
void OnChar( wxKeyEvent &event );
|
||||
void OnKeyUp( wxKeyEvent &event );
|
||||
void OnKillFocus( wxFocusEvent &event );
|
||||
|
||||
bool AcceptChanges();
|
||||
void Finish( bool setfocus );
|
||||
|
||||
private:
|
||||
wxListMainWindow *m_owner;
|
||||
wxTextCtrl *m_text;
|
||||
wxString m_startValue;
|
||||
size_t m_itemEdited;
|
||||
bool m_aboutToFinish;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListMainWindow (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
|
||||
|
||||
class wxListMainWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxListMainWindow();
|
||||
wxListMainWindow( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxT("listctrlmainwindow") );
|
||||
|
||||
virtual ~wxListMainWindow();
|
||||
|
||||
// called by the main control when its mode changes
|
||||
void SetReportView(bool inReportView);
|
||||
|
||||
// helper to simplify testing for wxLC_XXX flags
|
||||
bool HasFlag(int flag) const { return m_parent->HasFlag(flag); }
|
||||
|
||||
// return true if this is a virtual list control
|
||||
bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
|
||||
|
||||
// return true if the control is in report mode
|
||||
bool InReportView() const { return HasFlag(wxLC_REPORT); }
|
||||
|
||||
// return true if we are in single selection mode, false if multi sel
|
||||
bool IsSingleSel() const { return HasFlag(wxLC_SINGLE_SEL); }
|
||||
|
||||
// do we have a header window?
|
||||
bool HasHeader() const
|
||||
{ return InReportView() && !HasFlag(wxLC_NO_HEADER); }
|
||||
|
||||
void HighlightAll( bool on );
|
||||
|
||||
// all these functions only do something if the line is currently visible
|
||||
|
||||
// change the line "selected" state, return true if it really changed
|
||||
bool HighlightLine( size_t line, bool highlight = true);
|
||||
|
||||
// as HighlightLine() but do it for the range of lines: this is incredibly
|
||||
// more efficient for virtual list controls!
|
||||
//
|
||||
// NB: unlike HighlightLine() this one does refresh the lines on screen
|
||||
void HighlightLines( size_t lineFrom, size_t lineTo, bool on = true );
|
||||
|
||||
// toggle the line state and refresh it
|
||||
void ReverseHighlight( size_t line )
|
||||
{ HighlightLine(line, !IsHighlighted(line)); RefreshLine(line); }
|
||||
|
||||
// return true if the line is highlighted
|
||||
bool IsHighlighted(size_t line) const;
|
||||
|
||||
// refresh one or several lines at once
|
||||
void RefreshLine( size_t line );
|
||||
void RefreshLines( size_t lineFrom, size_t lineTo );
|
||||
|
||||
// refresh all selected items
|
||||
void RefreshSelected();
|
||||
|
||||
// refresh all lines below the given one: the difference with
|
||||
// RefreshLines() is that the index here might not be a valid one (happens
|
||||
// when the last line is deleted)
|
||||
void RefreshAfter( size_t lineFrom );
|
||||
|
||||
// the methods which are forwarded to wxListLineData itself in list/icon
|
||||
// modes but are here because the lines don't store their positions in the
|
||||
// report mode
|
||||
|
||||
// get the bound rect for the entire line
|
||||
wxRect GetLineRect(size_t line) const;
|
||||
|
||||
// get the bound rect of the label
|
||||
wxRect GetLineLabelRect(size_t line) const;
|
||||
|
||||
// get the bound rect of the items icon (only may be called if we do have
|
||||
// an icon!)
|
||||
wxRect GetLineIconRect(size_t line) const;
|
||||
|
||||
// get the rect to be highlighted when the item has focus
|
||||
wxRect GetLineHighlightRect(size_t line) const;
|
||||
|
||||
// get the size of the total line rect
|
||||
wxSize GetLineSize(size_t line) const
|
||||
{ return GetLineRect(line).GetSize(); }
|
||||
|
||||
// return the hit code for the corresponding position (in this line)
|
||||
long HitTestLine(size_t line, int x, int y) const;
|
||||
|
||||
// bring the selected item into view, scrolling to it if necessary
|
||||
void MoveToItem(size_t item);
|
||||
|
||||
bool ScrollList( int WXUNUSED(dx), int dy );
|
||||
|
||||
// bring the current item into view
|
||||
void MoveToFocus() { MoveToItem(m_current); }
|
||||
|
||||
// start editing the label of the given item
|
||||
wxTextCtrl *EditLabel(long item,
|
||||
wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
|
||||
wxTextCtrl *GetEditControl() const
|
||||
{
|
||||
return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL;
|
||||
}
|
||||
|
||||
void ResetTextControl(wxTextCtrl *text)
|
||||
{
|
||||
delete text;
|
||||
m_textctrlWrapper = NULL;
|
||||
}
|
||||
|
||||
void OnRenameTimer();
|
||||
bool OnRenameAccept(size_t itemEdit, const wxString& value);
|
||||
void OnRenameCancelled(size_t itemEdit);
|
||||
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
|
||||
// called to switch the selection from the current item to newCurrent,
|
||||
void OnArrowChar( size_t newCurrent, const wxKeyEvent& event );
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
void OnKeyUp( wxKeyEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
void OnKillFocus( wxFocusEvent &event );
|
||||
void OnScroll( wxScrollWinEvent& event );
|
||||
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
|
||||
void OnChildFocus(wxChildFocusEvent& event);
|
||||
|
||||
void DrawImage( int index, wxDC *dc, int x, int y );
|
||||
void GetImageSize( int index, int &width, int &height ) const;
|
||||
int GetTextLength( const wxString &s ) const;
|
||||
|
||||
void SetImageList( wxImageList *imageList, int which );
|
||||
void SetItemSpacing( int spacing, bool isSmall = false );
|
||||
int GetItemSpacing( bool isSmall = false );
|
||||
|
||||
void SetColumn( int col, wxListItem &item );
|
||||
void SetColumnWidth( int col, int width );
|
||||
void GetColumn( int col, wxListItem &item ) const;
|
||||
int GetColumnWidth( int col ) const;
|
||||
int GetColumnCount() const { return m_columns.GetCount(); }
|
||||
|
||||
// returns the sum of the heights of all columns
|
||||
int GetHeaderWidth() const;
|
||||
|
||||
int GetCountPerPage() const;
|
||||
|
||||
void SetItem( wxListItem &item );
|
||||
void GetItem( wxListItem &item ) const;
|
||||
void SetItemState( long item, long state, long stateMask );
|
||||
void SetItemStateAll( long state, long stateMask );
|
||||
int GetItemState( long item, long stateMask ) const;
|
||||
bool GetItemRect( long item, wxRect &rect ) const
|
||||
{
|
||||
return GetSubItemRect(item, wxLIST_GETSUBITEMRECT_WHOLEITEM, rect);
|
||||
}
|
||||
bool GetSubItemRect( long item, long subItem, wxRect& rect ) const;
|
||||
wxRect GetViewRect() const;
|
||||
bool GetItemPosition( long item, wxPoint& pos ) const;
|
||||
int GetSelectedItemCount() const;
|
||||
|
||||
wxString GetItemText(long item, int col = 0) const
|
||||
{
|
||||
wxListItem info;
|
||||
info.m_mask = wxLIST_MASK_TEXT;
|
||||
info.m_itemId = item;
|
||||
info.m_col = col;
|
||||
GetItem( info );
|
||||
return info.m_text;
|
||||
}
|
||||
|
||||
void SetItemText(long item, const wxString& value)
|
||||
{
|
||||
wxListItem info;
|
||||
info.m_mask = wxLIST_MASK_TEXT;
|
||||
info.m_itemId = item;
|
||||
info.m_text = value;
|
||||
SetItem( info );
|
||||
}
|
||||
|
||||
wxImageList* GetSmallImageList() const
|
||||
{ return m_small_image_list; }
|
||||
|
||||
// set the scrollbars and update the positions of the items
|
||||
void RecalculatePositions(bool noRefresh = false);
|
||||
|
||||
// refresh the window and the header
|
||||
void RefreshAll();
|
||||
|
||||
long GetNextItem( long item, int geometry, int state ) const;
|
||||
void DeleteItem( long index );
|
||||
void DeleteAllItems();
|
||||
void DeleteColumn( int col );
|
||||
void DeleteEverything();
|
||||
void EnsureVisible( long index );
|
||||
long FindItem( long start, const wxString& str, bool partial = false );
|
||||
long FindItem( long start, wxUIntPtr data);
|
||||
long FindItem( const wxPoint& pt );
|
||||
long HitTest( int x, int y, int &flags ) const;
|
||||
void InsertItem( wxListItem &item );
|
||||
void InsertColumn( long col, wxListItem &item );
|
||||
int GetItemWidthWithImage(wxListItem * item);
|
||||
void SortItems( wxListCtrlCompare fn, wxIntPtr data );
|
||||
|
||||
size_t GetItemCount() const;
|
||||
bool IsEmpty() const { return GetItemCount() == 0; }
|
||||
void SetItemCount(long count);
|
||||
|
||||
// change the current (== focused) item, send a notification event
|
||||
void ChangeCurrent(size_t current);
|
||||
void ResetCurrent() { ChangeCurrent((size_t)-1); }
|
||||
bool HasCurrent() const { return m_current != (size_t)-1; }
|
||||
|
||||
// send out a wxListEvent
|
||||
void SendNotify( size_t line,
|
||||
wxEventType command,
|
||||
const wxPoint& point = wxDefaultPosition );
|
||||
|
||||
// override base class virtual to reset m_lineHeight when the font changes
|
||||
virtual bool SetFont(const wxFont& font)
|
||||
{
|
||||
if ( !wxWindow::SetFont(font) )
|
||||
return false;
|
||||
|
||||
m_lineHeight = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// these are for wxListLineData usage only
|
||||
|
||||
// get the backpointer to the list ctrl
|
||||
wxGenericListCtrl *GetListCtrl() const
|
||||
{
|
||||
return wxStaticCast(GetParent(), wxGenericListCtrl);
|
||||
}
|
||||
|
||||
// get the height of all lines (assuming they all do have the same height)
|
||||
wxCoord GetLineHeight() const;
|
||||
|
||||
// get the y position of the given line (only for report view)
|
||||
wxCoord GetLineY(size_t line) const;
|
||||
|
||||
// get the brush to use for the item highlighting
|
||||
wxBrush *GetHighlightBrush() const
|
||||
{
|
||||
return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush;
|
||||
}
|
||||
|
||||
bool HasFocus() const
|
||||
{
|
||||
return m_hasFocus;
|
||||
}
|
||||
|
||||
protected:
|
||||
// the array of all line objects for a non virtual list control (for the
|
||||
// virtual list control we only ever use m_lines[0])
|
||||
wxListLineDataArray m_lines;
|
||||
|
||||
// the list of column objects
|
||||
wxListHeaderDataList m_columns;
|
||||
|
||||
// currently focused item or -1
|
||||
size_t m_current;
|
||||
|
||||
// the number of lines per page
|
||||
int m_linesPerPage;
|
||||
|
||||
// this flag is set when something which should result in the window
|
||||
// redrawing happens (i.e. an item was added or deleted, or its appearance
|
||||
// changed) and OnPaint() doesn't redraw the window while it is set which
|
||||
// allows to minimize the number of repaintings when a lot of items are
|
||||
// being added. The real repainting occurs only after the next OnIdle()
|
||||
// call
|
||||
bool m_dirty;
|
||||
|
||||
wxColour *m_highlightColour;
|
||||
wxImageList *m_small_image_list;
|
||||
wxImageList *m_normal_image_list;
|
||||
int m_small_spacing;
|
||||
int m_normal_spacing;
|
||||
bool m_hasFocus;
|
||||
|
||||
bool m_lastOnSame;
|
||||
wxTimer *m_renameTimer;
|
||||
bool m_isCreated;
|
||||
int m_dragCount;
|
||||
wxPoint m_dragStart;
|
||||
ColWidthArray m_aColWidths;
|
||||
|
||||
// for double click logic
|
||||
size_t m_lineLastClicked,
|
||||
m_lineBeforeLastClicked,
|
||||
m_lineSelectSingleOnUp;
|
||||
|
||||
protected:
|
||||
wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); }
|
||||
|
||||
// the total count of items in a virtual list control
|
||||
size_t m_countVirt;
|
||||
|
||||
// the object maintaining the items selection state, only used in virtual
|
||||
// controls
|
||||
wxSelectionStore m_selStore;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// get the line data for the given index
|
||||
wxListLineData *GetLine(size_t n) const
|
||||
{
|
||||
wxASSERT_MSG( n != (size_t)-1, wxT("invalid line index") );
|
||||
|
||||
if ( IsVirtual() )
|
||||
{
|
||||
wxConstCast(this, wxListMainWindow)->CacheLineData(n);
|
||||
n = 0;
|
||||
}
|
||||
|
||||
return &m_lines[n];
|
||||
}
|
||||
|
||||
// get a dummy line which can be used for geometry calculations and such:
|
||||
// you must use GetLine() if you want to really draw the line
|
||||
wxListLineData *GetDummyLine() const;
|
||||
|
||||
// cache the line data of the n-th line in m_lines[0]
|
||||
void CacheLineData(size_t line);
|
||||
|
||||
// get the range of visible lines
|
||||
void GetVisibleLinesRange(size_t *from, size_t *to);
|
||||
|
||||
// force us to recalculate the range of visible lines
|
||||
void ResetVisibleLinesRange() { m_lineFrom = (size_t)-1; }
|
||||
|
||||
// get the colour to be used for drawing the rules
|
||||
wxColour GetRuleColour() const
|
||||
{
|
||||
return wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT);
|
||||
}
|
||||
|
||||
private:
|
||||
// initialize the current item if needed
|
||||
void UpdateCurrent();
|
||||
|
||||
// delete all items but don't refresh: called from dtor
|
||||
void DoDeleteAllItems();
|
||||
|
||||
// the height of one line using the current font
|
||||
wxCoord m_lineHeight;
|
||||
|
||||
// the total header width or 0 if not calculated yet
|
||||
wxCoord m_headerWidth;
|
||||
|
||||
// the first and last lines being shown on screen right now (inclusive),
|
||||
// both may be -1 if they must be calculated so never access them directly:
|
||||
// use GetVisibleLinesRange() above instead
|
||||
size_t m_lineFrom,
|
||||
m_lineTo;
|
||||
|
||||
// the brushes to use for item highlighting when we do/don't have focus
|
||||
wxBrush *m_highlightBrush,
|
||||
*m_highlightUnfocusedBrush;
|
||||
|
||||
// wrapper around the text control currently used for in place editing or
|
||||
// NULL if no item is being edited
|
||||
wxListTextCtrlWrapper *m_textctrlWrapper;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
friend class wxGenericListCtrl;
|
||||
};
|
||||
|
||||
#endif // wxUSE_LISTCTRL
|
||||
#endif // _WX_GENERIC_LISTCTRL_PRIVATE_H_
|
78
Externals/wxWidgets3/include/wx/generic/private/markuptext.h
vendored
Normal file
78
Externals/wxWidgets3/include/wx/generic/private/markuptext.h
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/private/markuptext.h
|
||||
// Purpose: Generic wxMarkupText class for managing text with markup.
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2011-02-21
|
||||
// RCS-ID: $Id: markuptext.h 67064 2011-02-27 12:48:21Z VZ $
|
||||
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_PRIVATE_MARKUPTEXT_H_
|
||||
#define _WX_GENERIC_PRIVATE_MARKUPTEXT_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDC;
|
||||
class WXDLLIMPEXP_FWD_CORE wxRect;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMarkupText: allows to measure and draw the text containing markup.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMarkupText
|
||||
{
|
||||
public:
|
||||
// Constants for Render() flags.
|
||||
enum
|
||||
{
|
||||
Render_Default = 0, // Don't show mnemonics visually.
|
||||
Render_ShowAccels = 1 // Underline mnemonics.
|
||||
};
|
||||
|
||||
|
||||
// Initialize with the given string containing markup (which is supposed to
|
||||
// be valid, the caller must check for it before constructing this object).
|
||||
//
|
||||
// Notice that the usual rules for mnemonics apply to the markup text: if
|
||||
// it contains any '&' characters they must be escaped by doubling them,
|
||||
// otherwise they indicate that the next character is the mnemonic for this
|
||||
// field.
|
||||
//
|
||||
// TODO-MULTILINE-MARKUP: Currently only single line labels are supported,
|
||||
// search for other occurrences of this comment to find the places which
|
||||
// need to be updated to support multiline labels with markup.
|
||||
wxMarkupText(const wxString& markup)
|
||||
: m_markup(markup)
|
||||
{
|
||||
}
|
||||
|
||||
// Default copy ctor, assignment operator and dtor are ok.
|
||||
|
||||
// Update the markup string.
|
||||
//
|
||||
// The same rules for mnemonics as in the ctor apply to this string.
|
||||
void SetMarkup(const wxString& markup) { m_markup = markup; }
|
||||
|
||||
|
||||
// Return the width and height required by the given string and optionally
|
||||
// the height of the visible part above the baseline (i.e. ascent minus
|
||||
// internal leading).
|
||||
//
|
||||
// The font currently selected into the DC is used for measuring (notice
|
||||
// that it is changed by this function but normally -- i.e. if markup is
|
||||
// valid -- restored to its original value when it returns).
|
||||
wxSize Measure(wxDC& dc, int *visibleHeight = NULL) const;
|
||||
|
||||
// Render the markup string into the given DC in the specified rectangle.
|
||||
//
|
||||
// Notice that while the function uses the provided rectangle for alignment
|
||||
// (it centers the text in it), no clipping is done by it so use Measure()
|
||||
// and set the clipping region before rendering if necessary.
|
||||
void Render(wxDC& dc, const wxRect& rect, int flags);
|
||||
|
||||
private:
|
||||
wxString m_markup;
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_PRIVATE_MARKUPTEXT_H_
|
46
Externals/wxWidgets3/include/wx/generic/private/timer.h
vendored
Normal file
46
Externals/wxWidgets3/include/wx/generic/private/timer.h
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/private/timer.h
|
||||
// Purpose: Generic implementation of wxTimer class
|
||||
// Author: Vaclav Slavik
|
||||
// Id: $Id: timer.h 50646 2007-12-12 01:35:53Z VZ $
|
||||
// Copyright: (c) Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_PRIVATE_TIMER_H_
|
||||
#define _WX_GENERIC_PRIVATE_TIMER_H_
|
||||
|
||||
#if wxUSE_TIMER
|
||||
|
||||
#include "wx/private/timer.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTimer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxTimerDesc;
|
||||
|
||||
class WXDLLIMPEXP_BASE wxGenericTimerImpl : public wxTimerImpl
|
||||
{
|
||||
public:
|
||||
wxGenericTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { Init(); }
|
||||
virtual ~wxGenericTimerImpl();
|
||||
|
||||
virtual bool Start(int millisecs = -1, bool oneShot = false);
|
||||
virtual void Stop();
|
||||
|
||||
virtual bool IsRunning() const;
|
||||
|
||||
// implementation
|
||||
static void NotifyTimers();
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
wxTimerDesc *m_desc;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TIMER
|
||||
|
||||
#endif // _WX_GENERIC_PRIVATE_TIMER_H_
|
Reference in New Issue
Block a user