// should be used instead for them
// corresponds to wxCAL_NO_YEAR_CHANGE bit
- void EnableYearChange(bool enable = TRUE);
+ void EnableYearChange(bool enable = true);
// corresponds to wxCAL_NO_MONTH_CHANGE bit
- void EnableMonthChange(bool enable = TRUE);
+ void EnableMonthChange(bool enable = true);
// corresponds to wxCAL_SHOW_HOLIDAYS bit
- void EnableHolidayDisplay(bool display = TRUE);
+ void EnableHolidayDisplay(bool display = true);
// customization
// -------------
// -------------------------------
// forward these functions to all subcontrols
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
private:
// common part of all ctors
// Set the flag for SetDate(): otherwise it would overwrite the year
// typed in by the user
- void SetUserChangedYear() { m_userChangedYear = TRUE; }
+ void SetUserChangedYear() { m_userChangedYear = true; }
// the subcontrols
wxStaticText *m_staticMonth;
// the week day names
wxString m_weekdays[7];
- // TRUE if SetDate() is being called as the result of changing the year in
+ // true if SetDate() is being called as the result of changing the year in
// the year control
bool m_userChangedYear;
// draw the caret on the given DC
void DoDraw(wxDC *dc);
-
+
private:
// GTK specific initialization
void InitGeneric();
m_yOld;
wxCaretTimer m_timer;
- bool m_blinkedOut, // TRUE => caret hidden right now
- m_hasFocus; // TRUE => our window has focus
+ bool m_blinkedOut, // true => caret hidden right now
+ m_hasFocus; // true => our window has focus
};
#endif // _WX_CARET_H_
const wxString& caption,
const wxArrayString& choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxString& caption,
int n, const wxString *choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxString& caption,
const wxArrayString& choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxString& caption,
int n, const wxString *choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxArrayString& choices,
void **client_data,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1, int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
int n, const wxString *choices,
void **client_data,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1, int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxString& caption,
int n, const wxString *choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
const wxString& caption,
const wxArrayString& choices,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE,
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true,
int width = wxCHOICE_WIDTH,
int height = wxCHOICE_HEIGHT);
// Recommended constructor
wxPostScriptDC(const wxPrintData& printData);
-
+
// Recommended destructor :-)
~wxPostScriptDC();
#if WXWIN_COMPATIBILITY_2_2
- wxPostScriptDC( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL )
+ wxPostScriptDC( const wxString &output, bool interactive = false, wxWindow *parent = NULL )
{ Create( output, interactive, parent ); }
- bool Create ( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL );
+ bool Create ( const wxString &output, bool interactive = false, wxWindow *parent = NULL );
#endif
virtual bool Ok() const;
void DoDrawSpline(wxList *points);
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE,
- wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
- bool CanDrawBitmap() const { return TRUE; }
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
+ wxCoord xsrcMask = wxDefaultPosition.x, wxCoord ysrcMask = wxDefaultPosition.y);
+ bool CanDrawBitmap() const { return true; }
void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
- void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
+ void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
wxCoord GetCharHeight() const;
wxCoord GetCharWidth() const;
- bool CanGetTextExtent() const { return TRUE; }
+ bool CanGetTextExtent() const { return true; }
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
wxCoord *descent = (wxCoord *) NULL,
wxCoord *externalLeading = (wxCoord *) NULL,
void SetPrintData(const wxPrintData& data) { m_printData = data; }
virtual int GetDepth() const { return 24; }
-
+
static void SetResolution(int ppi);
static int GetResolution();
void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
#endif
-private:
+private:
static float ms_PSScaleFactor;
protected:
double m_underlinePosition;
double m_underlineThickness;
wxPrintData m_printData;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
};
PS_FILE = wxPRINT_MODE_FILE,
PS_PRINTER = wxPRINT_MODE_PRINTER
};
-
+
class wxPrintSetupData: public wxPrintData
{
public:
wxPrintSetupData() {}
-
- void SetPrinterOrientation( int orient )
+
+ void SetPrinterOrientation( int orient )
{ SetOrientation( orient ); }
- void SetPrinterMode( wxPrintMode mode )
+ void SetPrinterMode( wxPrintMode mode )
{ SetPrintMode( mode ); }
- void SetAFMPath( const wxString &path )
+ void SetAFMPath( const wxString &path )
{ SetFontMetricPath( path ); }
-
+
void SetPaperName(const wxString& paper) { m_paperName = paper; }
void SetPrinterFile(const wxString& file) { m_printerFile = file; }
wxString GetPaperName() const { return m_paperName; }
wxString GetPrinterFile() const { return m_printerFile; };
-
+
wxString m_paperName;
wxString m_printerFile;
};
WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
-WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
+WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = true);
#endif
{
public:
wxGenericDirCtrl();
- wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = -1,
+ wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY,
const wxString &dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
Init();
Create(parent, id, dir, pos, size, style, filter, defaultFilter, name);
}
-
- bool Create(wxWindow *parent, const wxWindowID id = -1,
+
+ bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY,
const wxString &dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// Get dir or filename
virtual wxString GetPath() const;
-
+
// Get selected filename path only (else empty string).
// I.e. don't count a directory as a selection
virtual wxString GetFilePath() const;
virtual void SetPath(const wxString& path);
-
+
virtual void ShowHidden( bool show );
virtual bool GetShowHidden() { return m_showHidden; }
// Helper
virtual void SetupSections();
-
+
#if WXWIN_COMPATIBILITY_2_4
// Parse the filter into an array of filters and an array of descriptions
virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions);
#endif // WXWIN_COMPATIBILITY_2_4
-
+
// Find the child that matches the first part of 'path'.
// E.g. if a child path is "/usr" and 'path' is "/usr/include"
// then the child for /usr is returned.
- // If the path string has been used (we're at the leaf), done is set to TRUE
+ // If the path string has been used (we're at the leaf), done is set to true
virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done);
-
+
// Resize the components of the control
virtual void DoResize();
-
+
// Collapse & expand the tree, thus re-creating it from scratch:
virtual void ReCreateTree();
-
+
protected:
virtual void ExpandDir(wxTreeItemId parentId);
virtual void CollapseDir(wxTreeItemId parentId);
{
public:
wxDirFilterListCtrl() { Init(); }
- wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = -1,
+ wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0)
Init();
Create(parent, id, pos, size, style);
}
-
- bool Create(wxGenericDirCtrl* parent, const wxWindowID id = -1,
+
+ bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image.
- bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = FALSE, wxRect* rect = (wxRect*) NULL);
+ bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = (wxRect*) NULL);
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image. This is full screen only. fullScreenRect gives the
wxFileDialog(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
- const wxString& defaultDir = _T(""),
- const wxString& defaultFile = _T(""),
+ const wxString& defaultDir = wxEmptyString,
+ const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = 0,
const wxPoint& pos = wxDefaultPosition)
virtual void ChangeToListMode();
virtual void ChangeToReportMode();
virtual void ChangeToSmallIconMode();
- virtual void ShowHidden( bool show = TRUE );
+ virtual void ShowHidden( bool show = true );
bool GetShowHidden() const { return m_showHidden; }
virtual long Add( wxFileData *fd, wxListItem &item );
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GENERIC_FONTDLGG_H
/*
* FONT DIALOG
*/
-
+
class WXDLLEXPORT wxChoice;
class WXDLLEXPORT wxText;
class WXDLLEXPORT wxCheckBox;
// Reset the value in the control back to its starting value
virtual void Reset() = 0;
- // return TRUE to allow the given key to start editing: the base class
+ // return true to allow the given key to start editing: the base class
// version only checks that the event has no modifiers. The derived
// classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in
// their IsAcceptedKey() implementation, although, of course, it is not a
// if we change the colours/font of the control from the default ones, we
// must restore the default later and we save them here between calls to
- // Show(TRUE) and Show(FALSE)
+ // Show(true) and Show(false)
wxColour m_colFgOld,
m_colBgOld;
wxFont m_fontOld;
// if !allowOthers, user can't type a string not in choices array
wxGridCellChoiceEditor(size_t count = 0,
const wxString choices[] = NULL,
- bool allowOthers = FALSE);
+ bool allowOthers = false);
wxGridCellChoiceEditor(const wxArrayString& choices,
- bool allowOthers = FALSE);
+ bool allowOthers = false);
virtual void Create(wxWindow* parent,
wxWindowID id,
m_vAlign = vAlign;
}
void SetSize(int num_rows, int num_cols);
- void SetOverflow(bool allow = TRUE)
+ void SetOverflow(bool allow = true)
{ m_overflow = allow ? Overflow : SingleCell; }
- void SetReadOnly(bool isReadOnly = TRUE)
+ void SetReadOnly(bool isReadOnly = true)
{ m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; }
// takes ownership of the pointer
void DoEndDragResizeCol();
wxGridTableBase * GetTable() const { return m_table; }
- bool SetTable( wxGridTableBase *table, bool takeOwnership=FALSE,
+ bool SetTable( wxGridTableBase *table, bool takeOwnership = false,
wxGrid::wxGridSelectionModes selmode =
wxGrid::wxGridSelectCells );
void ClearGrid();
- bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE );
- bool AppendRows( int numRows = 1, bool updateLabels=TRUE );
- bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels=TRUE );
- bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE );
- bool AppendCols( int numCols = 1, bool updateLabels=TRUE );
- bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE );
+ bool InsertRows( int pos = 0, int numRows = 1, bool updateLabels = true );
+ bool AppendRows( int numRows = 1, bool updateLabels = true );
+ bool DeleteRows( int pos = 0, int numRows = 1, bool updateLabels = true );
+ bool InsertCols( int pos = 0, int numCols = 1, bool updateLabels = true );
+ bool AppendCols( int numCols = 1, bool updateLabels = true );
+ bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels = true );
void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells );
void DrawGridSpace( wxDC& dc );
int GetBatchCount() { return m_batchCount; }
- virtual void Refresh(bool eraseb = TRUE,
+ virtual void Refresh(bool eraseb = true,
const wxRect* rect = (const wxRect *) NULL);
// Use this, rather than wxWindow::Refresh(), to force an
bool IsEditable() const { return m_editable; }
void EnableEditing( bool edit );
- void EnableCellEditControl( bool enable = TRUE );
- void DisableCellEditControl() { EnableCellEditControl(FALSE); }
+ void EnableCellEditControl( bool enable = true );
+ void DisableCellEditControl() { EnableCellEditControl(false); }
bool CanEnableCellControl() const;
bool IsCellEditControlEnabled() const;
bool IsCellEditControlShown() const;
// check to see if a cell is either wholly visible (the default arg) or
// at least partially visible in the grid window
//
- bool IsVisible( int row, int col, bool wholeCellVisible = TRUE );
- bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = TRUE )
+ bool IsVisible( int row, int col, bool wholeCellVisible = true );
+ bool IsVisible( const wxGridCellCoords& coords, bool wholeCellVisible = true )
{ return IsVisible( coords.GetRow(), coords.GetCol(), wholeCellVisible ); }
void MakeCellVisible( int row, int col );
void MakeCellVisible( const wxGridCellCoords& coords )
void SetCellHighlightPenWidth(int width);
void SetCellHighlightROPenWidth(int width);
- void EnableDragRowSize( bool enable = TRUE );
- void DisableDragRowSize() { EnableDragRowSize( FALSE ); }
+ void EnableDragRowSize( bool enable = true );
+ void DisableDragRowSize() { EnableDragRowSize( false ); }
bool CanDragRowSize() { return m_canDragRowSize; }
- void EnableDragColSize( bool enable = TRUE );
- void DisableDragColSize() { EnableDragColSize( FALSE ); }
+ void EnableDragColSize( bool enable = true );
+ void DisableDragColSize() { EnableDragColSize( false ); }
bool CanDragColSize() { return m_canDragColSize; }
- void EnableDragGridSize(bool enable = TRUE);
- void DisableDragGridSize() { EnableDragGridSize(FALSE); }
+ void EnableDragGridSize(bool enable = true);
+ void DisableDragGridSize() { EnableDragGridSize(false); }
bool CanDragGridSize() { return m_canDragGridSize; }
// this sets the specified attribute for this cell or in this row/col
void SetColFormatFloat(int col, int width = -1, int precision = -1);
void SetColFormatCustom(int col, const wxString& typeName);
- void EnableGridLines( bool enable = TRUE );
+ void EnableGridLines( bool enable = true );
bool GridLinesEnabled() { return m_gridLinesEnabled; }
// ------ row and col formatting
bool GetCellOverflow( int row, int col );
void GetCellSize( int row, int col, int *num_rows, int *num_cols );
- void SetDefaultRowSize( int height, bool resizeExistingRows = FALSE );
+ void SetDefaultRowSize( int height, bool resizeExistingRows = false );
void SetRowSize( int row, int height );
- void SetDefaultColSize( int width, bool resizeExistingCols = FALSE );
+ void SetDefaultColSize( int width, bool resizeExistingCols = false );
void SetColSize( int col, int width );
// automatically size the column or row to fit to its contents, if
- // setAsMin is TRUE, this optimal width will also be set as minimal width
+ // setAsMin is true, this optimal width will also be set as minimal width
// for this column
- void AutoSizeColumn( int col, bool setAsMin = TRUE )
- { AutoSizeColOrRow(col, setAsMin, TRUE); }
- void AutoSizeRow( int row, bool setAsMin = TRUE )
- { AutoSizeColOrRow(row, setAsMin, FALSE); }
+ void AutoSizeColumn( int col, bool setAsMin = true )
+ { AutoSizeColOrRow(col, setAsMin, true); }
+ void AutoSizeRow( int row, bool setAsMin = true )
+ { AutoSizeColOrRow(row, setAsMin, false); }
// auto size all columns (very ineffective for big grids!)
- void AutoSizeColumns( bool setAsMin = TRUE )
- { (void)SetOrCalcColumnSizes(FALSE, setAsMin); }
+ void AutoSizeColumns( bool setAsMin = true )
+ { (void)SetOrCalcColumnSizes(false, setAsMin); }
- void AutoSizeRows( bool setAsMin = TRUE )
- { (void)SetOrCalcRowSizes(FALSE, setAsMin); }
+ void AutoSizeRows( bool setAsMin = true )
+ { (void)SetOrCalcRowSizes(false, setAsMin); }
// auto size the grid, that is make the columns/rows of the "right" size
// and also set the grid size to just fit its contents
void SetCellValue( const wxGridCellCoords& coords, const wxString& s )
{ SetCellValue( coords.GetRow(), coords.GetCol(), s ); }
- // returns TRUE if the cell can't be edited
+ // returns true if the cell can't be edited
bool IsReadOnly(int row, int col) const;
// make the cell editable/readonly
- void SetReadOnly(int row, int col, bool isReadOnly = TRUE);
+ void SetReadOnly(int row, int col, bool isReadOnly = true);
// ------ select blocks of cells
//
- void SelectRow( int row, bool addToSelected = FALSE );
- void SelectCol( int col, bool addToSelected = FALSE );
+ void SelectRow( int row, bool addToSelected = false );
+ void SelectCol( int col, bool addToSelected = false );
void SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol,
- bool addToSelected = FALSE );
+ bool addToSelected = false );
void SelectBlock( const wxGridCellCoords& topLeft,
const wxGridCellCoords& bottomRight,
- bool addToSelected = FALSE )
+ bool addToSelected = false )
{ SelectBlock( topLeft.GetRow(), topLeft.GetCol(),
bottomRight.GetRow(), bottomRight.GetCol(),
addToSelected ); }
//
wxGrid( wxWindow *parent,
- int x, int y, int w = -1, int h = -1,
+ int x, int y, int w = wxDefaultSize.x, int h = wxDefaultSize.y,
long style = wxWANTS_CHARS,
const wxString& name = wxPanelNameStr )
- : wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h),
+ : wxScrolledWindow( parent, wxID_ANY, wxPoint(x,y), wxSize(w,h),
(style|wxWANTS_CHARS), name )
{
Create();
{ SetCellBackgroundColour( row, col, colour ); }
bool GetEditable() { return IsEditable(); }
- void SetEditable( bool edit = TRUE ) { EnableEditing( edit ); }
+ void SetEditable( bool edit = true ) { EnableEditing( edit ); }
bool GetEditInPlace() { return IsCellEditControlEnabled(); }
- void SetEditInPlace(bool WXUNUSED(edit) = TRUE) { }
+ void SetEditInPlace(bool WXUNUSED(edit) = true) { }
void SetCellAlignment( int align, int row, int col)
{ SetCellAlignment(row, col, align, wxALIGN_CENTER); }
// common part of AutoSizeColumn/Row() and GetBestSize()
- int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE);
- int SetOrCalcRowSizes(bool calcOnly, bool setAsMin = TRUE);
+ int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true);
+ int SetOrCalcRowSizes(bool calcOnly, bool setAsMin = true);
// common part of AutoSizeColumn/Row()
void AutoSizeColOrRow(int n, bool setAsMin, bool column /* or row? */);
// adds an attribute to cache
void CacheAttr(int row, int col, wxGridCellAttr *attr) const;
- // looks for an attr in cache, returns TRUE if found
+ // looks for an attr in cache, returns true if found
bool LookupAttr(int row, int col, wxGridCellAttr **attr) const;
// looks for the attr in cache, if not found asks the table and caches the
};
// this method not only sets m_cursorMode but also sets the correct cursor
- // for the given mode and, if captureMouse is not FALSE releases the mouse
+ // for the given mode and, if captureMouse is not false releases the mouse
// if it was captured and captures it if it must be captured
//
// for this to work, you should always use it and not set m_cursorMode
// directly!
void ChangeCursorMode(CursorMode mode,
wxWindow *win = (wxWindow *)NULL,
- bool captureMouse = TRUE);
+ bool captureMouse = true);
wxWindow *m_winCapture; // the window which captured the mouse
CursorMode m_cursorMode;
}
wxGridEvent(int id, wxEventType type, wxObject* obj,
- int row=-1, int col=-1, int x=-1, int y=-1, bool sel = TRUE,
- bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE);
+ int row=-1, int col=-1, int x=-1, int y=-1, bool sel = true,
+ bool control = false, bool shift = false, bool alt = false, bool meta = false);
virtual int GetRow() { return m_row; }
virtual int GetCol() { return m_col; }
wxGridSizeEvent(int id, wxEventType type, wxObject* obj,
int rowOrCol=-1, int x=-1, int y=-1,
- bool control=FALSE, bool shift=FALSE, bool alt=FALSE, bool meta=FALSE);
+ bool control = false, bool shift = false, bool alt = false, bool meta = false);
int GetRowOrCol() { return m_rowOrCol; }
wxPoint GetPosition() { return wxPoint( m_x, m_y ); }
{
m_topLeft = wxGridNoCellCoords;
m_bottomRight = wxGridNoCellCoords;
- m_selecting = FALSE;
- m_control = FALSE;
- m_meta = FALSE;
- m_shift = FALSE;
- m_alt = FALSE;
+ m_selecting = false;
+ m_control = false;
+ m_meta = false;
+ m_shift = false;
+ m_alt = false;
}
wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj,
const wxGridCellCoords& topLeft,
const wxGridCellCoords& bottomRight,
- bool sel = TRUE,
- bool control=FALSE, bool shift=FALSE,
- bool alt=FALSE, bool meta=FALSE);
+ bool sel = true,
+ bool control = false, bool shift = false,
+ bool alt = false, bool meta = false);
wxGridCellCoords GetTopLeftCoords() { return m_topLeft; }
wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; }
typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&);
typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&);
-#define EVT_GRID_CELL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CELL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CELL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CELL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_LABEL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_LABEL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_LABEL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_ROW_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
-#define EVT_GRID_COL_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
-#define EVT_GRID_RANGE_SELECT(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridRangeSelectEventFunction, &fn ), NULL ),
-#define EVT_GRID_CELL_CHANGE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_SELECT_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_EDITOR_SHOWN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_EDITOR_HIDDEN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_EDITOR_CREATED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
+#define EVT_GRID_CELL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CELL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CELL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CELL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_LABEL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_LABEL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_LABEL_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_LABEL_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_ROW_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_COL_SIZE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_RANGE_SELECT(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridRangeSelectEventFunction, &fn ), NULL ),
+#define EVT_GRID_CELL_CHANGE(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_SELECT_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_EDITOR_SHOWN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_EDITOR_HIDDEN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_EDITOR_CREATED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
// The same as above but with the ability to specify an identifier
-#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_ROW_SIZE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_COL_SIZE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_RANGE_SELECT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridRangeSelectEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_CELL_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_SELECT_CELL(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_RIGHT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_LEFT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_LEFT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_LEFT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_LABEL_RIGHT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_ROW_SIZE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_ROW_SIZE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_COL_SIZE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_COL_SIZE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridSizeEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_RANGE_SELECT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_RANGE_SELECT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridRangeSelectEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_CELL_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_CHANGE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_SELECT_CELL(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_SHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_HIDDEN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CMD_EDITOR_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEditorCreatedEventFunction, &fn ), NULL ),
#if 0 // TODO: implement these ? others ?
extern const int wxEVT_GRID_CHANGE_LABELS;
extern const int wxEVT_GRID_CHANGE_SEL_LABEL;
-#define EVT_GRID_CREATE_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CHANGE_LABELS(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
-#define EVT_GRID_CHANGE_SEL_LABEL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CREATE_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CHANGE_LABELS(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
+#define EVT_GRID_CHANGE_SEL_LABEL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ),
#endif
void SetSelectionMode(wxGrid::wxGridSelectionModes selmode);
wxGrid::wxGridSelectionModes GetSelectionMode() { return m_selectionMode; }
void SelectRow( int row,
- bool ControlDown = FALSE, bool ShiftDown = FALSE,
- bool AltDown = FALSE, bool MetaDown = FALSE );
+ bool ControlDown = false, bool ShiftDown = false,
+ bool AltDown = false, bool MetaDown = false );
void SelectCol( int col,
- bool ControlDown = FALSE, bool ShiftDown = FALSE,
- bool AltDown = FALSE, bool MetaDown = FALSE );
+ bool ControlDown = false, bool ShiftDown = false,
+ bool AltDown = false, bool MetaDown = false );
void SelectBlock( int topRow, int leftCol,
int bottomRow, int rightCol,
- bool ControlDown = FALSE, bool ShiftDown = FALSE,
- bool AltDown = FALSE, bool MetaDown = FALSE,
- bool sendEvent = TRUE );
+ bool ControlDown = false, bool ShiftDown = false,
+ bool AltDown = false, bool MetaDown = false,
+ bool sendEvent = true );
void SelectCell( int row, int col,
- bool ControlDown = FALSE, bool ShiftDown = FALSE,
- bool AltDown = FALSE, bool MetaDown = FALSE,
- bool sendEvent = TRUE );
+ bool ControlDown = false, bool ShiftDown = false,
+ bool AltDown = false, bool MetaDown = false,
+ bool sendEvent = true );
void ToggleCellSelection( int row, int col,
- bool ControlDown = FALSE,
- bool ShiftDown = FALSE,
- bool AltDown = FALSE, bool MetaDown = FALSE );
+ bool ControlDown = false,
+ bool ShiftDown = false,
+ bool AltDown = false, bool MetaDown = false );
void ClearSelection();
void UpdateRows( size_t pos, int numRows );
/// Default browser name.
# define WXEXTHELP_DEFAULTBROWSER _T("netscape")
/// Is default browse a variant of netscape?
-# define WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE TRUE
+# define WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE true
#endif
/**
*/
class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase
-{
+{
DECLARE_CLASS(wxExtHelpController)
public:
wxExtHelpController();
The Netscape support will check whether Netscape is already
running (by looking at the .netscape/lock file in the user's
home directory) and tell it to load the page into the existing
- window.
+ window.
@param browsername The command to call a browser/html viewer.
- @param isNetscape Set this to TRUE if the browser is some variant of Netscape.
+ @param isNetscape Set this to true if the browser is some variant of Netscape.
*/
// Obsolete form
void SetBrowser(const wxString & browsername = WXEXTHELP_DEFAULTBROWSER,
@file Name of help directory.
@return true on success
*/
- virtual bool LoadFile(const wxString& file = wxT(""));
+ virtual bool LoadFile(const wxString& file = wxEmptyString);
/** Display list of all help entries.
@return true on success
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
- bool WXUNUSED(newFrameEachTime) = FALSE)
+ bool WXUNUSED(newFrameEachTime) = false)
{
// does nothing by default
}
- /// Obtains the latest settings used by the help frame and the help
+ /// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
{
public:
wxGenericImageList() { m_width = m_height = 0; }
- wxGenericImageList( int width, int height, bool mask = TRUE, int initialCount = 1 );
+ wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 );
~wxGenericImageList();
- bool Create( int width, int height, bool mask = TRUE, int initialCount = 1 );
+ bool Create( int width, int height, bool mask = true, int initialCount = 1 );
bool Create();
virtual int GetImageCount() const;
virtual bool Draw(int index, wxDC& dc, int x, int y,
int flags = wxIMAGELIST_DRAW_NORMAL,
- bool solidBackground = FALSE);
+ bool solidBackground = false);
private:
wxList m_images;
public:
wxImageList() {}
- wxImageList( int width, int height, bool mask = TRUE, int initialCount = 1 )
+ wxImageList( int width, int height, bool mask = true, int initialCount = 1 )
: wxGenericImageList(width, height, mask, initialCount)
{
}
wxSize m_size;
wxLayoutOrientation m_orientation;
wxLayoutAlignment m_alignment;
-
+
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent)
};
typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&);
#define EVT_QUERY_LAYOUT_INFO(func) \
- DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxQueryLayoutInfoEventFunction, & func ), NULL ),
+ DECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxQueryLayoutInfoEventFunction, & func ), NULL ),
/*
* This event is used to take a bite out of the available client area.
protected:
int m_flags;
wxRect m_rect;
-
+
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent)
};
typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&);
#define EVT_CALCULATE_LAYOUT(func) \
- DECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCalculateLayoutEventFunction, & func ), NULL ),
+ DECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCalculateLayoutEventFunction, & func ), NULL ),
#if wxUSE_SASH
Init();
}
- wxSashLayoutWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ wxSashLayoutWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow"))
{
Create(parent, id, pos, size, style, name);
}
- bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("layoutWindow"));
// Accessors
public:
wxGenericListCtrl();
wxGenericListCtrl( wxWindow *parent,
- wxWindowID winid = -1,
+ wxWindowID winid = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxLC_ICON,
~wxGenericListCtrl();
bool Create( wxWindow *parent,
- wxWindowID winid = -1,
+ wxWindowID winid = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxLC_ICON,
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
int GetItemCount() const;
int GetColumnCount() const;
- void SetItemSpacing( int spacing, bool isSmall = FALSE );
+ void SetItemSpacing( int spacing, bool isSmall = false );
wxSize GetItemSpacing() const;
void SetItemTextColour( long item, const wxColour& col);
wxColour GetItemTextColour( long item ) const;
void SetTextColour(const wxColour& col);
long GetTopItem() const;
- void SetSingleStyle( long style, bool add = TRUE ) ;
+ void SetSingleStyle( long style, bool add = true ) ;
void SetWindowStyleFlag( long style );
void RecreateWindow() {}
long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
void Edit( long item );
bool EnsureVisible( long item );
- long FindItem( long start, const wxString& str, bool partial = FALSE );
+ long FindItem( long start, const wxString& str, bool partial = false );
long FindItem( long start, long data );
long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC
long HitTest( const wxPoint& point, int& flags);
void OnSize( wxSizeEvent &event );
// We have to hand down a few functions
- virtual void Refresh(bool eraseBackground = TRUE,
+ virtual void Refresh(bool eraseBackground = true,
const wxRect *rect = NULL);
virtual void Freeze();
public:
wxListCtrl() {}
- wxListCtrl(wxWindow *parent, wxWindowID winid = -1,
+ wxListCtrl(wxWindow *parent, wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
// no size hints
virtual void SetSizeHints( int WXUNUSED(minW),
int WXUNUSED(minH),
- int WXUNUSED(maxW) = -1,
- int WXUNUSED(maxH) = -1,
- int WXUNUSED(incW) = -1,
- int WXUNUSED(incH) = -1) {}
+ int WXUNUSED(maxW) = wxDefaultSize.x,
+ int WXUNUSED(maxH) = wxDefaultSize.y,
+ int WXUNUSED(incW) = wxDefaultSize.x,
+ int WXUNUSED(incH) = wxDefaultSize.y) {}
#if wxUSE_TOOLBAR
// no toolbar bars
void SetIcons( const wxIconBundle& WXUNUSED(icons) ) { }
// no maximize etc
- virtual void Maximize( bool WXUNUSED(maximize) = TRUE) { /* Has no effect */ }
+ virtual void Maximize( bool WXUNUSED(maximize) = true) { /* Has no effect */ }
virtual void Restore() { /* Has no effect */ }
- virtual void Iconize(bool WXUNUSED(iconize) = TRUE) { /* Has no effect */ }
- virtual bool IsMaximized() const { return TRUE; }
- virtual bool IsIconized() const { return FALSE; }
- virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return FALSE; }
- virtual bool IsFullScreen() const { return FALSE; }
+ virtual void Iconize(bool WXUNUSED(iconize) = true) { /* Has no effect */ }
+ virtual bool IsMaximized() const { return true; }
+ virtual bool IsIconized() const { return false; }
+ virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; }
+ virtual bool IsFullScreen() const { return false; }
- virtual bool IsTopLevel() const { return FALSE; }
+ virtual bool IsTopLevel() const { return false; }
void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event);
}
wxMDIChildFrame * GetActiveChild() const ;
-
-
+
+
private:
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
};
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __MSGDLGH_G__
#define wxMessageDialog wxGenericMessageDialog
#endif
-#endif
- // __MSGDLGH_G__
+#endif // __MSGDLGH_G__
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage);
// cycle thru the tabs
- // void AdvanceSelection(bool bForward = TRUE);
+ // void AdvanceSelection(bool bForward = true);
// get the currently selected page
int GetSelection() const { return m_nSelection; }
bool InsertPage(size_t nPage,
wxNotebookPage *pPage,
const wxString& strText,
- bool bSelect = FALSE,
+ bool bSelect = false,
int imageId = -1);
// callbacks
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
- virtual void SetConstraintSizes(bool recurse = TRUE);
+ virtual void SetConstraintSizes(bool recurse = true);
virtual bool DoPhase(int nPhase);
// Implementation
// Implementation: calculate the layout of the view rect
// and resize the children if required
- bool RefreshLayout(bool force = TRUE);
+ bool RefreshLayout(bool force = true);
protected:
// common part of all ctors
{
Init();
- Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
+ Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name);
}
// Constructor
wxPanel(wxWindow *parent,
- wxWindowID winid = -1,
+ wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
virtual void InitDialog();
#ifdef __WXUNIVERSAL__
- virtual bool IsCanvasWindow() const { return TRUE; }
- virtual bool ProvidesBackground() const { return TRUE; }
+ virtual bool IsCanvasWindow() const { return true; }
+ virtual bool ProvidesBackground() const { return true; }
#endif
virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
-
+
WX_DECLARE_CONTROL_CONTAINER();
protected:
wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
virtual ~wxPostScriptPrinter();
- virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
+ virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
virtual wxDC* PrintDialog(wxWindow *parent);
virtual bool Setup(wxWindow *parent);
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter)
};
// Created: 2004/04/12
// RCS-ID: $Id$
// Copyright: (c) 2004 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GENERIC_REGION_H__
class WXDLLIMPEXP_ADV wxSashEdge
{
public:
- wxSashEdge() { m_show = FALSE; m_border = FALSE; m_margin = 0; }
+ wxSashEdge() { m_show = false; m_border = false; m_margin = 0; }
bool m_show; // Is the sash showing?
bool m_border; // Do we draw a border?
}
// Normal constructor
- wxSashWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ wxSashWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow"))
{
Init();
~wxSashWindow();
- bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = wxT("sashWindow"));
// Set whether there's a sash in this position
//// dragging the top below the bottom)
inline void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; }
inline wxSashDragStatus GetDragStatus() const { return m_dragStatus; }
-
+
private:
wxSashEdgePosition m_edge;
wxRect m_dragRect;
typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&);
#define EVT_SASH_DRAGGED(id, fn) \
- DECLARE_EVENT_TABLE_ENTRY( wxEVT_SASH_DRAGGED, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSashEventFunction, & fn ), NULL ),
+ DECLARE_EVENT_TABLE_ENTRY( wxEVT_SASH_DRAGGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSashEventFunction, & fn ), NULL ),
#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SASH_DRAGGED, id1, id2, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSashEventFunction, & fn ), NULL ),
public:
wxGenericScrolledWindow() : wxScrollHelper(this) { }
wxGenericScrolledWindow(wxWindow *parent,
- wxWindowID winid = -1,
+ wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxScrolledWindowStyle,
wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
}
bool Create(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// implementation from now on
// forward these functions to all subcontrols
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
// get the subcontrols
wxTextCtrl *GetText() const { return m_text; }
void SetTextValue(int val);
// put the numeric value of the string in the text ctrl into val and return
- // TRUE or return FALSE if the text ctrl doesn't contain a number or if the
+ // true or return false if the text ctrl doesn't contain a number or if the
// number is out of range
bool GetTextValue(int *val) const;
wxSpinCtrl() { Init(); }
wxSpinCtrl(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
}
bool Create(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
}
// Normal constructor
- wxSplitterWindow(wxWindow *parent, wxWindowID id = -1,
+ wxSplitterWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_3D,
virtual ~wxSplitterWindow();
- bool Create(wxWindow *parent, wxWindowID id = -1,
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_3D,
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, \
id, \
- -1, \
+ wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxSplitterEventFunction, &fn ), \
NULL \
),
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, \
id, \
- -1, \
+ wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxSplitterEventFunction, &fn ), \
NULL \
),
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, \
id, \
- -1, \
+ wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxSplitterEventFunction, &fn ), \
NULL \
),
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_SPLITTER_UNSPLIT, \
id, \
- -1, \
+ wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxSplitterEventFunction, &fn ), \
NULL \
),
void SetBorderY(int y);
void OnPaint(wxPaintEvent& event);
-
+
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
inline void SetWindow(wxWindow* wnd) { m_window = wnd; }
inline wxWindow* GetWindow(void) const { return m_window; }
-
+
// Automatically positions tabs
wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = (wxTabControl *) NULL);
// Remove the tab without deleting the window
bool RemoveTab(int id);
-
- void ClearTabs(bool deleteTabs = TRUE);
+
+ void ClearTabs(bool deleteTabs = true);
bool SetTabText(int id, const wxString& label);
wxString GetTabText(int id) const;
// Draw all tabs
virtual void Draw(wxDC& dc);
-
- // Process mouse event, return FALSE if we didn't process it
+
+ // Process mouse event, return false if we didn't process it
virtual bool OnEvent(wxMouseEvent& event);
// Called when a tab is activated
virtual void OnTabActivate(int activateId, int deactivateId);
// Allows vetoing
- virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return TRUE; };
+ virtual bool OnTabPreActivate(int WXUNUSED(activateId), int WXUNUSED(deactivateId) ) { return true; };
// Allows use of application-supplied wxTabControl classes.
virtual wxTabControl *OnCreateTabControl(void) { return new wxTabControl(this); }
void SetShadowColour(const wxColour& col);
void SetBackgroundColour(const wxColour& col);
inline void SetTextColour(const wxColour& col) { m_textColour = col; }
-
+
inline wxColour GetHighlightColour(void) const { return m_highlightColour; }
inline wxColour GetShadowColour(void) const { return m_shadowColour; }
inline wxColour GetBackgroundColour(void) const { return m_backgroundColour; }
inline wxPen *GetShadowPen(void) const { return m_shadowPen; }
inline wxPen *GetBackgroundPen(void) const { return m_backgroundPen; }
inline wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; }
-
+
inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; }
inline wxRect GetViewRect(void) const { return m_tabViewRect; }
-
+
// Calculate tab width to fit to view, and optionally adjust the view
// to fit the tabs exactly.
- int CalculateTabWidth(int noTabs, bool adjustView = FALSE);
+ int CalculateTabWidth(int noTabs, bool adjustView = false);
inline void SetTabStyle(long style) { m_tabStyle = style; }
inline long GetTabStyle(void) const { return m_tabStyle; }
-
+
inline void SetTabSize(int w, int h) { m_tabWidth = w; m_tabHeight = h; }
inline int GetTabWidth(void) const { return m_tabWidth; }
inline int GetTabHeight(void) const { return m_tabHeight; }
// Returns the total height of the tabs component -- this may be several
// times the height of a tab, if there are several tab layers (rows).
int GetTotalTabHeight();
-
+
inline int GetTopMargin(void) const { return m_topMargin; }
inline void SetTopMargin(int margin) { m_topMargin = margin; }
-
- void SetTabSelection(int sel, bool activateTool = TRUE);
+
+ void SetTabSelection(int sel, bool activateTool = true);
inline int GetTabSelection() const { return m_tabSelection; }
-
+
// Find tab control for id
wxTabControl *FindTabControlForId(int id) const ;
// Find tab control for layer, position (starting from zero)
wxTabControl *FindTabControlForPosition(int layer, int position) const ;
-
+
inline int GetHorizontalTabOffset() const { return m_tabHorizontalOffset; }
inline int GetHorizontalTabSpacing() const { return m_tabHorizontalSpacing; }
inline void SetHorizontalTabOffset(int sp) { m_tabHorizontalOffset = sp; }
inline void SetHorizontalTabSpacing(int sp) { m_tabHorizontalSpacing = sp; }
-
+
inline void SetVerticalTabTextSpacing(int s) { m_tabVerticalTextSpacing = s; }
inline int GetVerticalTabTextSpacing() const { return m_tabVerticalTextSpacing; }
-
+
inline wxFont *GetTabFont() const { return (wxFont*) & m_tabFont; }
inline void SetTabFont(const wxFont& f) { m_tabFont = f; }
inline void SetSelectedTabFont(const wxFont& f) { m_tabSelectedFont = f; }
// Find the node and the column at which this control is positioned.
wxList::compatibility_iterator FindTabNodeAndColumn(wxTabControl *control, int *col) const ;
-
+
// Do the necessary to change to this tab
virtual bool ChangeTab(wxTabControl *control);
protected:
// List of layers, from front to back.
wxTabLayerList m_layers;
-
+
// Selected tab
int m_tabSelection;
// Usual tab width
int m_tabWidth;
-
+
// Space between tabs
int m_tabHorizontalSpacing;
-
+
// Space between top of normal tab and text
int m_tabVerticalTextSpacing;
-
+
// Horizontal offset of each tab row above the first
int m_tabHorizontalOffset;
// The position and size of the view above which the tabs are placed.
// I.e., the internal client area of the sheet.
wxRect m_tabViewRect;
-
+
// Bitlist of styles
long m_tabStyle;
wxColour m_shadowColour;
wxColour m_backgroundColour;
wxColour m_textColour;
-
+
// Pen and brush cache
wxPen* m_highlightPen;
wxPen* m_shadowPen;
wxPen* m_backgroundPen;
wxBrush* m_backgroundBrush;
-
+
wxFont m_tabFont;
wxFont m_tabSelectedFont;
-
+
int m_noTabs;
wxWindow* m_window;
/*
* A dialog box class that is tab-friendly
*/
-
+
class WXDLLEXPORT wxTabbedDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxTabbedDialog)
-
+
public:
wxTabbedDialog(wxWindow *parent, wxWindowID id, const wxString& title,
const wxSize& size = wxDefaultSize,
long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxDialogNameStr);
~wxTabbedDialog(void);
-
+
inline wxTabView *GetTabView() const { return m_tabView; }
inline void SetTabView(wxTabView *v) { m_tabView = v; }
protected:
wxTabView* m_tabView;
-
+
DECLARE_EVENT_TABLE()
};
class WXDLLEXPORT wxTabbedPanel: public wxPanel
{
DECLARE_DYNAMIC_CLASS(wxTabbedPanel)
-
+
public:
wxTabbedPanel(wxWindow *parent, wxWindowID id,
const wxSize& size = wxDefaultSize,
long windowStyle = 0, const wxString& name = wxPanelNameStr);
~wxTabbedPanel(void);
-
+
inline wxTabView *GetTabView() const { return m_tabView; }
inline void SetTabView(wxTabView *v) { m_tabView = v; }
-
+
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
protected:
wxTabView* m_tabView;
-
+
DECLARE_EVENT_TABLE()
};
// Specific to this class
void AddTabWindow(int id, wxWindow *window);
wxWindow *GetTabWindow(int id) const ;
- void ClearWindows(bool deleteWindows = TRUE);
+ void ClearWindows(bool deleteWindows = true);
inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
-
+
void ShowWindowForTab(int id);
// inline wxList& GetWindows() const { return (wxList&) m_tabWindows; }
const wxString& caption = wxGetTextFromUserPromptStr,
const wxString& default_value = wxEmptyString,
wxWindow *parent = (wxWindow *) NULL,
- int x = -1,
- int y = -1,
- bool centre = TRUE);
+ int x = wxDefaultPosition.x,
+ int y = wxDefaultPosition.y,
+ bool centre = true);
wxString WXDLLEXPORT
wxGetPasswordFromUser(const wxString& message,
{ Init(); }
~wxTimer();
- virtual bool Start(int millisecs = -1, bool oneShot = FALSE);
+ virtual bool Start(int millisecs = -1, bool oneShot = false);
virtual void Stop();
virtual bool IsRunning() const;
private:
wxTimerDesc *m_desc;
-
+
DECLARE_ABSTRACT_CLASS(wxTimer)
};
// --------
wxGenericTreeCtrl() { Init(); }
- wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = -1,
+ wxGenericTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_DEFAULT_STYLE,
virtual ~wxGenericTreeCtrl();
- bool Create(wxWindow *parent, wxWindowID id = -1,
+ bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_DEFAULT_STYLE,
// allow the user to expand the items which don't have any children now
// - but instead add them only when needed, thus minimizing memory
// usage and loading time.
- void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
+ void SetItemHasChildren(const wxTreeItemId& item, bool has = true);
// the item will be shown in bold
- void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
+ void SetItemBold(const wxTreeItemId& item, bool bold = true);
// set the item's text colour
void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
// number of children
// ------------------
- // if 'recursively' is FALSE, only immediate children count, otherwise
+ // if 'recursively' is false, only immediate children count, otherwise
// the returned number is the number of all items in this branch
size_t GetChildrenCount(const wxTreeItemId& item,
- bool recursively = TRUE) const;
+ bool recursively = true) const;
// navigation
// ----------
- // wxTreeItemId.IsOk() will return FALSE if there is no such item
+ // wxTreeItemId.IsOk() will return false if there is no such item
// get the root tree item
wxTreeItemId GetRootItem() const { return m_anchor; }
// get the bounding rectangle of the item (or of its label only)
bool GetBoundingRect(const wxTreeItemId& item,
wxRect& rect,
- bool textOnly = FALSE) const;
+ bool textOnly = false) const;
// Start editing the item label: this (temporarily) replaces the item
// with a one line edit control. The item will be selected if it hadn't
virtual void Freeze();
virtual void Thaw();
-
+
// callbacks
void OnPaint( wxPaintEvent &event );
void OnSetFocus( wxFocusEvent &event );
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
+
// implementation helpers
protected:
friend class wxGenericTreeItem;
*m_imageListState,
*m_imageListButtons;
- int m_freezeCount;
+ int m_freezeCount;
int m_dragCount;
wxPoint m_dragStart;
wxGenericTreeItem *m_dropTarget;
void DrawDropEffect(wxGenericTreeItem *item);
void DoSelectItem(const wxTreeItemId& id,
- bool unselect_others = TRUE,
- bool extended_select = FALSE);
+ bool unselect_others = true,
+ bool extended_select = false);
wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t previous,
public:
wxTreeCtrl() {}
- wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
+ wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_DEFAULT_STYLE,
// ctor
wxWizard() { Init(); }
wxWizard(wxWindow *parent,
- int id = -1,
+ int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
Create(parent, id, title, bitmap, pos, style);
}
bool Create(wxWindow *parent,
- int id = -1,
+ int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
bool IsRunning() const { return m_page != NULL; }
// show the prev/next page, but call TransferDataFromWindow on the current
- // page first and return FALSE without changing the page if
- // TransferDataFromWindow() returns FALSE - otherwise, returns TRUE
- bool ShowPage(wxWizardPage *page, bool goingForward = TRUE);
+ // page first and return false without changing the page if
+ // TransferDataFromWindow() returns false - otherwise, returns true
+ bool ShowPage(wxWizardPage *page, bool goingForward = true);
// do fill the dialog with controls
// this is app-overridable to, for example, set help and tooltip text
void AddButtonRow(wxBoxSizer *mainColumn);
void FinishLayout();
-
+
wxSize GetManualPageSize() const;
-
+
// the page size requested by user
wxSize m_sizePage;
bool m_calledSetBorder;
// Border around page area sizer requested using SetBorder()
int m_border;
-
+
// Whether RunWizard() was called
bool m_started;
-
+
// Page area sizer will be inserted here with padding
wxBoxSizer *m_sizerBmpAndPage;
-
+
// Actual position and size of pages
wxWizardSizer *m_sizerPage;
-
+
friend class wxWizardSizer;
-
+
DECLARE_DYNAMIC_CLASS(wxWizard)
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxWizard)
wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
- : wxFrame(parent, -1, wxT("Busy"),
+ : wxFrame(parent, wxID_ANY, wxT("Busy"),
wxDefaultPosition, wxDefaultSize,
#if defined(__WXX11__)
wxTHICK_FRAME
| wxFRAME_TOOL_WINDOW)
{
wxPanel *panel = new wxPanel( this );
- wxStaticText *text = new wxStaticText(panel, -1, message);
+ wxStaticText *text = new wxStaticText(panel, wxID_ANY, message);
panel->SetCursor(*wxHOURGLASS_CURSOR);
text->SetCursor(*wxHOURGLASS_CURSOR);
wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
{
m_InfoFrame = new wxInfoFrame( parent, message);
- m_InfoFrame->Show(TRUE);
+ m_InfoFrame->Show(true);
#ifdef __WXMAC__
- m_InfoFrame->Update() ;
+ m_InfoFrame->Update() ;
#else
wxYield();
m_InfoFrame->Refresh();
wxBusyInfo::~wxBusyInfo()
{
- m_InfoFrame->Show(FALSE);
+ m_InfoFrame->Show(false);
m_InfoFrame->Close();
wxYield();
}
public:
wxYearSpinCtrl(wxCalendarCtrl *cal);
- void OnYearTextChange(wxCommandEvent& event)
+ void OnYearTextChange(wxCommandEvent& event)
{
m_cal->SetUserChangedYear();
m_cal->OnYearChange(event);
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxMonthComboBox, wxComboBox)
- EVT_COMBOBOX(-1, wxMonthComboBox::OnMonthChange)
+ EVT_COMBOBOX(wxID_ANY, wxMonthComboBox::OnMonthChange)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxYearSpinCtrl, wxSpinCtrl)
- EVT_TEXT(-1, wxYearSpinCtrl::OnYearTextChange)
- EVT_SPINCTRL(-1, wxYearSpinCtrl::OnYearChange)
+ EVT_TEXT(wxID_ANY, wxYearSpinCtrl::OnYearTextChange)
+ EVT_SPINCTRL(wxID_ANY, wxYearSpinCtrl::OnYearChange)
END_EVENT_TABLE()
#if wxUSE_EXTENDED_RTTI
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_PROPERTIES_TABLE(wxCalendarCtrl)
wxEVENT_RANGE_PROPERTY( Updated , wxEVT_CALENDAR_SEL_CHANGED , wxEVT_CALENDAR_WEEKDAY_CLICKED , wxCalendarEvent )
wxHIDE_PROPERTY( Children )
- wxPROPERTY( Date,wxDateTime, SetDate , GetDate, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Date,wxDateTime, SetDate , GetDate, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_FLAGS( WindowStyle , wxCalendarCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxCalendarCtrl)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_6( wxCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateTime , Date , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_6( wxCalendarCtrl , wxWindow* , Parent , wxWindowID , Id , wxDateTime , Date , wxPoint , Position , wxSize , Size , long , WindowStyle )
#else
IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrl, wxControl)
#endif
// ----------------------------------------------------------------------------
wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl *cal)
- : wxComboBox(cal->GetParent(), -1,
+ : wxComboBox(cal->GetParent(), wxID_ANY,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
}
SetSelection(m_cal->GetDate().GetMonth());
- SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
+ SetSize(wxDefaultPosition.x,
+ wxDefaultPosition.y,
+ wxDefaultSize.x,
+ wxDefaultSize.y,
+ wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
}
wxYearSpinCtrl::wxYearSpinCtrl(wxCalendarCtrl *cal)
- : wxSpinCtrl(cal->GetParent(), -1,
+ : wxSpinCtrl(cal->GetParent(), wxID_ANY,
cal->GetDate().Format(_T("%Y")),
wxDefaultPosition,
wxDefaultSize,
const wxString& name)
{
Init();
-
+
(void)Create(parent, id, date, pos, size, style, name);
}
m_staticYear = NULL;
m_staticMonth = NULL;
- m_userChangedYear = FALSE;
+ m_userChangedYear = false;
m_widthCol =
m_heightRow = 0;
style | wxCLIP_CHILDREN | wxWANTS_CHARS,
wxDefaultValidator, name) )
{
- return FALSE;
+ return false;
}
// needed to get the arrow keys normally used for the dialog navigation
if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
{
m_spinYear = new wxYearSpinCtrl(this);
- m_staticYear = new wxStaticText(GetParent(), -1, m_date.Format(_T("%Y")),
+ m_staticYear = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%Y")),
wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTRE);
m_comboMonth = new wxMonthComboBox(this);
- m_staticMonth = new wxStaticText(GetParent(), -1, m_date.Format(_T("%B")),
+ m_staticMonth = new wxStaticText(GetParent(), wxID_ANY, m_date.Format(_T("%B")),
wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTRE);
}
ShowCurrentControls();
wxSize sizeReal;
- if ( size.x == -1 || size.y == -1 )
+ if ( size.x == wxDefaultSize.x || size.y == wxDefaultSize.y )
{
sizeReal = DoGetBestSize();
- if ( size.x != -1 )
+ if ( size.x != wxDefaultSize.x )
sizeReal.x = size.x;
- if ( size.y != -1 )
+ if ( size.y != wxDefaultSize.y )
sizeReal.y = size.y;
}
else
SetHolidayAttrs();
- return TRUE;
+ return true;
}
wxCalendarCtrl::~wxCalendarCtrl()
{
if ( !wxControl::Show(show) )
{
- return FALSE;
+ return false;
}
if ( !(GetWindowStyle() & wxCAL_SEQUENTIAL_MONTH_SELECTION) )
}
}
- return TRUE;
+ return true;
}
bool wxCalendarCtrl::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
{
- return FALSE;
+ return false;
}
if ( !(GetWindowStyle() & wxCAL_SEQUENTIAL_MONTH_SELECTION) )
GetYearControl()->Enable(enable);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxCalendarCtrl::SetDate(const wxDateTime& date)
{
- bool retval = TRUE;
+ bool retval = true;
bool sameMonth = m_date.GetMonth() == date.GetMonth(),
sameYear = m_date.GetYear() == date.GetYear();
else
{
// forbidden
- retval = FALSE;
+ retval = false;
}
}
}
- m_userChangedYear = FALSE;
-
+ m_userChangedYear = false;
+
return retval;
}
bool wxCalendarCtrl::SetLowerDateLimit(const wxDateTime& date /* = wxDefaultDateTime */)
{
- bool retval = TRUE;
+ bool retval = true;
- if ( !(date.IsValid()) || ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : TRUE ) )
+ if ( !(date.IsValid()) || ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : true ) )
{
m_lowdate = date;
}
else
{
- retval = FALSE;
+ retval = false;
}
return retval;
bool wxCalendarCtrl::SetUpperDateLimit(const wxDateTime& date /* = wxDefaultDateTime */)
{
- bool retval = TRUE;
+ bool retval = true;
- if ( !(date.IsValid()) || ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : TRUE ) )
+ if ( !(date.IsValid()) || ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : true ) )
{
m_highdate = date;
}
else
{
- retval = FALSE;
+ retval = false;
}
return retval;
bool wxCalendarCtrl::SetDateRange(const wxDateTime& lowerdate /* = wxDefaultDateTime */, const wxDateTime& upperdate /* = wxDefaultDateTime */)
{
- bool retval = TRUE;
+ bool retval = true;
if (
- ( !( lowerdate.IsValid() ) || ( ( upperdate.IsValid() ) ? ( lowerdate <= upperdate ) : TRUE ) ) &&
- ( !( upperdate.IsValid() ) || ( ( lowerdate.IsValid() ) ? ( upperdate >= lowerdate ) : TRUE ) ) )
+ ( !( lowerdate.IsValid() ) || ( ( upperdate.IsValid() ) ? ( lowerdate <= upperdate ) : true ) ) &&
+ ( !( upperdate.IsValid() ) || ( ( lowerdate.IsValid() ) ? ( upperdate >= lowerdate ) : true ) ) )
{
m_lowdate = lowerdate;
m_highdate = upperdate;
}
else
{
- retval = FALSE;
+ retval = false;
}
return retval;
}
else
{
- return TRUE;
+ return true;
}
}
bool wxCalendarCtrl::IsDateInRange(const wxDateTime& date) const
{
// Check if the given date is in the range specified
- return ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : TRUE )
- && ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : TRUE ) );
+ return ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : true )
+ && ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : true ) );
}
bool wxCalendarCtrl::ChangeYear(wxDateTime* target) const
{
- bool retval = FALSE;
+ bool retval = false;
if ( !(IsDateInRange(*target)) )
{
if ( target->GetYear() >= GetLowerDateLimit().GetYear() )
{
*target = GetLowerDateLimit();
- retval = TRUE;
+ retval = true;
}
else
{
if ( target->GetYear() <= GetUpperDateLimit().GetYear() )
{
*target = GetUpperDateLimit();
- retval = TRUE;
+ retval = true;
}
else
{
}
else
{
- retval = TRUE;
+ retval = true;
}
return retval;
bool wxCalendarCtrl::ChangeMonth(wxDateTime* target) const
{
- bool retval = TRUE;
+ bool retval = true;
if ( !(IsDateInRange(*target)) )
{
- retval = FALSE;
+ retval = false;
if ( target->GetMonth() < m_date.GetMonth() )
{
wxSize sizeSpin = m_spinYear->GetSize();
int dy = (sizeCombo.y - sizeStatic.y) / 2;
/*
-In the calender the size of the combobox for the year
-is just defined by a margin from the month combobox to
-the left border. While in wxUniv the year control can't
-show all 4 digits, in wxMsw it show almost twice as
-much. Instead the year should use it's best size and be
-left aligned to the calendar. Just in case the month in
-any language is longer than it has space in the
-calendar it is shortend.This way the year always can
-show the 4 digits.
-
-This patch relies on the fact that a combobox has a
-good best size implementation. This is not the case
+In the calender the size of the combobox for the year
+is just defined by a margin from the month combobox to
+the left border. While in wxUniv the year control can't
+show all 4 digits, in wxMsw it show almost twice as
+much. Instead the year should use it's best size and be
+left aligned to the calendar. Just in case the month in
+any language is longer than it has space in the
+calendar it is shortend.This way the year always can
+show the 4 digits.
+
+This patch relies on the fact that a combobox has a
+good best size implementation. This is not the case
with wxMSW but I don't know why.
Otto Wyss
{
wxDateTime ldpm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) - wxDateSpan::Day(); // last day prev month
// Check if range permits change
- if ( IsDateInRange(ldpm) && ( ( ldpm.GetYear() == m_date.GetYear() ) ? TRUE : AllowYearChange() ) )
+ if ( IsDateInRange(ldpm) && ( ( ldpm.GetYear() == m_date.GetYear() ) ? true : AllowYearChange() ) )
{
m_leftArrowRect = wxRect(larrowx - 3, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
dc.DrawRectangle(m_leftArrowRect);
}
wxDateTime fdnm = wxDateTime(1,m_date.GetMonth(), m_date.GetYear()) + wxDateSpan::Month(); // first day next month
- if ( IsDateInRange(fdnm) && ( ( fdnm.GetYear() == m_date.GetYear() ) ? TRUE : AllowYearChange() ) )
+ if ( IsDateInRange(fdnm) && ( ( fdnm.GetYear() == m_date.GetYear() ) ? true : AllowYearChange() ) )
{
m_rightArrowRect = wxRect(rarrowx - 4, arrowy - 3, (arrowheight / 2) + 8, (arrowheight + 6));
dc.SetBrush(wxBrush(*wxBLACK, wxSOLID));
wxCoord width;
dc.GetTextExtent(dayStr, &width, (wxCoord *)NULL);
- bool changedColours = FALSE,
- changedFont = FALSE;
+ bool changedColours = false,
+ changedFont = false;
- bool isSel = FALSE;
+ bool isSel = false;
wxCalendarDateAttr *attr = NULL;
if ( date.GetMonth() != m_date.GetMonth() || !IsDateInRange(date) )
// surrounding week or out-of-range
// draw "disabled"
dc.SetTextForeground(*wxLIGHT_GREY);
- changedColours = TRUE;
+ changedColours = true;
}
else
{
dc.SetTextForeground(m_colHighlightFg);
dc.SetTextBackground(m_colHighlightBg);
- changedColours = TRUE;
+ changedColours = true;
}
else if ( attr )
{
if ( colFg.Ok() )
{
dc.SetTextForeground(colFg);
- changedColours = TRUE;
+ changedColours = true;
}
if ( colBg.Ok() )
{
dc.SetTextBackground(colBg);
- changedColours = TRUE;
+ changedColours = true;
}
if ( attr->HasFont() )
{
dc.SetFont(attr->GetFont());
- changedFont = TRUE;
+ changedFont = true;
}
}
}
rect.x + rect.width, rect.y + rect.height);
#endif
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
}
void wxCalendarCtrl::HighlightRange(wxPaintDC* pDC, const wxDateTime& fromdate, const wxDateTime& todate, wxPen* pPen, wxBrush* pBrush)
bool wxCalendarCtrl::GetDateCoord(const wxDateTime& date, int *day, int *week) const
{
- bool retval = TRUE;
+ bool retval = true;
#if DEBUG_PAINT
wxLogDebug("+++ GetDateCoord: (%s) +++", date.Format("%d %m %Y"));
{
*day = -1;
*week = -1;
- retval = FALSE;
+ retval = false;
}
#if DEBUG_PAINT
attr = new wxCalendarDateAttr;
}
- attr->SetHoliday(TRUE);
+ attr->SetHoliday(true);
// can't use SetAttr() because it would delete this pointer
m_attrs[day - 1] = attr;
{
if ( m_attrs[day] )
{
- m_attrs[day]->SetHoliday(FALSE);
+ m_attrs[day]->SetHoliday(false);
}
}
}
// timer stuff
// ----------------------------------------------------------------------------
-wxCaretTimer::wxCaretTimer(wxCaret *caret)
-{
- m_caret = caret;
+wxCaretTimer::wxCaretTimer(wxCaret *caret)
+{
+ m_caret = caret;
}
-void wxCaretTimer::Notify()
-{
- m_caret->OnTimer();
+void wxCaretTimer::Notify()
+{
+ m_caret->OnTimer();
}
void wxCaret::OnTimer()
void wxCaret::InitGeneric()
{
- m_hasFocus = TRUE;
- m_blinkedOut = TRUE;
+ m_hasFocus = true;
+ m_blinkedOut = true;
m_xOld =
m_yOld = -1;
void wxCaret::OnSetFocus()
{
- m_hasFocus = TRUE;
+ m_hasFocus = true;
if ( IsVisible() )
Refresh();
void wxCaret::OnKillFocus()
{
- m_hasFocus = FALSE;
+ m_hasFocus = false;
if ( IsVisible() )
{
const wxPoint& pos,
long styleLbox)
{
- if ( !wxDialog::Create(parent, -1, caption, pos, wxDefaultSize, styleDlg) )
- return FALSE;
+ if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) )
+ return false;
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATLINE
// 3) static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 4) buttons
topsizer->Add( CreateButtonSizer( styleDlg & (wxOK|wxCANCEL) ), 0, wxCENTRE | wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
m_listbox->SetFocus();
- return TRUE;
+ return true;
}
bool wxAnyChoiceDialog::Create(wxWindow *parent,
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
n, choices,
style, pos) )
- return FALSE;
+ return false;
m_selection = n > 0 ? 0 : -1;
m_listbox->SetClientData(i, clientData[i]);
}
- return TRUE;
+ return true;
}
bool wxSingleChoiceDialog::Create( wxWindow *parent,
n, choices,
style, pos,
wxLB_ALWAYS_SB | wxLB_EXTENDED) )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
bool wxMultiChoiceDialog::Create( wxWindow *parent,
m_selections.Add(n);
}
- return TRUE;
+ return true;
}
#endif // wxUSE_CHOICEDLG
bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data)
{
- if ( !wxDialog::Create(parent, -1, _("Choose colour"),
+ if ( !wxDialog::Create(parent, wxID_ANY, _("Choose colour"),
wxPoint(0, 0), wxSize(900, 900)) )
- return FALSE;
+ return false;
dialogParent = parent;
CalculateMeasurements();
CreateWidgets();
- return TRUE;
+ return true;
}
int wxGenericColourDialog::ShowModal()
PaintBasicColours(dc);
PaintCustomColours(dc);
PaintCustomColour(dc);
- PaintHighlight(dc, TRUE);
+ PaintHighlight(dc, true);
}
void wxGenericColourDialog::CalculateMeasurements()
#endif
redSlider = new wxSlider(this, wxID_RED_SLIDER, singleCustomColour.Red(), 0, 255,
- wxPoint(sliderX, 10), wxSize(-1, sliderHeight), wxVERTICAL|wxSL_LABELS);
+ wxPoint(sliderX, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS);
greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, singleCustomColour.Green(), 0, 255,
- wxPoint(sliderX + sliderSpacing, 10), wxSize(-1, sliderHeight), wxVERTICAL|wxSL_LABELS);
+ wxPoint(sliderX + sliderSpacing, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS);
blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, singleCustomColour.Blue(), 0, 255,
- wxPoint(sliderX + 2*sliderSpacing, 10), wxSize(-1, sliderHeight), wxVERTICAL|wxSL_LABELS);
+ wxPoint(sliderX + 2*sliderSpacing, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS);
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
#if wxUSE_STATLINE
// 2) static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 3) buttons
buttonsizer->Add( new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), 0, wxLEFT|wxRIGHT, 10 );
topsizer->Add( buttonsizer, 0, wxCENTRE | wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
wxColour curr = colourData.GetColour();
if ( curr.Ok() )
{
- bool initColourFound = FALSE;
+ bool initColourFound = false;
for (i = 0; i < WXSIZEOF(wxColourDialogNames); i++)
{
{
whichKind = 1;
colourSelection = i;
- initColourFound = TRUE;
+ initColourFound = true;
break;
}
}
void wxGenericColourDialog::OnBasicColourClick(int which)
{
- wxClientDC dc(this);
+ wxClientDC dc(this);
- PaintHighlight(dc, FALSE);
- whichKind = 1;
- colourSelection = which;
- colourData.SetColour(standardColours[colourSelection]);
- redSlider->SetValue( standardColours[colourSelection].Red() );
+ PaintHighlight(dc, false);
+ whichKind = 1;
+ colourSelection = which;
+ colourData.SetColour(standardColours[colourSelection]);
+ redSlider->SetValue( standardColours[colourSelection].Red() );
greenSlider->SetValue( standardColours[colourSelection].Green() );
blueSlider->SetValue( standardColours[colourSelection].Blue() );
- singleCustomColour.Set(standardColours[colourSelection].Red(), standardColours[colourSelection].Green(), standardColours[colourSelection].Blue());
+ singleCustomColour.Set(standardColours[colourSelection].Red(), standardColours[colourSelection].Green(), standardColours[colourSelection].Blue());
- PaintCustomColour(dc);
- PaintHighlight(dc, TRUE);
+ PaintCustomColour(dc);
+ PaintHighlight(dc, true);
}
void wxGenericColourDialog::OnCustomColourClick(int which)
{
- wxClientDC dc(this);
- PaintHighlight(dc, FALSE);
- whichKind = 2;
- colourSelection = which;
- colourData.SetColour(customColours[colourSelection]);
- redSlider->SetValue( customColours[colourSelection].Red() );
+ wxClientDC dc(this);
+ PaintHighlight(dc, false);
+ whichKind = 2;
+ colourSelection = which;
+ colourData.SetColour(customColours[colourSelection]);
+ redSlider->SetValue( customColours[colourSelection].Red() );
greenSlider->SetValue( customColours[colourSelection].Green() );
blueSlider->SetValue( customColours[colourSelection].Blue() );
- singleCustomColour.Set(customColours[colourSelection].Red(), customColours[colourSelection].Green(), customColours[colourSelection].Blue());
- PaintCustomColour(dc);
- PaintHighlight(dc, TRUE);
+ singleCustomColour.Set(customColours[colourSelection].Red(), customColours[colourSelection].Green(), customColours[colourSelection].Blue());
+ PaintCustomColour(dc);
+ PaintHighlight(dc, true);
}
/*
void wxGenericColourDialog::OnOk(void)
{
- Show(FALSE);
+ Show(false);
}
void wxGenericColourDialog::OnCancel(void)
{
- colourDialogCancelled = TRUE;
- Show(FALSE);
+ colourDialogCancelled = true;
+ Show(false);
}
*/
wxClientDC dc(this);
if (whichKind != 2)
{
- PaintHighlight(dc, FALSE);
+ PaintHighlight(dc, false);
whichKind = 2;
colourSelection = 0;
- PaintHighlight(dc, TRUE);
+ PaintHighlight(dc, true);
}
customColours[colourSelection].Set(singleCustomColour.Red(), singleCustomColour.Green(), singleCustomColour.Blue());
m_pageNumber = 0;
- m_clipping = FALSE;
+ m_clipping = false;
m_underlinePosition = 0.0;
m_underlineThickness = 0.0;
m_pageNumber = 0;
- m_clipping = FALSE;
+ m_clipping = false;
m_underlinePosition = 0.0;
m_underlineThickness = 0.0;
m_printData = printData;
- m_ok = TRUE;
+ m_ok = true;
}
wxPostScriptDC::~wxPostScriptDC ()
{
wxPrintDialogData ddata( data );
wxPrintDialog dialog( parent, &data );
- dialog.GetPrintDialogData().SetSetupDialog(TRUE);
+ dialog.GetPrintDialogData().SetSetupDialog(true);
if (dialog.ShowModal() != wxID_OK)
{
- m_ok = FALSE;
- return FALSE;
+ m_ok = false;
+ return false;
}
data = dialog.GetPrintDialogData().GetPrintData();
}
- return TRUE;
+ return true;
}
#endif
wxDC::DoSetClippingRegion(x, y, w, h);
- m_clipping = TRUE;
+ m_clipping = true;
PsPrintf( wxT("gsave\n newpath\n")
wxT("%d %d moveto\n")
if (m_clipping)
{
- m_clipping = FALSE;
+ m_clipping = false;
PsPrint( "grestore\n" );
}
bool wxPostScriptDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
wxFAIL_MSG( wxT("wxPostScriptDC::FloodFill not implemented.") );
- return FALSE;
+ return false;
}
bool wxPostScriptDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const
{
wxFAIL_MSG( wxT("wxPostScriptDC::GetPixel not implemented.") );
- return FALSE;
+ return false;
}
void wxPostScriptDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
wxT("%d %d moveto\n"),
LogicalToDeviceX(points[0].x+xoffset),
LogicalToDeviceY(points[0].y+yoffset) );
-
+
for (i = 1; i < n; i++)
{
PsPrintf( wxT("%d %d lineto\n"),
LogicalToDeviceX(points[i].x+xoffset),
LogicalToDeviceY(points[i].y+yoffset) );
}
-
+
PsPrint( "stroke\n" );
}
void wxPostScriptDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
- DrawBitmap( icon, x, y, TRUE );
+ DrawBitmap( icon, x, y, true );
}
/* this has to be char, not wxChar */
// We may legitimately call SetFont before BeginDoc
if (!m_pstream)
return;
-
+
PsPrint( name );
PsPrint( " reencodeISO def\n" );
PsPrint( name );
PsPrint( " findfont\n" );
-
+
char buffer[100];
sprintf( buffer, "%f scalefont setfont\n", LogicalToDeviceYRel(m_font.GetPointSize() * 1000) / 1000.0F);
// this is a hack - we must scale font size (in pts) according to m_scaleY but
double redPS = (double)(red) / 255.0;
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
-
+
char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
if (buffer[i] == ',') buffer[i] = '.';
PsPrint( buffer );
-
+
m_currentRed = red;
m_currentBlue = blue;
m_currentGreen = green;
redPS, greenPS, bluePS );
for (int i = 0; i < 100; i++)
if (buffer[i] == ',') buffer[i] = '.';
-
+
PsPrint( buffer );
m_currentRed = red;
PsPrintf( wxT("%d %d moveto\n"), LogicalToDeviceX(x), LogicalToDeviceY(by) );
PsPrint( "(" );
-
+
const wxWX2MBbuf textbuf = text.mb_str();
size_t len = strlen(textbuf);
size_t i;
PsPrint(c);
}
}
-
+
PsPrint( ") show\n" );
-
+
if (m_font.GetUnderlined())
{
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
PsPrintf( wxT("%d %d moveto\n"),
LogicalToDeviceX(x), LogicalToDeviceY(y));
-
+
char buffer[100];
sprintf(buffer, "%.8f rotate\n", angle);
size_t i;
if (buffer[i] == ',') buffer[i] = '.';
}
PsPrint( buffer);
-
+
PsPrint( "(" );
const wxWX2MBbuf textbuf = text.mb_str();
size_t len = strlen(textbuf);
PsPrint(c);
}
}
-
+
PsPrint( ") show\n" );
-
+
sprintf( buffer, "%.8f rotate\n", -angle );
for (i = 0; i < 100; i++)
{
if (buffer[i] == ',') buffer[i] = '.';
}
PsPrint( buffer );
-
+
if (m_font.GetUnderlined())
{
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
}
PsPrint( buffer );
}
-
+
CalcBoundingBox( x, y );
CalcBoundingBox( x + size * text.Length() * 2/3 , y );
}
bool wxPostScriptDC::StartDoc( const wxString& message )
{
- wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
+ wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") );
if ( m_printData.GetPrintMode() != wxPRINT_MODE_STREAM )
{
- if (m_printData.GetFilename() == wxT(""))
+ if (m_printData.GetFilename() == wxEmptyString)
{
wxString filename = wxGetTempFileName( wxT("ps") );
m_printData.SetFilename(filename);
if (!m_pstream)
{
wxLogError( _("Cannot open file for PostScript printing!"));
- m_ok = FALSE;
- return FALSE;
+ m_ok = false;
+ return false;
}
}
- m_ok = TRUE;
+ m_ok = true;
m_title = message;
PsPrint( "%!PS-Adobe-2.0\n" );
wxPageNumber = 1;
m_pageNumber = 1;
- return TRUE;
+ return true;
}
void wxPostScriptDC::EndDoc ()
if (m_clipping)
{
- m_clipping = FALSE;
+ m_clipping = false;
PsPrint( "grestore\n" );
}
command += wxT(" ");
command += m_printData.GetFilename();
- wxExecute( command, TRUE );
+ wxExecute( command, true );
wxRemoveFile( m_printData.GetFilename() );
}
#endif
wxCoord xsrc, wxCoord ysrc,
int rop, bool WXUNUSED(useMask), wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask) )
{
- wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
+ wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") );
- wxCHECK_MSG( source, FALSE, wxT("invalid source dc") );
+ wxCHECK_MSG( source, false, wxT("invalid source dc") );
/* blit into a bitmap */
wxBitmap bitmap( (int)fwidth, (int)fheight );
/* draw bitmap. scaling and positioning is done there */
DrawBitmap( bitmap, xdest, ydest );
- return TRUE;
+ return true;
}
wxCoord wxPostScriptDC::GetCharHeight() const
/
/ example:
/
- / wxPostScriptDC dc(NULL, TRUE);
+ / wxPostScriptDC dc(NULL, true);
/ if (dc.Ok()){
/ wxSetAFMPath("d:\\wxw161\\afm\\");
/ dc.StartDoc("Test");
{
wxInitializePrintSetupData();
- return TRUE;
+ return true;
}
void wxPostScriptModule::OnExit()
{
- wxInitializePrintSetupData(FALSE);
+ wxInitializePrintSetupData(false);
}
#endif
// WXWIN_COMPATIBILITY_2_2
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
- if ( rc == 0){
+ if ( rc == 0)
+ {
size_t i = 0;
while (i < 26)
{
- if (ulDriveMap & ( 1 << i ))
- {
- wxString path, name;
- path.Printf(wxT("%c:\\"), 'A' + i);
- name.Printf(wxT("%c:"), 'A' + i);
-
- int imageId;
- if (path == wxT("A:\\") || path == wxT("B:\\"))
- imageId = wxFileIconsTable::floppy;
- else
- imageId = wxFileIconsTable::drive;
- paths.Add(path);
- names.Add(name);
- icon_ids.Add(imageId);
- }
+ if (ulDriveMap & ( 1 << i ))
+ {
+ wxString path, name;
+ path.Printf(wxT("%c:\\"), 'A' + i);
+ name.Printf(wxT("%c:"), 'A' + i);
+
+ int imageId;
+ if (path == wxT("A:\\") || path == wxT("B:\\"))
+ imageId = wxFileIconsTable::floppy;
+ else
+ imageId = wxFileIconsTable::drive;
+ paths.Add(path);
+ names.Add(name);
+ icon_ids.Add(imageId);
+ }
i ++;
- }
- }
+ }
+ }
#else // !__WIN32__, !__OS2__
int drive;
CFStringRef cfstr = CFStringCreateWithCharacters( kCFAllocatorDefault,
volumeName.unicode,
volumeName.length );
- // Do something with str
+ // Do something with str
char *cstr = NewPtr(CFStringGetLength(cfstr) + 1);
if (( cstr == NULL ) ||
!CFStringGetCString(cfstr, cstr, CFStringGetLength(cfstr) + 1,
if ( dirName.Len() == 3 && dirName[1u] == wxT(':') )
{
wxString dirNameLower(dirName.Lower());
- // VS: always return TRUE for removable media, since Win95 doesn't
+ // VS: always return true for removable media, since Win95 doesn't
// like it when MS-DOS app accesses empty floppy drive
return (dirNameLower[0u] == wxT('a') ||
dirNameLower[0u] == wxT('b') ||
}
else
#endif
- return TRUE;
+ return true;
}
#elif defined(__WINDOWS__) || defined(__OS2__)
(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1)
return _chdrive(drive);
#else
- wxChar newdrive[4];
+ wxChar newdrive[4];
- if (drive < 1 || drive > 31)
- return -1;
- newdrive[0] = (wxChar)(wxT('A') + drive - 1);
- newdrive[1] = wxT(':');
+ if (drive < 1 || drive > 31)
+ return -1;
+ newdrive[0] = (wxChar)(wxT('A') + drive - 1);
+ newdrive[1] = wxT(':');
#ifdef __OS2__
- newdrive[2] = wxT('\\');
- newdrive[3] = wxT('\0');
+ newdrive[2] = wxT('\\');
+ newdrive[3] = wxT('\0');
#else
- newdrive[2] = wxT('\0');
+ newdrive[2] = wxT('\0');
#endif
#if defined(__WXMSW__)
- if (::SetCurrentDirectory(newdrive))
+ if (::SetCurrentDirectory(newdrive))
#else
// VA doesn't know what LPSTR is and has its own set
- if (!DosSetCurrentDir((PSZ)newdrive))
+ if (!DosSetCurrentDir((PSZ)newdrive))
#endif
- return 0;
- else
- return -1;
+ return 0;
+ else
+ return -1;
#endif // !GNUWIN32
}
bool wxIsDriveAvailable(const wxString& dirName)
{
#ifdef __WXWINCE__
- return FALSE;
+ return false;
#else
#ifdef __WIN32__
UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
#endif
- bool success = TRUE;
+ bool success = true;
// Check if this is a root directory and if so,
// whether the drive is available.
if (err == -1)
{
- success = FALSE;
+ success = false;
}
#endif
}
* In UnixLand we just check whether the first char is a dot
* For FileNameFromPath read LastDirNameInThisPath ;-) */
// m_isHidden = (bool)(wxFileNameFromPath(*m_path)[0] == '.');
- m_isHidden = FALSE;
- m_isExpanded = FALSE;
+ m_isHidden = false;
+ m_isExpanded = false;
m_isDir = isDir;
}
bool wxDirItemData::HasSubDirs() const
{
if (m_path.IsEmpty())
- return FALSE;
+ return false;
wxDir dir;
{
wxLogNull nolog;
if ( !dir.Open(m_path) )
- return FALSE;
+ return false;
}
return dir.HasSubDirs();
bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const
{
if (m_path.IsEmpty())
- return FALSE;
+ return false;
wxDir dir;
{
wxLogNull nolog;
if ( !dir.Open(m_path) )
- return FALSE;
+ return false;
}
return dir.HasFiles();
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl)
wxHIDE_PROPERTY( Children )
- wxPROPERTY( DefaultPath , wxString , SetDefaultPath , GetDefaultPath , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Filter , wxString , SetFilter , GetFilter , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( DefaultFilter , int , SetFilterIndex, GetFilterIndex, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ wxPROPERTY( DefaultPath , wxString , SetDefaultPath , GetDefaultPath , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Filter , wxString , SetFilter , GetFilter , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ wxPROPERTY( DefaultFilter , int , SetFilterIndex, GetFilterIndex, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
wxPROPERTY_FLAGS( WindowStyle, wxGenericDirCtrlStyle, long, SetWindowStyleFlag, GetWindowStyleFlag, EMPTY_MACROVALUE , 0, wxT("Helpstring"), wxT("group") )
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxGenericDirCtrl)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_8( wxGenericDirCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , DefaultPath ,
- wxPoint , Position , wxSize , Size , long , WindowStyle , wxString , Filter , int , DefaultFilter )
+wxCONSTRUCTOR_8( wxGenericDirCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , DefaultPath ,
+ wxPoint , Position , wxSize , Size , long , WindowStyle , wxString , Filter , int , DefaultFilter )
#else
IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrl, wxControl)
#endif
const wxString& name)
{
if (!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name))
- return FALSE;
+ return false;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
m_treeCtrl->SetImageList(wxTheFileIconsTable->GetSmallImageList());
- m_showHidden = FALSE;
- wxDirItemData* rootData = new wxDirItemData(wxT(""), wxT(""), TRUE);
+ m_showHidden = false;
+ wxDirItemData* rootData = new wxDirItemData(wxEmptyString, wxEmptyString, true);
wxString rootName;
SetBestSize(size);
DoResize();
- return TRUE;
+ return true;
}
wxGenericDirCtrl::~wxGenericDirCtrl()
void wxGenericDirCtrl::Init()
{
- m_showHidden = FALSE;
+ m_showHidden = false;
m_currentFilter = 0;
m_currentFilterStr = wxEmptyString; // Default: any file
m_treeCtrl = NULL;
const wxTreeItemId
wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
{
- wxDirItemData *dir_item = new wxDirItemData(path,name,TRUE);
+ wxDirItemData *dir_item = new wxDirItemData(path,name,true);
wxTreeItemId id = AppendItem( m_rootId, name, imageId, -1, dir_item);
if (!data->m_isExpanded)
return;
- data->m_isExpanded = FALSE;
+ data->m_isExpanded = false;
wxTreeItemIdValue cookie;
/* Workaround because DeleteChildren has disapeared (why?) and
* CollapseAndReset doesn't work as advertised (deletes parent too) */
if (data->m_isExpanded)
return;
- data->m_isExpanded = TRUE;
+ data->m_isExpanded = true;
if (parentId == m_treeCtrl->GetRootItem())
{
// whether the drive is avaiable.
if (!wxIsDriveAvailable(dirName))
{
- data->m_isExpanded = FALSE;
+ data->m_isExpanded = false;
//wxMessageBox(wxT("Sorry, this drive is not available."));
return;
}
path += wxString(wxFILE_SEP_PATH);
path += eachFilename;
- wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,TRUE);
+ wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,true);
wxTreeItemId id = AppendItem( parentId, eachFilename,
wxFileIconsTable::folder, -1, dir_item);
m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open,
path += wxString(wxFILE_SEP_PATH);
path += eachFilename;
//path = dirName + wxString(wxT("/")) + eachFilename;
- wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,FALSE);
+ wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,false);
int image_id = wxFileIconsTable::file;
if (eachFilename.Find(wxT('.')) != wxNOT_FOUND)
image_id = wxTheFileIconsTable->GetIconID(eachFilename.AfterLast(wxT('.')));
if (childPath == path3)
{
if (path3.Len() == path2.Len())
- done = TRUE;
+ done = true;
else
- done = FALSE;
+ done = false;
return childId;
}
}
// and select the given tree item.
bool wxGenericDirCtrl::ExpandPath(const wxString& path)
{
- bool done = FALSE;
+ bool done = false;
wxTreeItemId id = FindChild(m_rootId, path, done);
wxTreeItemId lastId = id; // The last non-zero id
while (id.IsOk() && !done)
// Find the first file in this directory
wxTreeItemIdValue cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
- bool selectedChild = FALSE;
+ bool selectedChild = false;
while (childId.IsOk())
{
wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
- if (data && data->m_path != wxT("") && !data->m_isDir)
+ if (data && data->m_path != wxEmptyString && !data->m_isDir)
{
m_treeCtrl->SelectItem(childId);
m_treeCtrl->EnsureVisible(childId);
- selectedChild = TRUE;
+ selectedChild = true;
break;
}
childId = m_treeCtrl->GetNextChild(lastId, cookie);
m_treeCtrl->EnsureVisible(lastId);
}
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
wxString wxGenericDirCtrl::GetPath() const
{
filter = filters[n];
description = descriptions[n];
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#if WXWIN_COMPATIBILITY_2_4
// correct control height to always be returned, rather
// than the drop-down list height which is sometimes returned.
wxSize oldSize = m_filterListCtrl->GetSize();
- m_filterListCtrl->SetSize(-1, -1, oldSize.x+10, -1, wxSIZE_USE_EXISTING);
- m_filterListCtrl->SetSize(-1, -1, oldSize.x, -1, wxSIZE_USE_EXISTING);
+ m_filterListCtrl->SetSize(wxDefaultPosition.x,
+ wxDefaultPosition.y,
+ oldSize.x+10,
+ wxDefaultSize.y,
+ wxSIZE_USE_EXISTING);
+ m_filterListCtrl->SetSize(wxDefaultPosition.x,
+ wxDefaultPosition.y,
+ oldSize.x,
+ wxDefaultSize.y,
+ wxSIZE_USE_EXISTING);
#endif
filterSz = m_filterListCtrl->GetSize();
sz.y -= (filterSz.y + verticalSpacing);
}
wxTreeItemId wxGenericDirCtrl::AppendItem (const wxTreeItemId & parent,
- const wxString & text,
- int image, int selectedImage,
- wxTreeItemData * data)
+ const wxString & text,
+ int image, int selectedImage,
+ wxTreeItemData * data)
{
wxTreeCtrl *treeCtrl = GetTreeCtrl ();
IMPLEMENT_CLASS(wxDirFilterListCtrl, wxChoice)
BEGIN_EVENT_TABLE(wxDirFilterListCtrl, wxChoice)
- EVT_CHOICE(-1, wxDirFilterListCtrl::OnSelFilter)
+ EVT_CHOICE(wxID_ANY, wxDirFilterListCtrl::OnSelFilter)
END_EVENT_TABLE()
bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, const wxWindowID id,
DECLARE_DYNAMIC_CLASS(wxFileIconsTableModule)
public:
wxFileIconsTableModule() {}
- bool OnInit() { wxTheFileIconsTable = new wxFileIconsTable; return TRUE; }
+ bool OnInit() { wxTheFileIconsTable = new wxFileIconsTable; return true; }
void OnExit()
{
if (wxTheFileIconsTable)
static wxBitmap CreateAntialiasedBitmap(const wxImage& img)
{
const unsigned int size = 16;
-
+
wxImage smallimg (size, size);
unsigned char *p1, *p2, *ps;
unsigned char mr = img.GetMaskRed(),
}
p1 += size*2 * 3, p2 += size*2 * 3;
}
-
+
return wxBitmap(smallimg);
}
bool empt;
#define MK_DTTMP(x,y) dttmp = dt + ((x + y * w) * 3)
-#define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = FALSE; break;}
+#define NOEMPTY_PIX(empt) if (dttmp[0] != mr || dttmp[1] != mg || dttmp[2] != mb) {empt = false; break;}
- for (empt = TRUE, top = 0; empt && top < h; top++)
+ for (empt = true, top = 0; empt && top < h; top++)
{
MK_DTTMP(0, top);
for (i = 0; i < w; i++, dttmp+=3)
NOEMPTY_PIX(empt)
}
- for (empt = TRUE, bottom = h-1; empt && bottom > top; bottom--)
+ for (empt = true, bottom = h-1; empt && bottom > top; bottom--)
{
MK_DTTMP(0, bottom);
for (i = 0; i < w; i++, dttmp+=3)
NOEMPTY_PIX(empt)
}
- for (empt = TRUE, left = 0; empt && left < w; left++)
+ for (empt = true, left = 0; empt && left < w; left++)
{
MK_DTTMP(left, 0);
for (i = 0; i < h; i++, dttmp+=3*w)
NOEMPTY_PIX(empt)
}
- for (empt = TRUE, right = w-1; empt && right > left; right--)
+ for (empt = true, right = w-1; empt && right > left; right--)
{
MK_DTTMP(right, 0);
for (i = 0; i < h; i++, dttmp+=3*w)
ic = wxIcon( iconLoc.GetFileName() );
}
}
-
+
delete ft;
if ( !ic.Ok() )
}
const unsigned int size = 16;
-
+
int id = m_smallImageList->GetImageCount();
if ((bmp.GetWidth() == (int) size) && (bmp.GetHeight() == (int) size))
{
EVT_BUTTON (wxID_OK, wxGenericDirDialog::OnOK)
EVT_BUTTON (ID_NEW, wxGenericDirDialog::OnNew)
EVT_BUTTON (ID_GO_HOME, wxGenericDirDialog::OnGoHome)
- EVT_TREE_KEY_DOWN (-1, wxGenericDirDialog::OnTreeKeyDown)
- EVT_TREE_SEL_CHANGED (-1, wxGenericDirDialog::OnTreeSelected)
+ EVT_TREE_KEY_DOWN (wxID_ANY, wxGenericDirDialog::OnTreeKeyDown)
+ EVT_TREE_SEL_CHANGED (wxID_ANY, wxGenericDirDialog::OnTreeSelected)
EVT_TEXT_ENTER (ID_TEXTCTRL, wxGenericDirDialog::OnOK)
EVT_CHECKBOX (ID_SHOW_HIDDEN, wxGenericDirDialog::OnShowHidden)
END_EVENT_TABLE()
wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
const wxString& defaultPath, long style,
- const wxPoint& pos, const wxSize& sz,
+ const wxPoint& pos, const wxSize& sz,
const wxString& name):
wxDialog(parent, ID_DIRCTRL, title, pos, sz, style, name)
{
// VS: 'Home directory' concept is unknown to MS-DOS
#ifndef __DOS__
- wxBitmapButton* homeButton =
+ wxBitmapButton* homeButton =
new wxBitmapButton(this, ID_GO_HOME,
wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_CMN_DIALOG));
buttonsizer->Add( homeButton, 0, wxLEFT|wxRIGHT, 10 );
#endif
-
+
// I'm not convinced we need a New button, and we tend to get annoying
// accidental-editing with label editing enabled.
if (style & wxDD_NEW_DIR_BUTTON)
{
- wxBitmapButton* newButton =
+ wxBitmapButton* newButton =
new wxBitmapButton(this, ID_NEW,
wxArtProvider::GetBitmap(wxART_NEW_DIR, wxART_CMN_DIALOG));
buttonsizer->Add( newButton, 0, wxRIGHT, 10 );
#if wxUSE_TOOLTIPS
newButton->SetToolTip(_("Create new directory"));
-#endif
+#endif
}
#if wxUSE_TOOLTIPS
topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 );
// 1) dir ctrl
- m_dirCtrl = NULL; // this is neccessary, event handler called from
+ m_dirCtrl = NULL; // this is neccessary, event handler called from
// wxGenericDirCtrl would crash otherwise!
long dirStyle = wxDIRCTRL_DIR_ONLY|wxSUNKEN_BORDER;
-
+
#ifdef __WXMSW__
if (style & wxDD_NEW_DIR_BUTTON)
{
// before we can call EditLabel (required for "New directory")
dirStyle |= wxDIRCTRL_EDIT_LABELS;
}
-#endif
+#endif
m_dirCtrl = new wxGenericDirCtrl(this, ID_DIRCTRL,
m_path, wxPoint(5, 5),
- wxSize(300, 200),
+ wxSize(300, 200),
dirStyle);
topsizer->Add( m_dirCtrl, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 );
#if wxUSE_STATLINE
// 3) Static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 4) Buttons
buttonsizer = new wxBoxSizer( wxHORIZONTAL );
-
+
// OK and Cancel button should be at the right bottom
wxButton* okButton = new wxButton(this, wxID_OK, _("OK"));
buttonsizer->Add( okButton, 0, wxLEFT|wxRIGHT, 10 );
okButton->SetDefault();
m_dirCtrl->SetFocus();
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
}
// Interact with user, find out if the dir is a typo or to be created
wxString msg;
- msg.Printf(_("The directory '%s' does not exist\nCreate it now?"),
+ msg.Printf(_("The directory '%s' does not exist\nCreate it now?"),
m_path.c_str());
- wxMessageDialog dialog(this, msg, _("Directory does not exist"),
+ wxMessageDialog dialog(this, msg, _("Directory does not exist"),
wxYES_NO | wxICON_WARNING);
if ( dialog.ShowModal() == wxID_YES ) {
}
else {
// Trouble...
- msg.Printf(_("Failed to create directory '%s'\n(Do you have the required permissions?)"),
+ msg.Printf(_("Failed to create directory '%s'\n(Do you have the required permissions?)"),
m_path.c_str());
wxMessageDialog errmsg(this, msg, _("Error creating directory"), wxOK | wxICON_ERROR);
errmsg.ShowModal();
return;
}
- wxDirItemData *new_data = new wxDirItemData( path, new_name, TRUE );
+ wxDirItemData *new_data = new wxDirItemData( path, new_name, true );
// TODO: THIS CODE DOESN'T WORK YET. We need to avoid duplication of the first child
// of the parent.
void wxGenericDragImage::Init()
{
- m_isDirty = FALSE;
- m_isShown = FALSE;
+ m_isDirty = false;
+ m_isShown = false;
m_windowDC = (wxDC*) NULL;
m_window = (wxWindow*) NULL;
- m_fullScreen = FALSE;
+ m_fullScreen = false;
m_pBackingBitmap = (wxBitmap*) NULL;
}
{
m_cursor = cursor;
- return TRUE;
+ return true;
}
// Create a drag image from a bitmap and optional cursor
m_cursor = cursor;
m_bitmap = image;
- return TRUE ;
+ return true ;
}
// Create a drag image from an icon and optional cursor
m_cursor = cursor;
m_icon = image;
- return TRUE ;
+ return true ;
}
// Create a drag image from a string and optional cursor
if (rect)
m_boundingRect = * rect;
- m_isDirty = FALSE;
- m_isDirty = FALSE;
+ m_isDirty = false;
+ m_isDirty = false;
if (window)
{
m_boundingRect.width, m_boundingRect.height);
}
- return TRUE;
+ return true;
}
// Begin drag. hotspot is the location of the drag position relative to the upper-left
int x = fullScreenRect->GetPosition().x;
int y = fullScreenRect->GetPosition().y;
-
+
wxSize sz = fullScreenRect->GetSize();
if (fullScreenRect->GetParent() && !fullScreenRect->IsKindOf(CLASSINFO(wxFrame)))
rect.x = x; rect.y = y;
rect.width = sz.x; rect.height = sz.y;
- return BeginDrag(hotspot, window, TRUE, & rect);
+ return BeginDrag(hotspot, window, true, & rect);
}
// End drag
m_repairBitmap = wxNullBitmap;
- return TRUE;
+ return true;
}
// Move the image: call from OnMouseMove. Pt is in window client coordinates if window
wxPoint oldPos = m_position;
bool eraseOldImage = (m_isDirty && m_isShown);
-
+
if (m_isShown)
- RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, TRUE);
+ RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, true);
m_position = pt2;
if (m_isShown)
- m_isDirty = TRUE;
+ m_isDirty = true;
- return TRUE;
+ return true;
}
bool wxGenericDragImage::Show()
{
wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Show()") );
-
+
// Show at the current position
if (!m_isShown)
//memDC.Blit(0, 0, m_boundingRect.width, m_boundingRect.height, m_windowDC, m_boundingRect.x, m_boundingRect.y);
memDC.SelectObject(wxNullBitmap);
- RedrawImage(m_position - m_offset, m_position - m_offset, FALSE, TRUE);
+ RedrawImage(m_position - m_offset, m_position - m_offset, false, true);
}
- m_isShown = TRUE;
- m_isDirty = TRUE;
+ m_isShown = true;
+ m_isDirty = true;
- return TRUE;
+ return true;
}
bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
if (m_isShown && m_isDirty)
{
- RedrawImage(m_position - m_offset, m_position - m_offset, TRUE, FALSE);
+ RedrawImage(m_position - m_offset, m_position - m_offset, true, false);
}
- m_isShown = FALSE;
- m_isDirty = FALSE;
+ m_isShown = false;
+ m_isDirty = false;
- return TRUE;
+ return true;
}
// More efficient: erase and redraw simultaneously if possible
bool eraseOld, bool drawNew)
{
if (!m_windowDC)
- return FALSE;
+ return false;
wxBitmap* backing = (m_pBackingBitmap ? m_pBackingBitmap : (wxBitmap*) & m_backingBitmap);
if (!backing->Ok())
- return FALSE;
+ return false;
wxRect oldRect(GetImageRect(oldPos));
wxRect newRect(GetImageRect(newPos));
memDCTemp.SelectObject(wxNullBitmap);
memDC.SelectObject(wxNullBitmap);
- return TRUE;
+ return true;
}
// Override this if you are using a virtual image (drawing your own image)
if (m_bitmap.Ok())
{
dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0));
- return TRUE;
+ return true;
}
else if (m_icon.Ok())
{
dc.DrawIcon(m_icon, pos.x, pos.y);
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
// Override this if you are using a virtual image (drawing your own image)
const wxString& title,
int style)
{
- if ( !wxDialog::Create(parent, -1, title,
+ if ( !wxDialog::Create(parent, wxID_ANY, title,
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | style) )
{
- return FALSE;
+ return false;
}
SetData(data);
- wxCHECK_MSG( m_FindReplaceData, FALSE,
+ wxCHECK_MSG( m_FindReplaceData, false,
_T("can't create dialog without data") );
wxBoxSizer *leftsizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer *sizer2Col = new wxFlexGridSizer(3);
sizer2Col->AddGrowableCol(2);
- sizer2Col->Add(new wxStaticText(this, -1, _("Search for:"),
- wxDefaultPosition, wxSize(80, -1)),
+ sizer2Col->Add(new wxStaticText(this, wxID_ANY, _("Search for:"),
+ wxDefaultPosition, wxSize(80, wxDefaultSize.y)),
0,
wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT);
sizer2Col->Add(10, 0);
- m_textFind = new wxTextCtrl(this, -1, m_FindReplaceData->GetFindString());
+ m_textFind = new wxTextCtrl(this, wxID_ANY, m_FindReplaceData->GetFindString());
sizer2Col->Add(m_textFind, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
if ( style & wxFR_REPLACEDIALOG )
{
- sizer2Col->Add(new wxStaticText(this, -1, _("Replace with:"),
- wxDefaultPosition, wxSize(80, -1)),
+ sizer2Col->Add(new wxStaticText(this, wxID_ANY, _("Replace with:"),
+ wxDefaultPosition, wxSize(80, wxDefaultSize.y)),
0,
wxALIGN_CENTRE_VERTICAL |
wxALIGN_RIGHT | wxTOP, 5);
sizer2Col->Add(10, 0);
- m_textRepl = new wxTextCtrl(this, -1,
+ m_textRepl = new wxTextCtrl(this, wxID_ANY,
m_FindReplaceData->GetReplaceString());
sizer2Col->Add(m_textRepl, 1,
wxALIGN_CENTRE_VERTICAL | wxEXPAND | wxTOP, 5);
wxBoxSizer *chksizer = new wxBoxSizer( wxVERTICAL);
- m_chkWord = new wxCheckBox(this, -1, _("Whole word"));
+ m_chkWord = new wxCheckBox(this, wxID_ANY, _("Whole word"));
chksizer->Add(m_chkWord, 0, wxALL, 3);
- m_chkCase = new wxCheckBox(this, -1, _("Match case"));
+ m_chkCase = new wxCheckBox(this, wxID_ANY, _("Match case"));
chksizer->Add(m_chkCase, 0, wxALL, 3);
optsizer->Add(chksizer, 0, wxALL, 10);
static const wxString searchDirections[] = {_("Up"), _("Down")};
- m_radioDir = new wxRadioBox(this, -1, _("Search direction"),
+ m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(searchDirections), searchDirections);
int flags = m_FindReplaceData->GetFlags();
if ( flags & wxFR_MATCHCASE )
- m_chkCase->SetValue(TRUE);
+ m_chkCase->SetValue(true);
if ( flags & wxFR_WHOLEWORD )
- m_chkWord->SetValue(TRUE);
+ m_chkWord->SetValue(true);
m_radioDir->SetSelection( flags & wxFR_DOWN );
if ( style & wxFR_NOMATCHCASE )
- m_chkCase->Enable(FALSE);
+ m_chkCase->Enable(false);
if ( style & wxFR_NOWHOLEWORD )
- m_chkWord->Enable(FALSE);
+ m_chkWord->Enable(false);
if ( style & wxFR_NOUPDOWN)
- m_radioDir->Enable(FALSE);
+ m_radioDir->Enable(false);
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
m_textFind->SetFocus();
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
SendEvent(wxEVT_COMMAND_FIND_CLOSE);
- Show(FALSE);
+ Show(false);
}
void wxGenericFindReplaceDialog::OnUpdateFindUI(wxUpdateUIEvent &event)
// try to get a better icon
if (m_image == wxFileIconsTable::file)
{
- if (m_fileName.Find(wxT('.'), TRUE) != wxNOT_FOUND)
- {
+ if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
+ {
m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.')));
- } else if (IsExe())
- {
+ } else if (IsExe())
+ {
m_image = wxFileIconsTable::executable;
- }
+ }
}
m_size = buff.st_size;
return _("<LINK>");
else if (IsDrive())
return _("<DRIVE>");
- else if (m_fileName.Find(wxT('.'), TRUE) != wxNOT_FOUND)
+ else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
return m_fileName.AfterLast(wxT('.'));
return wxEmptyString;
IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl)
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
- EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem)
- EVT_LIST_DELETE_ALL_ITEMS(-1, wxFileCtrl::OnListDeleteAllItems)
- EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit)
- EVT_LIST_COL_CLICK(-1, wxFileCtrl::OnListColClick)
+ EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileCtrl::OnListDeleteItem)
+ EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileCtrl::OnListDeleteAllItems)
+ EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileCtrl::OnListEndLabelEdit)
+ EVT_LIST_COL_CLICK(wxID_ANY, wxFileCtrl::OnListColClick)
END_EVENT_TABLE()
wxFileCtrl::wxFileCtrl()
{
- m_showHidden = FALSE;
+ m_showHidden = false;
m_sort_foward = 1;
m_sort_field = wxFileData::FileList_Name;
}
if (!m_dirName.IsEmpty())
{
if (m_dirName.Last() == wxT('.'))
- m_dirName = wxT("");
+ m_dirName = wxEmptyString;
}
#elif defined(__UNIX__)
if (m_dirName.IsEmpty())
END_EVENT_TABLE()
long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
-bool wxGenericFileDialog::ms_lastShowHidden = FALSE;
+bool wxGenericFileDialog::ms_lastShowHidden = false;
wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
const wxString& message,
const wxPoint& pos )
:wxFileDialogBase(parent, message, defaultDir, defaultFile, wildCard, style, pos)
{
- wxDialog::Create( parent, -1, message, pos, wxDefaultSize,
+ wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
- if (wxConfig::Get(FALSE))
+ if (wxConfig::Get(false))
{
wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ViewStyle"),
&ms_lastViewStyle);
wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
if (is_pda)
- staticsizer->Add( new wxStaticText( this, -1, _("Current directory:") ), 0, wxRIGHT, 10 );
- m_static = new wxStaticText( this, -1, m_dir );
+ staticsizer->Add( new wxStaticText( this, wxID_ANY, _("Current directory:") ), 0, wxRIGHT, 10 );
+ m_static = new wxStaticText( this, wxID_ANY, m_dir );
staticsizer->Add( m_static, 1 );
mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
}
SetFilterIndex( 0 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( mainsizer );
mainsizer->Fit( this );
wxGenericFileDialog::~wxGenericFileDialog()
{
- if (wxConfig::Get(FALSE))
+ if (wxConfig::Get(false))
{
wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"),
ms_lastViewStyle);
GetEventHandler()->ProcessEvent( cevent );
}
-static bool ignoreChanges = FALSE;
+static bool ignoreChanges = false;
void wxGenericFileDialog::OnTextChange( wxCommandEvent &WXUNUSED(event) )
{
dir += filename;
if (wxDirExists(dir)) return;
- ignoreChanges = TRUE;
+ ignoreChanges = true;
m_text->SetValue( filename );
- ignoreChanges = FALSE;
+ ignoreChanges = false;
}
void wxGenericFileDialog::HandleAction( const wxString &fn )
{
if (m_control)
{
- m_control->PopEventHandler(TRUE /* delete it*/);
+ m_control->PopEventHandler(true /* delete it*/);
m_control->Destroy();
m_control = NULL;
wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!"));
- bool changed = FALSE;
+ bool changed = false;
wxString value = Text()->GetValue();
if (value != m_startValue)
- changed = TRUE;
+ changed = true;
if (changed)
grid->GetTable()->SetValue(row, col, value);
case WXK_NUMPAD_DECIMAL:
case WXK_DIVIDE:
case WXK_NUMPAD_DIVIDE:
- return TRUE;
+ return true;
default:
// accept 8 bit chars too if isprint() agrees
if ( (keycode < 255) && (wxIsprint(keycode)) )
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void wxGridCellTextEditor::StartingKey(wxKeyEvent& event)
if ( HasRange() )
{
// create a spin ctrl
- m_control = new wxSpinCtrl(parent, -1, wxEmptyString,
+ m_control = new wxSpinCtrl(parent, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
m_min, m_max);
case WXK_NUMPAD_SUBTRACT:
case WXK_UP:
case WXK_DOWN:
- return TRUE;
+ return true;
default:
if ( (keycode < 128) && wxIsdigit(keycode) )
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
else
grid->GetTable()->SetValue(row, col, text);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxGridCellFloatEditor::Reset()
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
- bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) ==
+ bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| is_decimal_point
case WXK_NUMPAD_SUBTRACT:
case WXK_DECIMAL:
case WXK_NUMPAD_DECIMAL:
- return TRUE;
+ return true;
- default:
+ default:
{
// additionally accept 'e' as in '1e+6', also '-', '+', and '.'
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
bool is_decimal_point =
- ( wxString(tmpbuf, *wxConvCurrent) ==
+ ( wxString(tmpbuf, *wxConvCurrent) ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) &&
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
is_decimal_point || keycode == '+' || keycode == '-') )
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
#endif // wxUSE_TEXTCTRL
void wxGridCellBoolEditor::SetSize(const wxRect& r)
{
- bool resize = FALSE;
+ bool resize = false;
wxSize size = m_control->GetSize();
wxCoord minSize = wxMin(r.width, r.height);
// reset to default size if it had been made smaller
size = sizeBest;
- resize = TRUE;
+ resize = true;
}
if ( size.x >= minSize || size.y >= minSize )
// leave 1 pixel margin
size.x = size.y = minSize - 2;
- resize = TRUE;
+ resize = true;
}
if ( resize )
wxASSERT_MSG(m_control,
wxT("The wxGridCellEditor must be Created first!"));
- bool changed = FALSE;
+ bool changed = false;
bool value = CBox()->GetValue();
if ( value != m_startValue )
- changed = TRUE;
+ changed = true;
if ( changed )
{
case WXK_SPACE:
case '+':
case '-':
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// return the value as "1" for true and the empty string for false
int i, c_cols, c_rows;
for (i = col+cell_cols; i < cols; i++)
{
- bool is_empty = TRUE;
+ bool is_empty = true;
for (int j=row; j<row+cell_rows; j++)
{
// check w/ anchor cell for multicell block
if (c_rows > 0) c_rows = 0;
if (!grid.GetTable()->IsEmptyCell(j+c_rows, i))
{
- is_empty = FALSE;
+ is_empty = false;
break;
}
}
if ( table->CanGetValueAs(row, col, wxGRID_VALUE_FLOAT) )
{
val = table->GetValueAsDouble(row, col);
- hasDouble = TRUE;
+ hasDouble = true;
}
else
{
if ( !ms_sizeCheckMark.x )
{
// get checkbox size
- wxCheckBox *checkbox = new wxCheckBox(&grid, -1, wxEmptyString);
+ wxCheckBox *checkbox = new wxCheckBox(&grid, wxID_ANY, wxEmptyString);
wxSize size = checkbox->GetBestSize();
wxCoord checkSize = size.y + 2*wxGRID_CHECKMARK_MARGIN;
// use the default attr provider by default
SetAttrProvider(new wxGridCellAttrProvider);
}
- return TRUE;
+ return true;
}
wxGridCellAttr *wxGridTableBase::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind)
{
wxFAIL_MSG( wxT("Called grid table class function InsertRows\nbut your derived table class does not override this function") );
- return FALSE;
+ return false;
}
bool wxGridTableBase::AppendRows( size_t WXUNUSED(numRows) )
{
wxFAIL_MSG( wxT("Called grid table class function AppendRows\nbut your derived table class does not override this function"));
- return FALSE;
+ return false;
}
bool wxGridTableBase::DeleteRows( size_t WXUNUSED(pos),
{
wxFAIL_MSG( wxT("Called grid table class function DeleteRows\nbut your derived table class does not override this function"));
- return FALSE;
+ return false;
}
bool wxGridTableBase::InsertCols( size_t WXUNUSED(pos),
{
wxFAIL_MSG( wxT("Called grid table class function InsertCols\nbut your derived table class does not override this function"));
- return FALSE;
+ return false;
}
bool wxGridTableBase::AppendCols( size_t WXUNUSED(numCols) )
{
wxFAIL_MSG(wxT("Called grid table class function AppendCols\nbut your derived table class does not override this function"));
- return FALSE;
+ return false;
}
bool wxGridTableBase::DeleteCols( size_t WXUNUSED(pos),
{
wxFAIL_MSG( wxT("Called grid table class function DeleteCols\nbut your derived table class does not override this function"));
- return FALSE;
+ return false;
}
bool wxGridTableBase::GetValueAsBool( int WXUNUSED(row), int WXUNUSED(col) )
{
- return FALSE;
+ return false;
}
void wxGridTableBase::SetValueAsLong( int WXUNUSED(row), int WXUNUSED(col),
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
bool wxGridStringTable::AppendRows( size_t numRows )
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows )
(unsigned long)curNumRows
) );
- return FALSE;
+ return false;
}
if ( numRows > curNumRows - pos )
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
bool wxGridStringTable::InsertCols( size_t pos, size_t numCols )
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
bool wxGridStringTable::AppendCols( size_t numCols )
// TODO: something better than this ?
//
wxFAIL_MSG( wxT("Unable to append cols to a grid table with no rows.\nCall AppendRows() first") );
- return FALSE;
+ return false;
}
#endif
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
(unsigned long)numCols,
(unsigned long)curNumCols
) );
- return FALSE;
+ return false;
}
if ( numCols > curNumCols - pos )
GetView()->ProcessTableMessage( msg );
}
- return TRUE;
+ return true;
}
wxString wxGridStringTable::GetRowLabelValue( int row )
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
m_minAcceptableColWidth, \
- m_colRights, m_numCols, TRUE)
+ m_colRights, m_numCols, true)
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
m_minAcceptableRowHeight, \
- m_rowBottoms, m_numRows, TRUE)
+ m_rowBottoms, m_numRows, true)
/////////////////////////////////////////////////////////////////////
#if wxUSE_EXTENDED_RTTI
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_HANDLERS_TABLE(wxGrid)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_5( wxGrid , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_5( wxGrid , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
/*
TODO : Expose more information of a list's layout etc. via appropriate objects (à la NotebookPageInfo)
{
if (!wxScrolledWindow::Create(parent, id, pos, size,
style | wxWANTS_CHARS , name))
- return FALSE;
+ return false;
m_colMinWidths = wxLongToLongHashMap(GRID_HASH_SIZE) ;
m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE) ;
Create() ;
- return TRUE;
+ return true;
}
void wxGrid::Create()
{
- m_created = FALSE; // set to TRUE by CreateGrid
+ m_created = false; // set to true by CreateGrid
m_table = (wxGridTableBase *) NULL;
- m_ownTable = FALSE;
+ m_ownTable = false;
- m_cellEditCtrlEnabled = FALSE;
+ m_cellEditCtrlEnabled = false;
m_defaultCellAttr = new wxGridCellAttr();
m_defaultCellAttr->SetTextColour(gva.colFg);
m_defaultCellAttr->SetBackgroundColour(gva.colBg);
-
+
#else
m_defaultCellAttr->SetTextColour(
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
// subwindow components that make up the wxGrid
m_cornerLabelWin = new wxGridCornerLabelWindow( this,
- -1,
+ wxID_ANY,
wxDefaultPosition,
wxDefaultSize );
m_rowLabelWin = new wxGridRowLabelWindow( this,
- -1,
+ wxID_ANY,
wxDefaultPosition,
wxDefaultSize );
m_colLabelWin = new wxGridColLabelWindow( this,
- -1,
+ wxID_ANY,
wxDefaultPosition,
wxDefaultSize );
m_gridWin = new wxGridWindow( this,
m_rowLabelWin,
m_colLabelWin,
- -1,
+ wxID_ANY,
wxDefaultPosition,
wxDefaultSize );
m_gridWin->SetDefaultForegroundColour(gfg);
m_gridWin->SetDefaultBackgroundColour(gbg);
-
+
Init();
}
wxGrid::wxGridSelectionModes selmode )
{
wxCHECK_MSG( !m_created,
- FALSE,
+ false,
wxT("wxGrid::CreateGrid or wxGrid::SetTable called more than once") );
m_numRows = numRows;
m_table = new wxGridStringTable( m_numRows, m_numCols );
m_table->SetView( this );
- m_ownTable = TRUE;
+ m_ownTable = true;
m_selection = new wxGridSelection( this, selmode );
CalcDimensions();
- m_created = TRUE;
+ m_created = true;
return m_created;
}
if ( m_created )
{
// stop all processing
- m_created = FALSE;
+ m_created = false;
if (m_ownTable)
{
m_table = table;
m_table->SetView( this );
if (takeOwnership)
- m_ownTable = TRUE;
+ m_ownTable = true;
m_selection = new wxGridSelection( this, selmode );
CalcDimensions();
- m_created = TRUE;
+ m_created = true;
}
return m_created;
#endif
m_gridLineColour = wxColour( 192,192,192 );
- m_gridLinesEnabled = TRUE;
+ m_gridLinesEnabled = true;
m_cellHighlightColour = *wxBLACK;
m_cellHighlightPenWidth = 2;
m_cellHighlightROPenWidth = 1;
m_cursorMode = WXGRID_CURSOR_SELECT_CELL;
m_winCapture = (wxWindow *)NULL;
- m_canDragRowSize = TRUE;
- m_canDragColSize = TRUE;
- m_canDragGridSize = TRUE;
+ m_canDragRowSize = true;
+ m_canDragColSize = true;
+ m_canDragGridSize = true;
m_dragLastPos = -1;
m_dragRowOrCol = -1;
- m_isDragging = FALSE;
+ m_isDragging = false;
m_startDragPos = wxDefaultPosition;
- m_waitForSlowClick = FALSE;
+ m_waitForSlowClick = false;
m_rowResizeCursor = wxCursor( wxCURSOR_SIZENS );
m_colResizeCursor = wxCursor( wxCURSOR_SIZEWE );
m_selectionBackground = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
m_selectionForeground = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
- m_editable = TRUE; // default for whole grid
+ m_editable = true; // default for whole grid
- m_inOnKeyDown = FALSE;
+ m_inOnKeyDown = false;
m_batchCount = 0;
m_extraWidth =
bool wxGrid::Redimension( wxGridTableMessage& msg )
{
int i;
- bool result = FALSE;
+ bool result = false;
// Clear the attribute cache as the attribute might refer to a different
// cell than stored in the cache after adding/removing rows/columns.
m_rowLabelWin->Refresh();
}
}
- result = TRUE;
+ result = true;
break;
case wxGRIDTABLE_NOTIFY_ROWS_APPENDED:
m_rowLabelWin->Refresh();
}
}
- result = TRUE;
+ result = true;
break;
case wxGRIDTABLE_NOTIFY_ROWS_DELETED:
m_rowLabelWin->Refresh();
}
}
- result = TRUE;
+ result = true;
break;
case wxGRIDTABLE_NOTIFY_COLS_INSERTED:
}
}
- result = TRUE;
+ result = true;
break;
case wxGRIDTABLE_NOTIFY_COLS_APPENDED:
m_colLabelWin->Refresh();
}
}
- result = TRUE;
+ result = true;
break;
case wxGRIDTABLE_NOTIFY_COLS_DELETED:
m_colLabelWin->Refresh();
}
}
- result = TRUE;
+ result = true;
break;
}
{
if (!m_isDragging)
{
- m_isDragging = TRUE;
+ m_isDragging = true;
m_rowLabelWin->CaptureMouse();
}
if (m_isDragging)
{
if (m_rowLabelWin->HasCapture()) m_rowLabelWin->ReleaseMouse();
- m_isDragging = FALSE;
+ m_isDragging = false;
}
// ------------ Entering or leaving the window
{
row = YToRow(y);
if ( row >=0 &&
- !SendEvent( wxEVT_GRID_LABEL_LEFT_DCLICK, row, -1, event ) )
- {
+ !SendEvent( wxEVT_GRID_LABEL_LEFT_DCLICK, row, -1, event ) )
+ {
// no default action at the moment
- }
+ }
}
else
{
{
row = YToRow(y);
if ( row >=0 &&
- !SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, row, -1, event ) )
+ !SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, row, -1, event ) )
{
// no default action at the moment
}
{
row = YToRow(y);
if ( row >= 0 &&
- !SendEvent( wxEVT_GRID_LABEL_RIGHT_DCLICK, row, -1, event ) )
+ !SendEvent( wxEVT_GRID_LABEL_RIGHT_DCLICK, row, -1, event ) )
{
// no default action at the moment
}
{
// don't capture the mouse yet
if ( CanDragRowSize() )
- ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin, FALSE);
+ ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin, false);
}
}
else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
{
- ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_rowLabelWin, FALSE);
+ ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_rowLabelWin, false);
}
}
}
{
if (!m_isDragging)
{
- m_isDragging = TRUE;
+ m_isDragging = true;
m_colLabelWin->CaptureMouse();
}
if (m_isDragging)
{
if (m_colLabelWin->HasCapture()) m_colLabelWin->ReleaseMouse();
- m_isDragging = FALSE;
+ m_isDragging = false;
}
// ------------ Entering or leaving the window
if ( col >= 0 &&
! SendEvent( wxEVT_GRID_LABEL_LEFT_DCLICK, -1, col, event ) )
{
- // no default action at the moment
+ // no default action at the moment
}
}
else
{
col = XToCol(x);
if ( col >= 0 &&
- !SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, -1, col, event ) )
+ !SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, -1, col, event ) )
{
// no default action at the moment
}
{
col = XToCol(x);
if ( col >= 0 &&
- !SendEvent( wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, col, event ) )
+ !SendEvent( wxEVT_GRID_LABEL_RIGHT_DCLICK, -1, col, event ) )
{
// no default action at the moment
}
{
// don't capture the cursor yet
if ( CanDragColSize() )
- ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin, FALSE);
+ ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL, m_colLabelWin, false);
}
}
else if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
{
- ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin, FALSE);
+ ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin, false);
}
}
}
return;
}
- m_isDragging = TRUE;
+ m_isDragging = true;
if ( m_cursorMode == WXGRID_CURSOR_SELECT_CELL )
{
// Hide the edit control, so it
return;
}
- m_isDragging = FALSE;
+ m_isDragging = false;
m_startDragPos = wxDefaultPosition;
// VZ: if we do this, the mode is reset to WXGRID_CURSOR_SELECT_CELL
editor->DecRef();
attr->DecRef();
- m_waitForSlowClick = FALSE;
+ m_waitForSlowClick = false;
}
else if ( m_selectingTopLeft != wxGridNoCellCoords &&
m_selectingBottomRight != wxGridNoCellCoords )
CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
rect.width = m_rowLabelWidth;
rect.height = ch - rect.y;
- m_rowLabelWin->Refresh( TRUE, &rect );
+ m_rowLabelWin->Refresh( true, &rect );
rect.width = cw;
// if there is a multicell block, paint all of it
if (m_table)
rect.height = ch - rect.y;
}
}
- m_gridWin->Refresh( FALSE, &rect );
+ m_gridWin->Refresh( false, &rect );
}
ShowCellEditControl();
CalcScrolledPosition(rect.x, 0, &rect.x, &dummy);
rect.width = cw - rect.x;
rect.height = m_colLabelHeight;
- m_colLabelWin->Refresh( TRUE, &rect );
+ m_colLabelWin->Refresh( true, &rect );
rect.height = ch;
// if there is a multicell block, paint all of it
if (m_table)
rect.width = cw - rect.x;
}
}
- m_gridWin->Refresh( FALSE, &rect );
+ m_gridWin->Refresh( false, &rect );
}
ShowCellEditControl();
return Redimension( msg );
default:
- return FALSE;
+ return false;
}
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the insert row
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the append row
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the delete row
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the insert col
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the append col
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
if ( !m_created )
{
wxFAIL_MSG( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") );
- return FALSE;
+ return false;
}
if ( m_table )
// the table will have sent the results of the delete col
// operation to this view object as a grid table message
}
- return FALSE;
+ return false;
}
this,
m_selectingTopLeft,
m_selectingBottomRight,
- TRUE,
+ true,
mouseEv.ControlDown(),
mouseEv.ShiftDown(),
mouseEv.AltDown(),
row, col,
mouseEv.GetX() + GetRowLabelSize(),
mouseEv.GetY() + GetColLabelSize(),
- FALSE,
+ false,
mouseEv.ControlDown(),
mouseEv.ShiftDown(),
mouseEv.AltDown(),
wxFAIL_MSG( wxT("wxGrid::OnKeyDown called while already active") );
}
- m_inOnKeyDown = TRUE;
+ m_inOnKeyDown = true;
// propagate the event up and see if it gets processed
//
{
if ( GetGridCursorCol() > 0 )
{
- MoveCursorLeft( FALSE );
+ MoveCursorLeft( false );
}
else
{
{
if ( GetGridCursorCol() < GetNumberCols()-1 )
{
- MoveCursorRight( FALSE );
+ MoveCursorRight( false );
}
else
{
}
if ( !IsEditable() )
{
- MoveCursorRight( FALSE );
+ MoveCursorRight( false );
break;
}
// Otherwise fall through to default
}
}
- m_inOnKeyDown = FALSE;
+ m_inOnKeyDown = false;
}
void wxGrid::OnKeyUp( wxKeyEvent& event )
m_selectingBottomRight.GetRow(),
m_selectingBottomRight.GetCol(),
event.ControlDown(),
- TRUE,
+ true,
event.AltDown(),
event.MetaDown() );
}
{
DisableCellEditControl();
- if ( IsVisible( m_currentCellCoords, FALSE ) )
+ if ( IsVisible( m_currentCellCoords, false ) )
{
wxRect r;
r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords);
wxRect rect;
rect = BlockToDeviceRect( wxGridCellCoords ( topRow, leftCol ),
wxGridCellCoords ( bottomRow, rightCol ) );
- m_gridWin->Refresh( FALSE, &rect );
+ m_gridWin->Refresh( false, &rect );
}
// Now handle changing an existing selection area.
else if ( m_selectingTopLeft != updateTopLeft ||
need_refresh[0] =
need_refresh[1] =
need_refresh[2] =
- need_refresh[3] = FALSE;
+ need_refresh[3] = false;
int i;
// Store intermediate values
{
// Refresh the newly selected or deselected
// area to the left of the old or new selection.
- need_refresh[0] = TRUE;
+ need_refresh[0] = true;
rect[0] = BlockToDeviceRect( wxGridCellCoords ( oldTop,
oldLeft ),
wxGridCellCoords ( oldBottom,
{
// Refresh the newly selected or deselected
// area above the old or new selection.
- need_refresh[1] = TRUE;
+ need_refresh[1] = true;
rect[1] = BlockToDeviceRect( wxGridCellCoords ( oldTop,
leftCol ),
wxGridCellCoords ( topRow - 1,
{
// Refresh the newly selected or deselected
// area to the right of the old or new selection.
- need_refresh[2] = TRUE;
+ need_refresh[2] = true;
rect[2] = BlockToDeviceRect( wxGridCellCoords ( oldTop,
rightCol + 1 ),
wxGridCellCoords ( oldBottom,
{
// Refresh the newly selected or deselected
// area below the old or new selection.
- need_refresh[3] = TRUE;
+ need_refresh[3] = true;
rect[3] = BlockToDeviceRect( wxGridCellCoords ( bottomRow + 1,
leftCol ),
wxGridCellCoords ( oldBottom,
// various Refresh() calls
for (i = 0; i < 4; i++ )
if ( need_refresh[i] && rect[i] != wxGridNoCellRect )
- m_gridWin->Refresh( FALSE, &(rect[i]) );
+ m_gridWin->Refresh( false, &(rect[i]) );
}
// Change Selection
m_selectingTopLeft = updateTopLeft;
// all we need to do is repaint the grid
//
m_gridWin->Refresh();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if ( cell_rows <= 0 || cell_cols <= 0 )
{
wxGridCellCoords cell(row+cell_rows, col+cell_cols);
- bool marked = FALSE;
+ bool marked = false;
for ( int j = 0; j < numCells; j++ )
{
if ( cell == cells[j] )
{
- marked = TRUE;
+ marked = true;
break;
}
}
{
if ( cell == redrawCells[j] )
{
- marked = TRUE;
+ marked = true;
break;
}
}
if (GetCellOverflow(row+l, j))
{
wxGridCellCoords cell(row+l, j);
- bool marked = FALSE;
+ bool marked = false;
for (int k = 0; k < numCells; k++)
{
if ( cell == cells[k] )
{
- marked = TRUE;
+ marked = true;
break;
}
}
{
if ( cell == redrawCells[k] )
{
- marked = TRUE;
+ marked = true;
break;
}
}
{
return m_editable && (m_currentCellCoords != wxGridNoCellCoords) &&
!IsCurrentCellReadOnly();
-
+
}
bool wxGrid::IsCellEditControlEnabled() const
{
// the cell edit control might be disable for all cells or just for the
// current one if it's read only
- return m_cellEditCtrlEnabled ? !IsCurrentCellReadOnly() : FALSE;
+ return m_cellEditCtrlEnabled ? !IsCurrentCellReadOnly() : false;
}
bool wxGrid::IsCellEditControlShown() const
{
- bool isShown = FALSE;
+ bool isShown = false;
if ( m_cellEditCtrlEnabled )
{
{
if ( !IsVisible( m_currentCellCoords ) )
{
- m_cellEditCtrlEnabled = FALSE;
+ m_cellEditCtrlEnabled = false;
return;
}
else
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
if ( !editor->IsCreated() )
{
- editor->Create(m_gridWin, -1,
+ editor->Create(m_gridWin, wxID_ANY,
new wxGridCellEditorEvtHandler(this, editor));
wxGridEditorCreatedEvent evt(GetId(),
editor->SetCellAttr(attr);
editor->SetSize( rect );
- editor->Show( TRUE, attr );
+ editor->Show( true, attr );
// recalc dimensions in case we need to
// expand the scrolled window to account for editor
wxGridCellAttr* attr = GetCellAttr(row, col);
wxGridCellEditor *editor = attr->GetEditor(this, row, col);
- editor->Show( FALSE );
+ editor->Show( false );
editor->DecRef();
attr->DecRef();
m_gridWin->SetFocus();
wxRect rect( CellToRect(row, col) );
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y );
rect.width = m_gridWin->GetClientSize().GetWidth() - rect.x;
- m_gridWin->Refresh( FALSE, &rect );
+ m_gridWin->Refresh( false, &rect );
}
}
int wxGrid::YToRow( int y )
{
return CoordToRowOrCol(y, m_defaultRowHeight,
- m_minAcceptableRowHeight, m_rowBottoms, m_numRows, FALSE);
+ m_minAcceptableRowHeight, m_rowBottoms, m_numRows, false);
}
int wxGrid::XToCol( int x )
{
return CoordToRowOrCol(x, m_defaultColWidth,
- m_minAcceptableColWidth, m_colRights, m_numCols, FALSE);
+ m_minAcceptableColWidth, m_colRights, m_numCols, false);
}
m_currentCellCoords.GetCol() );
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
- return FALSE;
+ return false;
}
m_currentCellCoords.GetCol() );
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
- return FALSE;
+ return false;
}
m_currentCellCoords.GetCol() - 1 );
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
- return FALSE;
+ return false;
}
m_currentCellCoords.GetCol() + 1 );
}
else
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MovePageUp()
{
- if ( m_currentCellCoords == wxGridNoCellCoords ) return FALSE;
+ if ( m_currentCellCoords == wxGridNoCellCoords ) return false;
int row = m_currentCellCoords.GetRow();
if ( row > 0 )
if ( newRow == row )
{
- //row > 0 , so newrow can never be less than 0 here.
+ //row > 0 , so newrow can never be less than 0 here.
newRow = row - 1;
}
MakeCellVisible( newRow, m_currentCellCoords.GetCol() );
SetCurrentCell( newRow, m_currentCellCoords.GetCol() );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MovePageDown()
{
- if ( m_currentCellCoords == wxGridNoCellCoords ) return FALSE;
+ if ( m_currentCellCoords == wxGridNoCellCoords ) return false;
int row = m_currentCellCoords.GetRow();
if ( (row+1) < m_numRows )
if ( newRow == row )
{
// row < m_numRows , so newrow can't overflow here.
- newRow = row + 1;
+ newRow = row + 1;
}
MakeCellVisible( newRow, m_currentCellCoords.GetCol() );
SetCurrentCell( newRow, m_currentCellCoords.GetCol() );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MoveCursorUpBlock( bool expandSelection )
ClearSelection();
SetCurrentCell( row, col );
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MoveCursorDownBlock( bool expandSelection )
SetCurrentCell( row, col );
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MoveCursorLeftBlock( bool expandSelection )
SetCurrentCell( row, col );
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGrid::MoveCursorRightBlock( bool expandSelection )
SetCurrentCell( row, col );
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
{
if ( width == 0 )
{
- m_rowLabelWin->Show( FALSE );
- m_cornerLabelWin->Show( FALSE );
+ m_rowLabelWin->Show( false );
+ m_cornerLabelWin->Show( false );
}
else if ( m_rowLabelWidth == 0 )
{
- m_rowLabelWin->Show( TRUE );
- if ( m_colLabelHeight > 0 ) m_cornerLabelWin->Show( TRUE );
+ m_rowLabelWin->Show( true );
+ if ( m_colLabelHeight > 0 ) m_cornerLabelWin->Show( true );
}
m_rowLabelWidth = width;
CalcWindowSizes();
- wxScrolledWindow::Refresh( TRUE );
+ wxScrolledWindow::Refresh( true );
}
}
{
if ( height == 0 )
{
- m_colLabelWin->Show( FALSE );
- m_cornerLabelWin->Show( FALSE );
+ m_colLabelWin->Show( false );
+ m_cornerLabelWin->Show( false );
}
else if ( m_colLabelHeight == 0 )
{
- m_colLabelWin->Show( TRUE );
- if ( m_rowLabelWidth > 0 ) m_cornerLabelWin->Show( TRUE );
+ m_colLabelWin->Show( true );
+ if ( m_rowLabelWidth > 0 ) m_cornerLabelWin->Show( true );
}
m_colLabelHeight = height;
CalcWindowSizes();
- wxScrolledWindow::Refresh( TRUE );
+ wxScrolledWindow::Refresh( true );
}
}
}
}
-// Note: under MSW, the default column label font must be changed because it
-// does not support vertical printing
+// Note: under MSW, the default column label font must be changed because it
+// does not support vertical printing
//
// Example: wxFont font(9, wxSWISS, wxNORMAL, wxBOLD);
-// pGrid->SetLabelFont(font);
-// pGrid->SetColLabelTextOrientation(wxVERTICAL);
+// pGrid->SetLabelFont(font);
+// pGrid->SetColLabelTextOrientation(wxVERTICAL);
//
void wxGrid::SetColLabelTextOrientation( int textOrientation )
{
CalcScrolledPosition(0, rect.y, &rect.x, &rect.y);
rect.x = 0;
rect.width = m_rowLabelWidth;
- m_rowLabelWin->Refresh( TRUE, &rect );
+ m_rowLabelWin->Refresh( true, &rect );
}
}
}
CalcScrolledPosition(rect.x, 0, &rect.x, &rect.y);
rect.y = 0;
rect.height = m_colLabelHeight;
- m_colLabelWin->Refresh( TRUE, &rect );
+ m_colLabelWin->Refresh( true, &rect );
}
}
}
if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 )
return;
wxRect rect = CellToRect(row, col);
- m_gridWin->Refresh(TRUE, &rect);
+ m_gridWin->Refresh(true, &rect);
}
}
if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 )
return;
wxRect rect = CellToRect(row, col);
- m_gridWin->Refresh(TRUE, &rect);
+ m_gridWin->Refresh(true, &rect);
}
}
{
if ( !m_table )
{
- return FALSE;
+ return false;
}
return m_table->CanHaveAttributes();
gs_nAttrCacheHits++;
#endif
- return TRUE;
+ return true;
}
else
{
#ifdef DEBUG_ATTR_CACHE
gs_nAttrCacheMisses++;
#endif
- return FALSE;
+ return false;
}
}
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
wxCHECK_MSG( m_table, attr,
- _T("we may only be called if CanHaveAttributes() returned TRUE and then m_table should be !NULL") );
+ _T("we may only be called if CanHaveAttributes() returned true and then m_table should be !NULL") );
attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell);
if ( !attr )
CalcScrolledPosition(rect.x, 0, &rect.x, &dummy);
rect.width = cw - rect.x;
rect.height = m_colLabelHeight;
- m_colLabelWin->Refresh( TRUE, &rect );
+ m_colLabelWin->Refresh( true, &rect );
}
}
else
CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
rect.width = m_rowLabelWidth;
rect.height = ch - rect.y;
- m_rowLabelWin->Refresh( TRUE, &rect );
+ m_rowLabelWin->Refresh( true, &rect );
}
}
if ( setAsMin )
{
BeginBatch();
- wxSize size(SetOrCalcColumnSizes(FALSE), SetOrCalcRowSizes(FALSE));
+ wxSize size(SetOrCalcColumnSizes(false), SetOrCalcRowSizes(false));
// round up the size to a multiple of scroll step - this ensures that we
// won't get the scrollbars if we're sized exactly to this width
wxGrid *self = (wxGrid *)this; // const_cast
int width, height;
- width = self->SetOrCalcColumnSizes(TRUE);
- height = self->SetOrCalcRowSizes(TRUE);
+ width = self->SetOrCalcColumnSizes(true);
+ height = self->SetOrCalcRowSizes(true);
int maxwidth, maxheight;
wxDisplaySize( & maxwidth, & maxheight );
rect.x = 0;
rect.width = m_gridWin->GetClientSize().GetWidth();
CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
- m_gridWin->Refresh( FALSE, &rect );
+ m_gridWin->Refresh( false, &rect );
}
if ( m_currentCellCoords.GetRow() == row &&
ClearSelection();
if ( m_selection )
- m_selection->SelectRow( row, FALSE, addToSelected );
+ m_selection->SelectRow( row, false, addToSelected );
}
ClearSelection();
if ( m_selection )
- m_selection->SelectCol( col, FALSE, addToSelected );
+ m_selection->SelectCol( col, false, addToSelected );
}
if ( m_selection )
m_selection->SelectBlock( topRow, leftCol, bottomRow, rightCol,
- FALSE, addToSelected );
+ false, addToSelected );
}
{
wxGridTableBase *table = grid.GetTable();
- bool hasDatetime = FALSE;
+ bool hasDatetime = false;
wxDateTime val;
wxString text;
if ( table->CanGetValueAs(row, col, wxGRID_VALUE_DATETIME) )
if (tempval){
val = *((wxDateTime *)tempval);
- hasDatetime = TRUE;
+ hasDatetime = true;
delete (wxDateTime *)tempval;
}
dc.SetFont(attr.GetFont());
wxStringTokenizer tk(data , _T(" \n\t\r"));
- wxString thisline(wxT(""));
+ wxString thisline = wxEmptyString;
while ( tk.HasMoreTokens() )
{
{
wxGridCellCoords& coords = m_cellSelection[n];
if ( row == coords.GetRow() && col == coords.GetCol() )
- return TRUE;
+ return true;
}
}
if ( BlockContainsCell(coords1.GetRow(), coords1.GetCol(),
coords2.GetRow(), coords2.GetCol(),
row, col ) )
- return TRUE;
+ return true;
}
// Now check whether the given cell is
for ( size_t n = 0; n < count; n++ )
{
if ( row == m_rowSelection[n] )
- return TRUE;
+ return true;
}
}
for ( size_t n = 0; n < count; n++ )
{
if ( col == m_colSelection[n] )
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// Change the selection mode
m_blockSelectionBottomRight.RemoveAt(n);
SelectBlock( topRow, 0,
bottomRow, m_grid->GetNumberCols() - 1,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
}
else // selmode == wxGridSelectColumns)
m_blockSelectionBottomRight.RemoveAt(n);
SelectBlock( 0, leftCol,
m_grid->GetNumberRows() - 1, rightCol,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
}
}
// Simplify list of selected blocks (if possible)
count = m_blockSelectionTopLeft.GetCount();
- bool done = FALSE;
+ bool done = false;
for ( n = 0; n < count; n++ )
{
wxGridCellCoords& coords1 = m_blockSelectionTopLeft[n];
else if ( coords1.GetRow() == row + 1)
{
coords1.SetRow(row);
- done = TRUE;
+ done = true;
}
else if ( coords2.GetRow() == row - 1)
{
coords2.SetRow(row);
- done = TRUE;
+ done = true;
}
}
}
{
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
// Send Event
m_grid,
wxGridCellCoords( row, 0 ),
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ),
- TRUE,
+ true,
ControlDown, ShiftDown,
AltDown, MetaDown );
// Simplify list of selected blocks (if possible)
count = m_blockSelectionTopLeft.GetCount();
- bool done = FALSE;
+ bool done = false;
for ( n = 0; n < count; n++ )
{
wxGridCellCoords& coords1 = m_blockSelectionTopLeft[n];
else if ( coords1.GetCol() == col + 1)
{
coords1.SetCol(col);
- done = TRUE;
+ done = true;
}
else if ( coords2.GetCol() == col - 1)
{
coords2.SetCol(col);
- done = TRUE;
+ done = true;
}
}
}
{
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
// Send Event
m_grid,
wxGridCellCoords( 0, col ),
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ),
- TRUE,
+ true,
ControlDown, ShiftDown,
AltDown, MetaDown );
{
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( topRow, leftCol ),
wxGridCellCoords( bottomRow, rightCol ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
// Send Event, if not disabled.
m_grid,
wxGridCellCoords( topRow, leftCol ),
wxGridCellCoords( bottomRow, rightCol ),
- TRUE,
+ true,
ControlDown, ShiftDown,
AltDown, MetaDown );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
{
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, col ),
wxGridCellCoords( row, col ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
// Send event
m_grid,
wxGridCellCoords( row, col ),
wxGridCellCoords( row, col ),
- TRUE,
+ true,
ControlDown, ShiftDown,
AltDown, MetaDown);
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
if ( !m_grid->GetBatchCount() )
{
wxRect r = m_grid->BlockToDeviceRect( coords, coords );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
// Send event
m_grid,
wxGridCellCoords( row, col ),
wxGridCellCoords( row, col ),
- FALSE,
+ false,
ControlDown, ShiftDown,
AltDown, MetaDown );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
{
if ( topRow < row )
SelectBlock( topRow, leftCol, row - 1, rightCol,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
if ( bottomRow > row )
SelectBlock( row + 1, leftCol, bottomRow, rightCol,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
if ( m_selectionMode != wxGrid::wxGridSelectRows )
{
if ( leftCol < col )
SelectBlock( row, leftCol, row, col - 1,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
if ( rightCol > col )
SelectBlock( row, col + 1, row, rightCol,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
}
}
{
if ( col > 0 )
SelectBlock( row, 0, row, col - 1,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
if ( col < m_grid->GetNumberCols() - 1 )
SelectBlock( row, col + 1,
row, m_grid->GetNumberCols() - 1,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
}
}
{
if ( row > 0 )
SelectBlock( 0, col, row - 1, col,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
if ( row < m_grid->GetNumberRows() - 1 )
SelectBlock( row + 1, col,
m_grid->GetNumberRows() - 1, col,
- FALSE, FALSE, FALSE, FALSE, FALSE );
+ false, false, false, false, false );
}
}
}
{
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, col ),
wxGridCellCoords( row, col ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
m_grid,
wxGridCellCoords( row, col ),
wxGridCellCoords( row, col ),
- FALSE,
+ false,
ControlDown, ShiftDown,
AltDown, MetaDown );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
{
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
m_grid,
wxGridCellCoords( row, 0 ),
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ),
- FALSE,
+ false,
ControlDown, ShiftDown,
AltDown, MetaDown );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
{
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
m_grid,
wxGridCellCoords( 0, col ),
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ),
- FALSE,
+ false,
ControlDown, ShiftDown,
AltDown, MetaDown );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
if ( !m_grid->GetBatchCount() )
{
r = m_grid->BlockToDeviceRect( coords1, coords1 );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
}
}
if ( !m_grid->GetBatchCount() )
{
r = m_grid->BlockToDeviceRect( coords1, coords2 );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
}
{
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
}
}
{
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
- ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r );
+ ((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
}
}
}
wxGridCellCoords( 0, 0 ),
wxGridCellCoords( m_grid->GetNumberRows() - 1,
m_grid->GetNumberCols() - 1 ),
- FALSE );
+ false );
m_grid->GetEventHandler()->ProcessEvent(gridEvt);
}
// return false;
// }
// else
- return TRUE;
+ return true;
#elif defined(__DOS__)
<< WXEXTHELP_SEPARATOR << relativeURL << wxT(")");
success = wxExecute(command);
if(success != 0 ) // returns PID on success
- return TRUE;
+ return true;
}
}
#endif
#endif
if(! wxDirExists(file))
- return FALSE;
+ return false;
mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
}
mapFile = m_MapFile;
if(! wxFileExists(mapFile))
- return FALSE;
+ return false;
DeleteList();
m_MapList = new wxList;
FILE *input = wxFopen(mapFile,wxT("rt"));
if(! input)
- return FALSE;
+ return false;
do
{
if(fgets(buffer,WXEXTHELP_BUFLEN,input) && *buffer != WXEXTHELP_COMMENTCHAR)
break; // error
for(i=0; isdigit(buffer[i])||isspace(buffer[i])||buffer[i]=='-'; i++)
; // find begin of URL
- url = wxT("");
+ url = wxEmptyString;
while(buffer[i] && ! isspace(buffer[i]) && buffer[i] !=
WXEXTHELP_COMMENTCHAR)
url << (wxChar) buffer[i++];
while(buffer[i] && buffer[i] != WXEXTHELP_COMMENTCHAR)
i++;
- doc = wxT("");
+ doc = wxEmptyString;
if(buffer[i])
doc = wxString::FromAscii( (buffer + i + 1) ); // skip the comment character
m_MapList->Append(new wxExtHelpMapEntry(id,url,doc));
fclose(input);
m_MapFile = file; // now it's valid
- return TRUE;
+ return true;
}
wxExtHelpController::DisplayContents()
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxString contents;
wxList::compatibility_iterator node = m_MapList->GetFirst();
node = node->GetNext();
}
- bool rc = FALSE;
+ bool rc = false;
wxString file;
file << m_MapFile << WXEXTHELP_SEPARATOR << contents;
if(file.Contains(wxT('#')))
rc = DisplaySection(CONTENTS_ID);
// if not found, open homemade toc:
- return rc ? TRUE : KeywordSearch(wxT(""));
+ return rc ? true : KeywordSearch(wxEmptyString);
}
bool
wxExtHelpController::DisplaySection(int sectionNo)
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxBusyCursor b; // display a busy cursor
wxList::compatibility_iterator node = m_MapList->GetFirst();
return DisplayHelp(entry->url);
node = node->GetNext();
}
- return FALSE;
+ return false;
}
bool wxExtHelpController::DisplaySection(const wxString& section)
wxHelpSearchMode WXUNUSED(mode))
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxString *choices = new wxString[m_NumOfEntries];
wxString *urls = new wxString[m_NumOfEntries];
// choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
//if(choices[idx].IsEmpty()) // didn't contain the ';'
// choices[idx] = (**i).doc;
- choices[idx] = wxT("");
+ choices[idx] = wxEmptyString;
for(j=0;entry->doc.c_str()[j]
&& entry->doc.c_str()[j] != WXEXTHELP_COMMENTCHAR; j++)
choices[idx] << entry->doc.c_str()[j];
else if(idx == 0)
{
wxMessageBox(_("No entries found."));
- rc = FALSE;
+ rc = false;
}
else
{
if(idx != -1)
rc = DisplayHelp(urls[idx]);
else
- rc = FALSE;
+ rc = false;
}
delete[] urls;
delete[] choices;
bool wxExtHelpController::Quit()
{
- return TRUE;
+ return true;
}
void wxExtHelpController::OnQuit()
bool wxGenericImageList::Create()
{
- return TRUE;
+ return true;
}
int wxGenericImageList::Add( const wxBitmap &bitmap )
{
wxList::compatibility_iterator node = m_images.Item( index );
- wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
+ wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap* newBitmap = (bitmap.IsKindOf(CLASSINFO(wxIcon))) ?
#if defined(__VISAGECPP__)
m_images.Insert( next, newBitmap );
}
- return TRUE;
+ return true;
}
bool wxGenericImageList::Remove( int index )
{
wxList::compatibility_iterator node = m_images.Item( index );
- wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
+ wxCHECK_MSG( node, false, wxT("wrong index in image list") );
delete node->GetData();
m_images.Erase( node );
- return TRUE;
+ return true;
}
bool wxGenericImageList::RemoveAll()
WX_CLEAR_LIST(wxList, m_images);
m_images.Clear();
- return TRUE;
+ return true;
}
bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
wxList::compatibility_iterator node = m_images.Item( index );
- wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
+ wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap *bm = (wxBitmap*)node->GetData();
width = bm->GetWidth();
height = bm->GetHeight();
- return TRUE;
+ return true;
}
bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
{
wxList::compatibility_iterator node = m_images.Item( index );
- wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
+ wxCHECK_MSG( node, false, wxT("wrong index in image list") );
wxBitmap *bm = (wxBitmap*)node->GetData();
else
dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );
- return TRUE;
+ return true;
}
// Make sure the sash is erased when the window is resized
if ((pos.x != thisRect.x || pos.y != thisRect.y || sz.x != thisRect.width || sz.y != thisRect.height) &&
(GetSashVisible(wxSASH_TOP) || GetSashVisible(wxSASH_RIGHT) || GetSashVisible(wxSASH_BOTTOM) || GetSashVisible(wxSASH_LEFT)))
- Refresh(TRUE);
+ Refresh(true);
}
clientWindow->SetSize(rect.x, rect.y, rect.width, rect.height);
- return TRUE;
+ return true;
}
#endif // wxUSE_MDI_ARCHITECTURE
// Find the last layout-aware window, so we can make it fill all remaining
// space.
- wxWindow *lastAwareWindow = NULL;
+ wxWindow *lastAwareWindow = NULL;
wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
while (node)
}
if (event.GetRect().GetWidth() < 0 || event.GetRect().GetHeight() < 0)
- return FALSE;
+ return false;
event.SetRect(rect);
lastAwareWindow->SetSize(rect.x, rect.y, wxMax(0, rect.width), wxMax(0, rect.height));
}
- return TRUE;
+ return true;
}
m_line = new wxStaticLine
(
this,
- -1,
+ wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
IsVertical() ? wxLI_HORIZONTAL : wxLI_VERTICAL
// 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);
+ // 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 );
+ void HighlightLines( size_t lineFrom, size_t lineTo, bool on = true );
// toggle the line state and refresh it
void ReverseHighlight( size_t line )
int GetTextLength( const wxString &s ) const;
void SetImageList( wxImageListType *imageList, int which );
- void SetItemSpacing( int spacing, bool isSmall = FALSE );
- int GetItemSpacing( bool isSmall = FALSE );
+ void SetItemSpacing( int spacing, bool isSmall = false );
+ int GetItemSpacing( bool isSmall = false );
void SetColumn( int col, wxListItem &item );
void SetColumnWidth( int col, int width );
}
// set the scrollbars and update the positions of the items
- void RecalculatePositions(bool noRefresh = FALSE);
+ void RecalculatePositions(bool noRefresh = false);
// refresh the window and the header
void RefreshAll();
void DeleteColumn( int col );
void DeleteEverything();
void EnsureVisible( long index );
- long FindItem( long start, const wxString& str, bool partial = FALSE );
+ long FindItem( long start, const wxString& str, bool partial = false );
long FindItem( long start, long data);
long HitTest( int x, int y, int &flags );
void InsertItem( wxListItem &item );
virtual bool SetFont(const wxFont& font)
{
if ( !wxScrolledWindow::SetFont(font) )
- return FALSE;
+ return false;
m_lineHeight = 0;
- return TRUE;
+ return true;
}
// these are for wxListLineData usage only
bool wxListItemData::IsHit( int x, int y ) const
{
- wxCHECK_MSG( m_rect, FALSE, _T("can't be called in this mode") );
+ wxCHECK_MSG( m_rect, false, _T("can't be called in this mode") );
return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Inside(x, y);
}
m_gi = new GeometryInfo;
}
- m_highlighted = FALSE;
+ m_highlighted = false;
InitItems( GetMode() == wxLC_REPORT ? m_owner->GetColumnCount() : 1 );
}
dc->SetPen( *wxTRANSPARENT_PEN );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxListLineData::Draw( wxDC *dc )
bool wxListLineData::Highlight( bool on )
{
- wxCHECK_MSG( !IsVirtual(), FALSE, _T("unexpected call to Highlight") );
+ wxCHECK_MSG( !IsVirtual(), false, _T("unexpected call to Highlight") );
if ( on == m_highlighted )
- return FALSE;
+ return false;
m_highlighted = on;
- return TRUE;
+ return true;
}
void wxListLineData::ReverseHighlight( void )
void wxListHeaderWindow::Init()
{
m_currentCursor = (wxCursor *) NULL;
- m_isDragging = FALSE;
- m_dirty = FALSE;
+ m_isDragging = false;
+ m_dirty = false;
}
wxListHeaderWindow::wxListHeaderWindow()
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
#if _USE_VISATTR
- wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
+ wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
SetDefaultForegroundColour( attr.colFg );
SetDefaultBackgroundColour( attr.colBg );
SetDefaultFont( attr.font );
dc.SetBackgroundMode(wxTRANSPARENT);
dc.SetTextForeground(GetForegroundColour());
-
+
int x = HEADER_OFFSET_X;
int numColumns = m_owner->GetColumnCount();
// for this we need the width of the text
wxCoord wLabel;
- wxCoord hLabel;
+ wxCoord hLabel;
dc.GetTextExtent(item.GetText(), &wLabel, &hLabel);
wLabel += 2*EXTRA_WIDTH;
if (event.ButtonUp())
{
ReleaseMouse();
- m_isDragging = FALSE;
- m_dirty = TRUE;
+ m_isDragging = false;
+ m_dirty = true;
m_owner->SetColumnWidth( m_column, m_currentX - m_minX );
SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG, event.GetPosition());
}
else // not dragging
{
m_minX = 0;
- bool hit_border = FALSE;
+ bool hit_border = false;
// end of the current column
int xpos = 0;
if ( (abs(x-xpos) < 3) && (y < 22) )
{
// near the column border
- hit_border = TRUE;
+ hit_border = true;
break;
}
if ( SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
event.GetPosition()) )
{
- m_isDragging = TRUE;
+ m_isDragging = true;
m_currentX = x;
CaptureMouse();
DrawCurrent();
m_itemEdited(itemEdit)
{
m_owner = owner;
- m_finished = FALSE;
+ m_finished = false;
wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
{
wxPendingDelete.Append(this);
- m_finished = TRUE;
+ m_finished = true;
m_owner->SetFocus();
}
if ( value == m_startValue )
{
// nothing changed, always accept
- return TRUE;
+ return true;
}
if ( !m_owner->OnRenameAccept(m_itemEdited, value) )
{
// vetoed by the user
- return FALSE;
+ return false;
}
// accepted, do rename the item
m_owner->SetItemText(m_itemEdited, value);
- return TRUE;
+ return true;
}
void wxListTextCtrl::OnChar( wxKeyEvent &event )
sx = parentSize.x - myPos.x;
if (mySize.x > sx)
sx = mySize.x;
- SetSize(sx, -1);
+ SetSize(sx, wxDefaultSize.y);
event.Skip();
}
void wxListMainWindow::Init()
{
- m_dirty = TRUE;
+ m_dirty = true;
m_countVirt = 0;
m_lineFrom =
m_lineTo = (size_t)-1;
m_small_spacing = 30;
m_normal_spacing = 40;
- m_hasFocus = FALSE;
+ m_hasFocus = false;
m_dragCount = 0;
- m_isCreated = FALSE;
+ m_isCreated = false;
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
m_renameTimer = new wxListRenameTimer( this );
m_current =
SetScrollbars( 0, 0, 0, 0, 0, 0 );
- wxVisualAttributes attr = wxGenericListCtrl::GetClassDefaultAttributes();
+ wxVisualAttributes attr = wxGenericListCtrl::GetClassDefaultAttributes();
SetDefaultForegroundColour( attr.colFg );
SetDefaultBackgroundColour( attr.colBg );
SetDefaultFont( attr.font );
else // !virtual
{
wxListLineData *ld = GetLine(line);
- wxCHECK_MSG( ld, FALSE, _T("invalid index in IsHighlighted") );
+ wxCHECK_MSG( ld, false, _T("invalid index in IsHighlighted") );
return ld->IsHighlighted();
}
else // !virtual
{
wxListLineData *ld = GetLine(line);
- wxCHECK_MSG( ld, FALSE, _T("invalid index in HighlightLine") );
+ wxCHECK_MSG( ld, false, _T("invalid index in HighlightLine") );
changed = ld->Highlight(highlight);
}
else // !report
{
// TODO: how to do it more efficiently?
- m_dirty = TRUE;
+ m_dirty = true;
}
}
// we just have one item to turn off
if ( HasCurrent() && IsHighlighted(m_current) )
{
- HighlightLine(m_current, FALSE);
+ HighlightLine(m_current, false);
RefreshLine(m_current);
}
}
le.m_itemIndex = itemEdit;
wxListLineData *data = GetLine(itemEdit);
- wxCHECK_MSG( data, FALSE, _T("invalid index in OnRenameAccept()") );
+ wxCHECK_MSG( data, false, _T("invalid index in OnRenameAccept()") );
data->GetItem( 0, le.m_item );
le.m_item.m_text = value;
// let owner know that the edit was cancelled
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
- le.SetEditCanceled(TRUE);
+ le.SetEditCanceled(true);
le.SetEventObject( GetParent() );
le.m_itemIndex = itemEdit;
return;
}
- bool forceClick = FALSE;
+ bool forceClick = false;
if (event.ButtonDClick())
{
m_renameTimer->Stop();
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
if ( current == m_lineLastClicked )
{
{
// the first click was on another item, so don't interpret this as
// a double click, but as a simple click instead
- forceClick = TRUE;
+ forceClick = true;
}
}
(hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
HasFlag(wxLC_EDIT_LABELS) )
{
- m_renameTimer->Start( 100, TRUE );
+ m_renameTimer->Start( 100, true );
}
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
}
else if (event.RightDown())
{
if ( IsSingleSel() || !(event.ControlDown() || event.ShiftDown()) )
{
- HighlightAll( FALSE );
+ HighlightAll( false );
ChangeCurrent(current);
{
// all previously selected items are unselected unless ctrl is held
if ( !event.ControlDown() )
- HighlightAll(FALSE);
+ HighlightAll(false);
ChangeCurrent(newCurrent);
-
+
// refresh the old focus to remove it
RefreshLine( oldCurrent );
if ( !event.ControlDown() )
{
- HighlightLine( m_current, TRUE );
+ HighlightLine( m_current, true );
}
}
-
+
RefreshLine( m_current );
MoveToFocus();
// it
if ( !m_hasFocus )
{
- m_hasFocus = TRUE;
+ m_hasFocus = true;
RefreshSelected();
}
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
return;
}
- m_hasFocus = FALSE;
+ m_hasFocus = false;
RefreshSelected();
}
void wxListMainWindow::SetImageList( wxImageListType *imageList, int which )
{
- m_dirty = TRUE;
+ m_dirty = true;
// calc the spacing from the icon size
int width = 0,
void wxListMainWindow::SetItemSpacing( int spacing, bool isSmall )
{
- m_dirty = TRUE;
+ m_dirty = true;
if (isSmall)
{
m_small_spacing = spacing;
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin )
- headerWin->m_dirty = TRUE;
+ headerWin->m_dirty = true;
- m_dirty = TRUE;
+ m_dirty = true;
// invalidate it as it has to be recalculated
m_headerWidth = 0;
wxCHECK_RET( InReportView(),
_T("SetColumnWidth() can only be called in report mode.") );
- m_dirty = TRUE;
+ m_dirty = true;
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin )
- headerWin->m_dirty = TRUE;
+ headerWin->m_dirty = true;
wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_RET( node, _T("no column?") );
{
if ( IsSingleSel() )
{
- HighlightLine(oldCurrent, FALSE);
+ HighlightLine(oldCurrent, false);
}
RefreshLine(oldCurrent);
// we must unselect the old current item as well or we
// might end up with more than one selected item in a
// single selection control
- HighlightLine(oldCurrent, FALSE);
+ HighlightLine(oldCurrent, false);
}
RefreshLine( oldCurrent );
if ( oldCurrent != (size_t)-1 )
{
- HighlightLine( oldCurrent, FALSE );
+ HighlightLine( oldCurrent, false );
RefreshLine( oldCurrent );
}
}
ResetVisibleLinesRange();
// scrollbars must be reset
- m_dirty = TRUE;
+ m_dirty = true;
}
int wxListMainWindow::GetSelectedItemCount() const
// deal with the quick case first
if ( IsSingleSel() )
{
- return HasCurrent() ? IsHighlighted(m_current) : FALSE;
+ return HasCurrent() ? IsHighlighted(m_current) : false;
}
// virtual controls remmebers all its selections itself
if ( m_dirty )
{
wxConstCast(this, wxListMainWindow)->
- RecalculatePositions(TRUE /* no refresh */);
+ RecalculatePositions(true /* no refresh */);
}
rect = GetLineRect((size_t)index);
pos.x = rect.x;
pos.y = rect.y;
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
(entireHeight + lineHeight - 1) / lineHeight,
GetScrollPos(wxHORIZONTAL),
GetScrollPos(wxVERTICAL),
- TRUE );
+ true );
}
else // !report
{
(y + lineHeight) / lineHeight,
GetScrollPos( wxHORIZONTAL ),
GetScrollPos( wxVERTICAL ),
- TRUE
+ true
);
}
else // "flowed" arrangement, the most complicated case
0,
GetScrollPos( wxHORIZONTAL ),
0,
- TRUE
+ true
);
}
}
void wxListMainWindow::RefreshAll()
{
- m_dirty = FALSE;
+ m_dirty = false;
Refresh();
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin && headerWin->m_dirty )
{
- headerWin->m_dirty = FALSE;
+ headerWin->m_dirty = false;
headerWin->Refresh();
}
}
}
// we need to refresh the (vert) scrollbar as the number of items changed
- m_dirty = TRUE;
+ m_dirty = true;
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM );
wxCHECK_RET( node, wxT("invalid column index in DeleteColumn()") );
- m_dirty = TRUE;
+ m_dirty = true;
delete node->GetData();
m_columns.Erase( node );
// been added and its position is not known yet
if ( m_dirty )
{
- RecalculatePositions(TRUE /* no refresh */);
+ RecalculatePositions(true /* no refresh */);
}
MoveToItem((size_t)index);
size_t id = item.m_itemId;
- m_dirty = TRUE;
+ m_dirty = true;
#if 0
// this is unused variable
m_lines.Insert( line, id );
- m_dirty = TRUE;
+ m_dirty = true;
// If an item is selected at or below the point of insertion, we need to
// increment the member variables because the current row's index has gone
void wxListMainWindow::InsertColumn( long col, wxListItem &item )
{
- m_dirty = TRUE;
+ m_dirty = true;
if ( InReportView() )
{
if (item.m_width == wxLIST_AUTOSIZE_USEHEADER)
list_ctrl_compare_func_2 = fn;
list_ctrl_compare_data = data;
m_lines.Sort( list_ctrl_compare_func_1 );
- m_dirty = TRUE;
+ m_dirty = true;
}
// ----------------------------------------------------------------------------
m_ownsImageListNormal =
m_ownsImageListSmall =
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight);
if ( HasHeader() )
- ResizeReportView(TRUE);
+ ResizeReportView(true);
}
}
}
{
m_headerWin = new wxListHeaderWindow
(
- this, -1, m_mainWin,
+ this, wxID_ANY, m_mainWin,
wxPoint(0, 0),
wxSize(GetClientSize().x, m_headerHeight),
wxTAB_TRAVERSAL
m_imageListState = (wxImageListType *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
}
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
- return FALSE;
+ return false;
// don't create the inner window with the border
style &= ~wxBORDER_MASK;
- m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style );
+ m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0,0), size, style );
#if defined( __WXMAC__ ) && __WXMAC_CARBON__
wxFont font ;
if ( HasFlag(wxLC_NO_HEADER) )
{
// VZ: why do we create it at all then?
- m_headerWin->Show( FALSE );
+ m_headerWin->Show( false );
}
}
SetBestSize(size);
-
- return TRUE;
+
+ return true;
}
void wxGenericListCtrl::SetSingleStyle( long style, bool add )
if ( m_headerWin )
{
// don't delete, just hide, as we can reuse it later
- m_headerWin->Show(FALSE);
+ m_headerWin->Show(false);
}
//else: nothing to do
}
}
else // already have it, just show
{
- m_headerWin->Show( TRUE );
+ m_headerWin->Show( true );
}
}
bool wxGenericListCtrl::GetColumn(int col, wxListItem &item) const
{
m_mainWin->GetColumn( col, item );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetColumn( int col, wxListItem& item )
{
m_mainWin->SetColumn( col, item );
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetColumnWidth( int col ) const
bool wxGenericListCtrl::SetColumnWidth( int col, int width )
{
m_mainWin->SetColumnWidth( col, width );
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetCountPerPage() const
bool wxGenericListCtrl::GetItem( wxListItem &info ) const
{
m_mainWin->GetItem( info );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItem( wxListItem &info )
{
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
long wxGenericListCtrl::SetItem( long index, int col, const wxString& label, int imageId )
info.m_mask |= wxLIST_MASK_IMAGE;
};
m_mainWin->SetItem(info);
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetItemState( long item, long stateMask ) const
bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask )
{
m_mainWin->SetItemState( item, state, stateMask );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
info.m_mask = wxLIST_MASK_IMAGE;
info.m_itemId = item;
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
wxString wxGenericListCtrl::GetItemText( long item ) const
info.m_itemId = item;
info.m_data = data;
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
wxRect wxGenericListCtrl::GetViewRect() const
m_mainWin->GetItemRect( item, rect );
if ( m_mainWin->HasHeader() )
rect.y += m_headerHeight + 1;
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::GetItemPosition( long item, wxPoint& pos ) const
{
m_mainWin->GetItemPosition( item, pos );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
{
if (m_ownsImageListNormal) delete m_imageListNormal;
m_imageListNormal = imageList;
- m_ownsImageListNormal = FALSE;
+ m_ownsImageListNormal = false;
}
else if ( which == wxIMAGE_LIST_SMALL )
{
if (m_ownsImageListSmall) delete m_imageListSmall;
m_imageListSmall = imageList;
- m_ownsImageListSmall = FALSE;
+ m_ownsImageListSmall = false;
}
else if ( which == wxIMAGE_LIST_STATE )
{
if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
}
m_mainWin->SetImageList( imageList, which );
{
SetImageList(imageList, which);
if ( which == wxIMAGE_LIST_NORMAL )
- m_ownsImageListNormal = TRUE;
+ m_ownsImageListNormal = true;
else if ( which == wxIMAGE_LIST_SMALL )
- m_ownsImageListSmall = TRUE;
+ m_ownsImageListSmall = true;
else if ( which == wxIMAGE_LIST_STATE )
- m_ownsImageListState = TRUE;
+ m_ownsImageListState = true;
}
bool wxGenericListCtrl::Arrange( int WXUNUSED(flag) )
bool wxGenericListCtrl::DeleteItem( long item )
{
m_mainWin->DeleteItem( item );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::DeleteAllItems()
{
m_mainWin->DeleteAllItems();
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::DeleteAllColumns()
for ( size_t n = 0; n < count; n++ )
DeleteColumn(0);
- return TRUE;
+ return true;
}
void wxGenericListCtrl::ClearAll()
// if we don't have the header any longer, we need to relayout the window
if ( !GetColumnCount() )
{
- ResizeReportView(FALSE /* no header */);
+ ResizeReportView(false /* no header */);
}
- return TRUE;
+ return true;
}
void wxGenericListCtrl::Edit( long item )
bool wxGenericListCtrl::EnsureVisible( long item )
{
m_mainWin->EnsureVisible( item );
- return TRUE;
+ return true;
}
long wxGenericListCtrl::FindItem( long start, const wxString& str, bool partial )
// window
if ( GetColumnCount() == 1 && m_mainWin->HasHeader() )
{
- ResizeReportView(TRUE /* have header */);
+ ResizeReportView(true /* have header */);
}
m_headerWin->Refresh();
bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, long data )
{
m_mainWin->SortItems( fn, data );
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetForegroundColour( const wxColour &colour )
{
if ( !wxWindow::SetForegroundColour( colour ) )
- return FALSE;
+ return false;
if (m_mainWin)
{
m_mainWin->SetForegroundColour( colour );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
if (m_headerWin)
m_headerWin->SetForegroundColour( colour );
}
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetFont( const wxFont &font )
{
if ( !wxWindow::SetFont( font ) )
- return FALSE;
+ return false;
if (m_mainWin)
{
m_mainWin->SetFont( font );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
if (m_headerWin)
Refresh();
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetCursor( const wxCursor &cursor )
{
- return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE;
+ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : false;
}
wxColour wxGenericListCtrl::GetBackgroundColour() const
#if wxUSE_MENUS
return m_mainWin->PopupMenu( menu, x, y );
#else
- return FALSE;
+ return false;
#endif // wxUSE_MENUS
}
heightMax *= 9;
heightMax /= 10;
- m_listctrl->SetSize(-1, wxMin(height, heightMax));
+ m_listctrl->SetSize(wxDefaultSize.x, wxMin(height, heightMax));
}
void wxLogDialog::OnListSelect(wxListEvent& event)
SetSizeHints(size.x, size.y, m_maxWidth, m_maxHeight);
// don't change the width when expanding/collapsing
- SetSize(-1, size.y);
+ SetSize(wxDefaultSize.x, size.y);
#ifdef __WXGTK__
// VS: this is neccessary in order to force frame redraw under
BEGIN_EVENT_TABLE(wxGenericMDIParentFrame, wxFrame)
#if wxUSE_MENUS
- EVT_MENU (-1, wxGenericMDIParentFrame::DoHandleMenu)
+ EVT_MENU (wxID_ANY, wxGenericMDIParentFrame::DoHandleMenu)
#endif
END_EVENT_TABLE()
OnCreateClient();
- return TRUE;
+ return true;
}
#if wxUSE_MENUS
// Stops the same event being processed repeatedly
static wxEventType inEvent = wxEVT_NULL;
if (inEvent == event.GetEventType())
- return FALSE;
+ return false;
inEvent = event.GetEventType();
// Let the active child (if any) process the event first.
- bool res = FALSE;
+ bool res = false;
if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent))
#if 0
/* This is sure to not give problems... */
if (pParentFrame != NULL)
{
- bool bActive = FALSE;
+ bool bActive = false;
if (pParentFrame->GetActiveChild() == this)
{
pParentFrame->SetActiveChild((wxGenericMDIChildFrame*) NULL);
pParentFrame->SetChildMenuBar((wxGenericMDIChildFrame*) NULL);
- bActive = TRUE;
+ bActive = true;
}
wxGenericMDIClientWindow *pClientWindow = pParentFrame->GetClientWindow();
m_Title = title;
- pClientWindow->AddPage(this, title, TRUE);
+ pClientWindow->AddPage(this, title, true);
ApplyMDIChildFrameRect(); // Ok confirme the size change!
pClientWindow->Refresh();
- return TRUE;
+ return true;
}
#if wxUSE_MENUS
GetTabView()->SetTabSize(120, 18);
GetTabView()->SetTabSelectionHeight(20);
*/
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
int wxGenericMDIClientWindow::SetSelection(size_t nPage)
wxGenericMDIChildFrame* oldChild = (wxGenericMDIChildFrame *)GetPage(OldSelection);
if (oldChild)
{
- wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldChild->GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE, false, oldChild->GetId());
event.SetEventObject( oldChild );
oldChild->GetEventHandler()->ProcessEvent(event);
}
wxGenericMDIChildFrame* activeChild = (wxGenericMDIChildFrame *)GetPage(newSelection);
if (activeChild)
{
- wxActivateEvent event(wxEVT_ACTIVATE, TRUE, activeChild->GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE, true, activeChild->GetId());
event.SetEventObject( activeChild );
activeChild->GetEventHandler()->ProcessEvent(event);
const wxString& caption,
long style,
const wxPoint& pos)
- : wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
+ : wxDialog( parent, wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
m_dialogStyle = style;
bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
break;
}
- wxStaticBitmap *icon = new wxStaticBitmap(this, -1, bitmap);
+ wxStaticBitmap *icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
if (is_pda)
topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
else
topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
// 3) static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
// 4) buttons
topsizer->Add( CreateButtonSizer( style & (wxOK|wxCANCEL|wxYES_NO|wxYES_DEFAULT|wxNO_DEFAULT) ),
0, wxCENTRE | wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
- EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
+ EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
EVT_PAINT(wxNotebook::OnPaint)
EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
// base init
SetName(name);
- m_windowId = id == -1 ? NewControlId() : id;
+ m_windowId = id == wxID_ANY ? NewControlId() : id;
if (!wxControl::Create(parent, id, pos, size, style|wxNO_BORDER, wxDefaultValidator, name))
- return FALSE;
+ return false;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
SetTabView(new wxNotebookTabView(this));
- return TRUE;
+ return true;
}
// dtor
{
m_tabView->SetTabText((int) (long) page, strText);
Refresh();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
wxString wxNotebook::GetPageText(size_t nPage) const
wxASSERT( IS_VALID_PAGE(nPage) );
// TODO
- return FALSE;
+ return false;
}
// set the size (the same for all pages)
// remove one page from the notebook and delete it
bool wxNotebook::DeletePage(size_t nPage)
{
- wxCHECK( IS_VALID_PAGE(nPage), FALSE );
+ wxCHECK( IS_VALID_PAGE(nPage), false );
if (m_nSelection != -1)
{
- m_pages[m_nSelection]->Show(FALSE);
+ m_pages[m_nSelection]->Show(false);
m_pages[m_nSelection]->Lower();
}
if (m_pages.GetCount() == 0)
{
m_nSelection = -1;
- m_tabView->SetTabSelection(-1, FALSE);
+ m_tabView->SetTabSelection(-1, false);
}
else if (m_nSelection > -1)
{
m_nSelection = -1;
- m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
+ m_tabView->SetTabSelection((int) (long) GetPage(0), false);
if (m_nSelection != 0)
ChangePage(-1, 0);
}
- RefreshLayout(FALSE);
+ RefreshLayout(false);
- return TRUE;
+ return true;
}
bool wxNotebook::DeletePage(wxNotebookPage* page)
if (pagePos > -1)
return DeletePage(pagePos);
else
- return FALSE;
+ return false;
}
bool wxNotebook::RemovePage(size_t nPage)
// remove one page from the notebook
wxWindow* wxNotebook::DoRemovePage(size_t nPage)
{
- wxCHECK( IS_VALID_PAGE(nPage), FALSE );
+ wxCHECK( IS_VALID_PAGE(nPage), false );
- m_pages[nPage]->Show(FALSE);
+ m_pages[nPage]->Show(false);
// m_pages[nPage]->Lower();
wxNotebookPage* pPage = GetPage(nPage);
if (m_pages.GetCount() == 0)
{
m_nSelection = -1;
- m_tabView->SetTabSelection(-1, TRUE);
+ m_tabView->SetTabSelection(-1, true);
}
else if (m_nSelection > -1)
{
{
m_nSelection = -1;
// Select the first tab. Generates a ChangePage.
- m_tabView->SetTabSelection(0, TRUE);
+ m_tabView->SetTabSelection(0, true);
}
else
{
- // We must adjust which tab we think is selected.
+ // We must adjust which tab we think is selected.
// If greater than the page we deleted, it must be moved down
// a notch.
if (size_t(m_nSelection) > nPage)
}
}
- RefreshLayout(FALSE);
+ RefreshLayout(false);
return pPage;
}
if (pagePos > -1)
return RemovePage(pagePos);
else
- return FALSE;
+ return false;
}
// Find the position of the wxNotebookPage, -1 if not found.
// remove all pages
bool wxNotebook::DeleteAllPages()
{
- m_tabView->ClearTabs(TRUE);
+ m_tabView->ClearTabs(true);
size_t nPageCount = GetPageCount();
size_t nPage;
m_pages.Clear();
- return TRUE;
+ return true;
}
// same as AddPage() but does it at given position
int imageId)
{
wxASSERT( pPage != NULL );
- wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
+ wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false );
m_tabView->AddTab((int) (long) pPage, strText);
if (!bSelect)
- pPage->Show(FALSE);
+ pPage->Show(false);
// save the pointer to the page
m_pages.Insert(pPage, nPage);
{
// This will cause ChangePage to be called, via OnSelPage
- m_tabView->SetTabSelection((int) (long) pPage, TRUE);
+ m_tabView->SetTabSelection((int) (long) pPage, true);
}
// some page must be selected: either this one or the first one if there is
if ( m_nSelection == -1 )
ChangePage(-1, 0);
- RefreshLayout(FALSE);
+ RefreshLayout(false);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
// time because doing it in ::Create() doesn't work (for unknown reasons)
void wxNotebook::OnSize(wxSizeEvent& event)
{
- static bool s_bFirstTime = TRUE;
+ static bool s_bFirstTime = true;
if ( s_bFirstTime ) {
// TODO: any first-time-size processing.
- s_bFirstTime = FALSE;
+ s_bFirstTime = false;
}
RefreshLayout();
{
wxWindow::OnInternalIdle();
-#if 0
- static bool s_bFirstTime = TRUE;
+#if 0
+ static bool s_bFirstTime = true;
if ( s_bFirstTime ) {
/*
wxSize sz(GetSize());
GetEventHandler()->ProcessEvent(sizeEvent);
Refresh();
*/
- s_bFirstTime = FALSE;
+ s_bFirstTime = false;
}
#endif
}
m_tabView->LayoutTabs();
if (!force && (rect == oldRect))
- return FALSE;
+ return false;
// fit the notebook page to the tab control's display area
}
Refresh();
}
- return TRUE;
+ return true;
}
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::SetConstraintSizes(bool /* recurse */)
{
// don't set the sizes of the pages - their correct size is not yet known
- wxControl::SetConstraintSizes(FALSE);
+ wxControl::SetConstraintSizes(false);
}
bool wxNotebook::DoPhase(int /* nPhase */)
{
- return TRUE;
+ return true;
}
void wxNotebook::Command(wxCommandEvent& WXUNUSED(event))
wxASSERT( nOldSel != nSel ); // impossible
if ( nOldSel != -1 ) {
- m_pages[nOldSel]->Show(FALSE);
+ m_pages[nOldSel]->Show(false);
m_pages[nOldSel]->Lower();
}
Refresh();
- pPage->Show(TRUE);
+ pPage->Show(true);
pPage->Raise();
pPage->SetFocus();
// Allows Vetoing
bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId)
{
- bool retval = TRUE;
-
+ bool retval = true;
+
if (m_notebook)
{
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
}
}
return retval;
-}
+}
long min,
long max,
const wxPoint& pos)
- : wxDialog(parent, -1, caption,
+ : wxDialog(parent, wxID_ANY, caption,
pos, wxDefaultSize)
{
m_value = value;
wxBoxSizer *inputsizer = new wxBoxSizer( wxHORIZONTAL );
// prompt if any
if (!prompt.IsEmpty())
- inputsizer->Add( new wxStaticText( this, -1, prompt ), 0, wxCENTER | wxLEFT, 10 );
+ inputsizer->Add( new wxStaticText( this, wxID_ANY, prompt ), 0, wxCENTER | wxLEFT, 10 );
// spin ctrl
wxString valStr;
valStr.Printf(wxT("%ld"), m_value);
- m_spinctrl = new wxSpinCtrl(this, -1, valStr, wxDefaultPosition, wxSize( 140, -1 ) );
+ m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultSize.y ) );
#if wxUSE_SPINCTRL
m_spinctrl->SetRange((int)m_min, (int)m_max);
#endif
#if wxUSE_STATLINE
// 3) static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 4) buttons
topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxCENTRE | wxALL, 10 );
SetSizer( topsizer );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
topsizer->SetSizeHints( this );
topsizer->Fit( this );
value, min, max, pos);
if (dialog.ShowModal() == wxID_OK)
return dialog.GetValue();
-
+
return -1;
}
e->blue = blue[i];
}
- return TRUE;
+ return true;
}
int wxPalette::GetPixel( const unsigned char red,
const unsigned char green,
const unsigned char blue ) const
{
- if (!m_refData) return FALSE;
+ if (!m_refData) return false;
int closest = 0;
double d,distance = 1000.0; // max. dist is 256
unsigned char *green,
unsigned char *blue) const
{
- if (!m_refData) return FALSE;
- if (pixel >= M_PALETTEDATA->m_count) return FALSE;
+ if (!m_refData) return false;
+ if (pixel >= M_PALETTEDATA->m_count) return false;
wxPaletteEntry& p = M_PALETTEDATA->m_entries[pixel];
if (red) *red = p.red;
if (green) *green = p.green;
if (blue) *blue = p.blue;
- return TRUE;
+ return true;
}
#endif // wxUSE_PALETTE
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_HANDLERS_TABLE(wxPanel)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_5( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_5( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
#else
IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
// so that non-solid background renders correctly under GTK+:
SetThemeEnabled(true);
-
+
#ifdef __WXMSW__
// panels don't have the same colour as normal windows under Windows
SetDefaultBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
// Uninitialized
::WinQueryWindowPos(GetHWND(), pWinSwp);
- }
- else
+ }
+ else
{
SWP vSwp;
int nYDiff;
#include "wx/msgdlg.h"
#include "wx/intl.h"
#include "wx/progdlg.h"
- #include "wx/log.h"
+ #include "wx/log.h"
#endif
#include "wx/generic/printps.h"
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
-
+
// ============================================================================
// implementation
// ============================================================================
bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
{
- sm_abortIt = FALSE;
+ sm_abortIt = false;
sm_abortWindow = (wxWindow *) NULL;
if (!printout)
{
sm_lastError = wxPRINTER_ERROR;
- return FALSE;
+ return false;
}
- printout->SetIsPreview(FALSE);
+ printout->SetIsPreview(false);
-#if 0
+#if 0
// 4/9/99, JACS: this is a silly place to allow preparation, considering
// the DC and no parameters have been set in the printout object.
// Moved further down.
if (maxPage == 0)
{
sm_lastError = wxPRINTER_ERROR;
- return FALSE;
+ return false;
}
m_printDialogData.SetMinPage(minPage);
if (minPage != 0)
{
- m_printDialogData.EnablePageNumbers(TRUE);
+ m_printDialogData.EnablePageNumbers(true);
if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
}
else
- m_printDialogData.EnablePageNumbers(FALSE);
+ m_printDialogData.EnablePageNumbers(false);
#endif
if (m_printDialogData.GetMinPage() < 1)
{
dc = PrintDialog(parent);
if (!dc)
- return FALSE;
+ return false;
}
else
{
{
if (dc) delete dc;
sm_lastError = wxPRINTER_ERROR;
- return FALSE;
+ return false;
}
wxSize ScreenPixels = wxGetDisplaySize();
{
sm_lastError = wxPRINTER_ERROR;
wxEndBusyCursor();
- return FALSE;
+ return false;
}
// Only set min and max, because from and to have been
// set by the user
m_printDialogData.SetMinPage(minPage);
m_printDialogData.SetMaxPage(maxPage);
-
+
int
pagesPerCopy = m_printDialogData.GetToPage()-m_printDialogData.GetFromPage()+1,
totalPages = pagesPerCopy * m_printDialogData.GetNoCopies(),
sm_lastError = wxPRINTER_NO_ERROR;
- bool keepGoing = TRUE;
+ bool keepGoing = true;
int copyCount;
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
{
if (sm_abortIt)
{
- keepGoing = FALSE;
+ keepGoing = false;
sm_lastError = wxPRINTER_CANCELLED;
break;
}
}
else
{
- sm_abortIt = TRUE;
+ sm_abortIt = true;
sm_lastError = wxPRINTER_CANCELLED;
- keepGoing = FALSE;
+ keepGoing = false;
}
}
- wxYield();
+ wxYield();
}
printout->OnEndDocument();
}
bool wxPostScriptPrinter::Setup(wxWindow *parent)
{
wxGenericPrintDialog* dialog = new wxGenericPrintDialog(parent, & m_printDialogData);
- dialog->GetPrintDialogData().SetSetupDialog(TRUE);
+ dialog->GetPrintDialogData().SetSetupDialog(true);
int ret = dialog->ShowModal();
bool wxPostScriptPrintPreview::Print(bool interactive)
{
if (!m_printPrintout)
- return FALSE;
+ return false;
wxPostScriptPrinter printer(& m_printDialogData);
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
(int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
- m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution());
+ m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution());
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxPostScriptDC::GetResolution() / 72.0);
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintDialogData* data)
- : wxDialog(parent, -1, _("Print"),
+ : wxDialog(parent, wxID_ANY, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxTAB_TRAVERSAL)
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintData* data)
- : wxDialog(parent, -1, _("Print"),
+ : wxDialog(parent, wxID_ANY, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxTAB_TRAVERSAL)
void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent))
{
- // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
+ // wxDialog::Create(parent, wxID_ANY, _("Print"), wxPoint(0, 0), wxSize(600, 600),
// wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL);
wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
- // 1) top row
-
- wxStaticBoxSizer *topsizer = new wxStaticBoxSizer(
- new wxStaticBox( this, -1, _( "Printer options" ) ), wxHORIZONTAL );
+ // 1) top row
+
+ wxStaticBoxSizer *topsizer = new wxStaticBoxSizer(
+ new wxStaticBox( this, wxID_ANY, _( "Printer options" ) ), wxHORIZONTAL );
m_printToFileCheckBox = new wxCheckBox( this, wxPRINTID_PRINTTOFILE, _("Print to File") );
topsizer->Add( m_printToFileCheckBox, 0, wxCENTER|wxALL, 5 );
m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup...") );
topsizer->Add( m_setupButton, 0, wxCENTER|wxALL, 5 );
-
+
mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT, 10 );
-
+
// 2) middle row with radio box
-
+
wxString *choices = new wxString[2];
choices[0] = _("All");
choices[1] = _("Pages");
m_fromText = (wxTextCtrl*)NULL;
m_toText = (wxTextCtrl*)NULL;
m_rangeRadioBox = (wxRadioBox *)NULL;
-
+
if (m_printDialogData.GetFromPage() != 0)
{
m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
}
// 3) bottom row
-
+
wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );
if (m_printDialogData.GetFromPage() != 0)
{
bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("From:") ), 0, wxCENTER|wxALL, 5 );
- m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, wxT(""), wxDefaultPosition, wxSize(40, -1));
+ m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultSize.y));
bottomsizer->Add( m_fromText, 1, wxCENTER|wxRIGHT, 10 );
bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("To:") ), 0, wxCENTER|wxALL, 5);
- m_toText = new wxTextCtrl(this, wxPRINTID_TO, wxT(""), wxDefaultPosition, wxSize(40, -1));
+ m_toText = new wxTextCtrl(this, wxPRINTID_TO, wxEmptyString, wxDefaultPosition, wxSize(40, wxDefaultSize.y));
bottomsizer->Add( m_toText, 1, wxCENTER|wxRIGHT, 10 );
}
bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Copies:") ), 0, wxCENTER|wxALL, 5 );
- m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, wxT(""), wxPoint(252, 130), wxSize(40, -1));
+ m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, wxEmptyString, wxPoint(252, 130), wxSize(40, wxDefaultSize.y));
bottomsizer->Add( m_noCopiesText, 1, wxCENTER|wxRIGHT, 10 );
mainsizer->Add( bottomsizer, 0, wxTOP|wxLEFT|wxRIGHT, 12 );
#if wxUSE_STATLINE
// 4) static line
- mainsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ mainsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 5) buttons
mainsizer->Add( CreateButtonSizer( wxOK|wxCANCEL), 0, wxCENTER|wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( mainsizer );
mainsizer->Fit( this );
if (m_printDialogData.GetPrintToFile())
{
m_printDialogData.GetPrintData().SetPrintMode(wxPRINT_MODE_FILE);
-
+
wxFileName fname( m_printDialogData.GetPrintData().GetFilename() );
-
+
wxFileDialog dialog( this, _("PostScript file"),
fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxOPEN | wxOVERWRITE_PROMPT );
if (dialog.ShowModal() != wxID_OK) return;
if (event.GetInt() == 0)
{
- m_fromText->Enable(FALSE);
- m_toText->Enable(FALSE);
+ m_fromText->Enable(false);
+ m_toText->Enable(false);
}
else if (event.GetInt() == 1)
{
- m_fromText->Enable(TRUE);
- m_toText->Enable(TRUE);
+ m_fromText->Enable(true);
+ m_toText->Enable(true);
}
}
{
if (m_printDialogData.GetEnablePageNumbers())
{
- m_fromText->Enable(TRUE);
- m_toText->Enable(TRUE);
+ m_fromText->Enable(true);
+ m_toText->Enable(true);
if (m_printDialogData.GetFromPage() > 0)
m_fromText->SetValue(wxString::Format(_T("%d"), m_printDialogData.GetFromPage()));
if (m_printDialogData.GetToPage() > 0)
}
else
{
- m_fromText->Enable(FALSE);
- m_toText->Enable(FALSE);
+ m_fromText->Enable(false);
+ m_toText->Enable(false);
if(m_rangeRadioBox)
{
m_rangeRadioBox->SetSelection(0);
- m_rangeRadioBox->wxRadioBox::Enable(1, FALSE);
+ m_rangeRadioBox->wxRadioBox::Enable(1, false);
}
}
}
m_printToFileCheckBox->SetValue(m_printDialogData.GetPrintToFile());
m_printToFileCheckBox->Enable(m_printDialogData.GetEnablePrintToFile());
- return TRUE;
+ return true;
}
bool wxGenericPrintDialog::TransferDataFromWindow()
m_printDialogData.SetFromPage( res );
}
if(m_toText)
- {
+ {
wxString value = m_toText->GetValue();
if (value.ToLong( &res ))
m_printDialogData.SetToPage( res );
if(m_rangeRadioBox)
{
if (m_rangeRadioBox->GetSelection() == 0)
- m_printDialogData.SetAllPages(TRUE);
+ m_printDialogData.SetAllPages(true);
else
- m_printDialogData.SetAllPages(FALSE);
+ m_printDialogData.SetAllPages(false);
}
}
else
m_printDialogData.SetFromPage(1);
m_printDialogData.SetToPage(32000);
}
-
+
wxString value = m_noCopiesText->GetValue();
if (value.ToLong( &res ))
m_printDialogData.SetNoCopies( res );
-
+
m_printDialogData.SetPrintToFile(m_printToFileCheckBox->GetValue());
- return TRUE;
+ return true;
}
/*
wxDC *wxGenericPrintDialog::GetPrintDC()
{
- // return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), FALSE, (wxWindow *) NULL);
+ // return new wxPostScriptDC(wxThePrintSetupData->GetPrinterFile(), false, (wxWindow *) NULL);
return new wxPostScriptDC(GetPrintDialogData().GetPrintData());
}
// ----------------------------------------------------------------------------
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
-wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
+wxDialog(parent, wxID_ANY, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
{
Init(data);
}
choices[1] = _("Landscape");
m_orientationRadioBox = new wxRadioBox(this, wxPRINTID_ORIENTATION, _("Orientation"),
- wxPoint(10, 80), wxSize(-1, -1), 2, choices, 1, wxRA_VERTICAL );
+ wxPoint(10, 80), wxDefaultSize, 2, choices, 1, wxRA_VERTICAL );
m_orientationRadioBox->SetSelection(0);
(void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(staticBoxWidth, 50) );
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer command:"), wxPoint(340, 30));
- m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, wxT(""), wxPoint(360, 55), wxSize(150, -1));
+ m_printerCommandText = new wxTextCtrl(this, wxPRINTID_COMMAND, wxEmptyString, wxPoint(360, 55), wxSize(150, wxDefaultSize.y));
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Printer options:"), wxPoint(340, 110));
- m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, wxT(""), wxPoint(360, 135), wxSize(150, -1));
+ m_printerOptionsText = new wxTextCtrl(this, wxPRINTID_OPTIONS, wxEmptyString, wxPoint(360, 135), wxSize(150, wxDefaultSize.y));
- wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(80, -1));
- (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(80, -1));
+ wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(130, 200), wxSize(80, wxDefaultSize.y));
+ (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(320, 200), wxSize(80, wxDefaultSize.y));
okButton->SetDefault();
okButton->SetFocus();
-
+
Fit();
Centre(wxBOTH);
else
m_orientationRadioBox->SetSelection(1);
}
- return TRUE;
+ return true;
}
bool wxGenericPrintSetupDialog::TransferDataFromWindow()
}
}
- return TRUE;
+ return true;
}
wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
wxPRINTID_PAPERSIZE,
_("Paper Size"),
wxPoint(*x, *y),
- wxSize(width, -1),
+ wxSize(width, wxDefaultSize.y),
n, choices );
// SetFont(thisFont);
// Transfer the current print settings from this dialog to the page setup dialog.
wxPrintDialogData data;
data = GetPageSetupData().GetPrintData();
- data.SetSetupDialog(TRUE);
+ data.SetSetupDialog(true);
wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
printDialog->ShowModal();
wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
wxPageSetupData* data)
: wxDialog( parent,
- -1,
+ wxID_ANY,
_("Page Setup"),
wxPoint(0, 0),
wxSize(600, 600),
wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
// 1) top
- wxStaticBoxSizer *topsizer = new wxStaticBoxSizer(
+ wxStaticBoxSizer *topsizer = new wxStaticBoxSizer(
new wxStaticBox(this,wxPRINTID_STATIC, _("Paper size")), wxHORIZONTAL );
size_t n = wxThePrintPaperDatabase->GetCount();
wxPRINTID_PAPERSIZE,
_("Paper Size"),
wxDefaultPosition,
- wxSize(300, -1),
+ wxSize(300, wxDefaultSize.y),
n, choices );
topsizer->Add( m_paperTypeChoice, 1, wxEXPAND|wxALL, 5 );
// m_paperTypeChoice->SetSelection(sel);
column1->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Left margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 );
column1->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Top margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 );
table->Add( column1, 0, wxALL | wxEXPAND, 5 );
-
+
wxBoxSizer *column2 = new wxBoxSizer( wxVERTICAL );
- m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, wxT(""), wxDefaultPosition, wxSize(textWidth, -1));
- m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, wxT(""), wxDefaultPosition, wxSize(textWidth, -1));
+ m_marginLeftText = new wxTextCtrl(this, wxPRINTID_LEFTMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultSize.y));
+ m_marginTopText = new wxTextCtrl(this, wxPRINTID_TOPMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultSize.y));
column2->Add( m_marginLeftText, 1, wxALL, 5 );
column2->Add( m_marginTopText, 1, wxALL, 5 );
table->Add( column2, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, 5 );
-
+
wxBoxSizer *column3 = new wxBoxSizer( wxVERTICAL );
column3->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Right margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 );
column3->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Bottom margin (mm):")),1,wxALL|wxALIGN_RIGHT,5 );
table->Add( column3, 0, wxALL | wxEXPAND, 5 );
-
+
wxBoxSizer *column4 = new wxBoxSizer( wxVERTICAL );
- m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, wxT(""), wxDefaultPosition, wxSize(textWidth, -1));
- m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, wxT(""), wxDefaultPosition, wxSize(textWidth, -1));
+ m_marginRightText = new wxTextCtrl(this, wxPRINTID_RIGHTMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultSize.y));
+ m_marginBottomText = new wxTextCtrl(this, wxPRINTID_BOTTOMMARGIN, wxEmptyString, wxDefaultPosition, wxSize(textWidth, wxDefaultSize.y));
column4->Add( m_marginRightText, 1, wxALL, 5 );
column4->Add( m_marginBottomText, 1, wxALL, 5 );
table->Add( column4, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, 5 );
#if wxUSE_STATLINE
// 5) static line
- mainsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ mainsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 6) buttons
-
+
wxSizer* buttonsizer = CreateButtonSizer( wxOK|wxCANCEL);
m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") );
buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 );
if ( !m_pageData.GetEnablePrinter() )
- m_printerButton->Enable(FALSE);
+ m_printerButton->Enable(false);
// if (m_printData.GetEnableHelp())
- // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), -1, -1, buttonWidth, buttonHeight);
+ // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), wxDefaultPosition.x, wxDefaultPosition.y, buttonWidth, buttonHeight);
mainsizer->Add( buttonsizer, 0, wxCENTER|wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( mainsizer );
mainsizer->Fit( this );
Centre(wxBOTH);
InitDialog();
-
+
delete[] choices;
delete [] choices2;
}
m_paperTypeChoice->SetStringSelection(type->GetName());
}
- return TRUE;
+ return true;
}
bool wxGenericPageSetupDialog::TransferDataFromWindow()
m_pageData.GetPrintData().SetOrientation(wxLANDSCAPE);
}
}
-
+
if (m_paperTypeChoice)
{
int selectedItem = m_paperTypeChoice->GetSelection();
}
}
- return TRUE;
+ return true;
}
wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
wxPRINTID_PAPERSIZE,
_("Paper Size"),
wxPoint(*x, *y),
- wxSize(300, -1),
+ wxSize(300, wxDefaultSize.y),
n, choices );
*y += 35;
delete[] choices;
// Created: 2004/04/12
// RCS-ID: $Id$
// Copyright: (c) 2004 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/generic/region.h"
register int x,
register int y);
static bool XIntersectRegion(
- Region reg1,
- Region reg2, /* source regions */
- register Region newReg); /* destination Region */
+ Region reg1,
+ Region reg2, /* source regions */
+ register Region newReg); /* destination Region */
static bool XUnionRegion(
- Region reg1,
- Region reg2, /* source regions */
- Region newReg); /* destination Region */
+ Region reg1,
+ Region reg2, /* source regions */
+ Region newReg); /* destination Region */
static bool XSubtractRegion(
- Region regM,
- Region regS,
- register Region regD);
+ Region regM,
+ Region regS,
+ register Region regD);
static bool XXorRegion(Region sra, Region srb, Region dr);
static bool XEmptyRegion(
Region r);
Region pRegion,
int x, int y);
static wxRegionContain XRectInRegion(
- register Region region,
+ register Region region,
int rx, int ry,
unsigned int rwidth, unsigned int rheight);
protected:
static Region XCreateRegion(void);
static void miSetExtents (
- Region pReg);
+ Region pReg);
static bool XDestroyRegion(Region r);
static int miIntersectO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- wxCoord y1,
- wxCoord y2);
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ wxCoord y1,
+ wxCoord y2);
static void miRegionCopy(
register Region dstrgn,
register Region rgn);
static int miCoalesce(
- register Region pReg, /* Region to coalesce */
- int prevStart, /* Index of start of previous band */
- int curStart); /* Index of start of current band */
+ register Region pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart); /* Index of start of current band */
static void miRegionOp(
- register Region newReg, /* Place to store result */
- Region reg1, /* First region in operation */
- Region reg2, /* 2d region in operation */
- int (*overlapFunc)(
+ register Region newReg, /* Place to store result */
+ Region reg1, /* First region in operation */
+ Region reg2, /* 2d region in operation */
+ int (*overlapFunc)(
register Region pReg,
register BoxPtr r1,
BoxPtr r1End,
register BoxPtr r2,
BoxPtr r2End,
- wxCoord y1,
- wxCoord y2), /* Function to call for over-
- * lapping bands */
- int (*nonOverlap1Func)(
+ wxCoord y1,
+ wxCoord y2), /* Function to call for over-
+ * lapping bands */
+ int (*nonOverlap1Func)(
register Region pReg,
register BoxPtr r,
BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2), /* Function to call for non-
- * overlapping bands in region
- * 1 */
- int (*nonOverlap2Func)(
+ register wxCoord y1,
+ register wxCoord y2), /* Function to call for non-
+ * overlapping bands in region
+ * 1 */
+ int (*nonOverlap2Func)(
register Region pReg,
register BoxPtr r,
BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2)); /* Function to call for non-
- * overlapping bands in region
- * 2 */
+ register wxCoord y1,
+ register wxCoord y2)); /* Function to call for non-
+ * overlapping bands in region
+ * 2 */
static int miUnionNonO (
- register Region pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2);
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register wxCoord y1,
+ register wxCoord y2);
static int miUnionO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register wxCoord y1,
- register wxCoord y2);
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register wxCoord y1,
+ register wxCoord y2);
static int miSubtractNonO1 (
- register Region pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2);
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register wxCoord y1,
+ register wxCoord y2);
static int miSubtractO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register wxCoord y1,
- register wxCoord y2);
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register wxCoord y1,
+ register wxCoord y2);
protected:
long size;
long numRects;
/* XUnionRectWithRegion */
{
if (!rect.width || !rect.height)
- return false;
+ return false;
AllocExclusive();
REGION region(rect);
bool wxRegionGeneric::Intersect(const wxRect& rect)
{
if (!rect.width || !rect.height)
- return false;
+ return false;
AllocExclusive();
REGION region(rect);
bool wxRegionGeneric::Subtract(const wxRect& rect)
{
if (!rect.width || !rect.height)
- return false;
+ return false;
AllocExclusive();
REGION region(rect);
bool wxRegionGeneric::Xor(const wxRect& rect)
{
if (!rect.width || !rect.height)
- return false;
+ return false;
AllocExclusive();
REGION region(rect);
wxASSERT(m_refData);
return REGION::XPointInRegion(M_REGIONDATA,x,y)?wxInRegion:wxOutRegion;
}
-
+
// Does the region contain the point pt?
wxRegionContain wxRegionGeneric::Contains(const wxPoint& pt) const
{
wxASSERT(m_refData);
return REGION::XPointInRegion(M_REGIONDATA,pt.x,pt.y)?wxInRegion:wxOutRegion;
}
-
+
// Does the region contain the rectangle (x, y, w, h)?
wxRegionContain wxRegionGeneric::Contains(long x, long y, long w, long h) const
{
wxASSERT(m_refData);
return REGION::XRectInRegion(M_REGIONDATA,x,y,w,h);
}
-
+
// Does the region contain the rectangle rect?
wxRegionContain wxRegionGeneric::Contains(const wxRect& rect) const
{
wxASSERT(m_refData);
return REGION::XRectInRegion(M_REGIONDATA,rect.x,rect.y,rect.width,rect.height);
}
-
+
// ========================================================================
// wxRegionIteratorGeneric
// ========================================================================
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
/* 1 if two BOXs overlap.
* 0 if two BOXs do not overlap.
- * Remember, x2 and y2 are not in the region
+ * Remember, x2 and y2 are not in the region
*/
#define EXTENTCHECK(r1, r2) \
- ((r1)->x2 > (r2)->x1 && \
- (r1)->x1 < (r2)->x2 && \
- (r1)->y2 > (r2)->y1 && \
- (r1)->y1 < (r2)->y2)
+ ((r1)->x2 > (r2)->x1 && \
+ (r1)->x1 < (r2)->x2 && \
+ (r1)->y2 > (r2)->y1 && \
+ (r1)->y1 < (r2)->y2)
/*
* Check to see if there is enough memory in the present region.
* the y-x-banding that's so nice to have...
*/
-/* Create a new empty region */
+/* Create a new empty region */
Region REGION::
XCreateRegion(void)
{
Region temp;
if (! (temp = new REGION))
- return (Region) NULL;
+ return (Region) NULL;
if (! (temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )))) {
- free((char *) temp);
- return (Region) NULL;
+ free((char *) temp);
+ return (Region) NULL;
}
temp->numRects = 0;
temp->extents.x1 = 0;
/*-
*-----------------------------------------------------------------------
* miSetExtents --
- * Reset the extents of a region to what they should be. Called by
- * miSubtract and miIntersect b/c they can't figure it out along the
- * way or do so easily, as miUnion can.
+ * Reset the extents of a region to what they should be. Called by
+ * miSubtract and miIntersect b/c they can't figure it out along the
+ * way or do so easily, as miUnion can.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * The region's 'extents' structure is overwritten.
+ * The region's 'extents' structure is overwritten.
*
*-----------------------------------------------------------------------
*/
void REGION::
-miSetExtents (
- Region pReg)
+miSetExtents (Region pReg)
{
- register BoxPtr pBox,
- pBoxEnd,
- pExtents;
+ register BoxPtr pBox,
+ pBoxEnd,
+ pExtents;
if (pReg->numRects == 0)
{
- pReg->extents.x1 = 0;
- pReg->extents.y1 = 0;
- pReg->extents.x2 = 0;
- pReg->extents.y2 = 0;
- return;
+ pReg->extents.x1 = 0;
+ pReg->extents.y1 = 0;
+ pReg->extents.x2 = 0;
+ pReg->extents.y2 = 0;
+ return;
}
pExtents = &pReg->extents;
assert(pExtents->y1 < pExtents->y2);
while (pBox <= pBoxEnd)
{
- if (pBox->x1 < pExtents->x1)
- {
- pExtents->x1 = pBox->x1;
- }
- if (pBox->x2 > pExtents->x2)
- {
- pExtents->x2 = pBox->x2;
- }
- pBox++;
+ if (pBox->x1 < pExtents->x1)
+ {
+ pExtents->x1 = pBox->x1;
+ }
+ if (pBox->x2 > pExtents->x2)
+ {
+ pExtents->x2 = pBox->x2;
+ }
+ pBox++;
}
assert(pExtents->x1 < pExtents->x2);
}
while(nbox--)
{
- pbox->x1 += x;
- pbox->x2 += x;
- pbox->y1 += y;
- pbox->y2 += y;
- pbox++;
+ pbox->x1 += x;
+ pbox->x2 += x;
+ pbox->y1 += y;
+ pbox->y2 += y;
+ pbox++;
}
pRegion->extents.x1 += x;
pRegion->extents.x2 += x;
}
/*======================================================================
- * Region Intersection
+ * Region Intersection
*====================================================================*/
/*-
*-----------------------------------------------------------------------
* miIntersectO --
- * Handle an overlapping band for miIntersect.
+ * Handle an overlapping band for miIntersect.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * Rectangles may be added to the region.
+ * Rectangles may be added to the region.
*
*-----------------------------------------------------------------------
*/
/* static void*/
int REGION::
miIntersectO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- wxCoord y1,
- wxCoord y2)
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ wxCoord y1,
+ wxCoord y2)
{
- register wxCoord x1;
- register wxCoord x2;
- register BoxPtr pNextRect;
+ register wxCoord x1;
+ register wxCoord x2;
+ register BoxPtr pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while ((r1 != r1End) && (r2 != r2End))
{
- x1 = wxMax(r1->x1,r2->x1);
- x2 = wxMin(r1->x2,r2->x2);
-
- /*
- * If there's any overlap between the two rectangles, add that
- * overlap to the new region.
- * There's no need to check for subsumption because the only way
- * such a need could arise is if some region has two rectangles
- * right next to each other. Since that should never happen...
- */
- if (x1 < x2)
- {
- assert(y1<y2);
-
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
- assert(pReg->numRects <= pReg->size);
- }
-
- /*
- * Need to advance the pointers. Shift the one that extends
- * to the right the least, since the other still has a chance to
- * overlap with that region's next rectangle, if you see what I mean.
- */
- if (r1->x2 < r2->x2)
- {
- r1++;
- }
- else if (r2->x2 < r1->x2)
- {
- r2++;
- }
- else
- {
- r1++;
- r2++;
- }
+ x1 = wxMax(r1->x1,r2->x1);
+ x2 = wxMin(r1->x2,r2->x2);
+
+ /*
+ * If there's any overlap between the two rectangles, add that
+ * overlap to the new region.
+ * There's no need to check for subsumption because the only way
+ * such a need could arise is if some region has two rectangles
+ * right next to each other. Since that should never happen...
+ */
+ if (x1 < x2)
+ {
+ assert(y1<y2);
+
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = x2;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+ assert(pReg->numRects <= pReg->size);
+ }
+
+ /*
+ * Need to advance the pointers. Shift the one that extends
+ * to the right the least, since the other still has a chance to
+ * overlap with that region's next rectangle, if you see what I mean.
+ */
+ if (r1->x2 < r2->x2)
+ {
+ r1++;
+ }
+ else if (r2->x2 < r1->x2)
+ {
+ r2++;
+ }
+ else
+ {
+ r1++;
+ r2++;
+ }
}
- return 0; /* lint */
+ return 0; /* lint */
}
bool REGION::
XIntersectRegion(
- Region reg1,
- Region reg2, /* source regions */
- register Region newReg) /* destination Region */
+ Region reg1,
+ Region reg2, /* source regions */
+ register Region newReg) /* destination Region */
{
/* check for trivial reject */
if ( (!(reg1->numRects)) || (!(reg2->numRects)) ||
- (!EXTENTCHECK(®1->extents, ®2->extents)))
+ (!EXTENTCHECK(®1->extents, ®2->extents)))
newReg->numRects = 0;
else
- miRegionOp (newReg, reg1, reg2,
- miIntersectO, NULL, NULL);
-
+ miRegionOp (newReg, reg1, reg2,
+ miIntersectO, NULL, NULL);
+
/*
* Can't alter newReg's extents before we call miRegionOp because
* it might be one of the source regions and miRegionOp depends
{
if (dstrgn != rgn) /* don't want to copy to itself */
- {
+ {
if (dstrgn->size < rgn->numRects)
{
if (dstrgn->rects)
{
- BOX *prevRects = dstrgn->rects;
-
+ BOX *prevRects = dstrgn->rects;
+
if (! (dstrgn->rects = (BOX *)
- realloc((char *) dstrgn->rects,
- (unsigned) rgn->numRects * (sizeof(BOX))))) {
- free(prevRects);
- return;
- }
+ realloc((char *) dstrgn->rects,
+ (unsigned) rgn->numRects * (sizeof(BOX)))))
+ {
+ free(prevRects);
+ return;
+ }
}
dstrgn->size = rgn->numRects;
- }
+ }
dstrgn->numRects = rgn->numRects;
dstrgn->extents.x1 = rgn->extents.x1;
dstrgn->extents.y1 = rgn->extents.y1;
dstrgn->extents.x2 = rgn->extents.x2;
dstrgn->extents.y2 = rgn->extents.y2;
- memcpy((char *) dstrgn->rects, (char *) rgn->rects,
- (int) (rgn->numRects * sizeof(BOX)));
+ memcpy((char *) dstrgn->rects, (char *) rgn->rects,
+ (int) (rgn->numRects * sizeof(BOX)));
}
}
/*======================================================================
- * Generic Region Operator
+ * Generic Region Operator
*====================================================================*/
/*-
*-----------------------------------------------------------------------
* miCoalesce --
- * Attempt to merge the boxes in the current band with those in the
- * previous one. Used only by miRegionOp.
+ * Attempt to merge the boxes in the current band with those in the
+ * previous one. Used only by miRegionOp.
*
* Results:
- * The new index for the previous band.
+ * The new index for the previous band.
*
* Side Effects:
- * If coalescing takes place:
- * - rectangles in the previous band will have their y2 fields
- * altered.
- * - pReg->numRects will be decreased.
+ * If coalescing takes place:
+ * - rectangles in the previous band will have their y2 fields
+ * altered.
+ * - pReg->numRects will be decreased.
*
*-----------------------------------------------------------------------
*/
/* static int*/
int REGION::
miCoalesce(
- register Region pReg, /* Region to coalesce */
- int prevStart, /* Index of start of previous band */
- int curStart) /* Index of start of current band */
+ register Region pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart) /* Index of start of current band */
{
- register BoxPtr pPrevBox; /* Current box in previous band */
- register BoxPtr pCurBox; /* Current box in current band */
- register BoxPtr pRegEnd; /* End of region */
- int curNumRects; /* Number of rectangles in current
- * band */
- int prevNumRects; /* Number of rectangles in previous
- * band */
- int bandY1; /* Y1 coordinate for current band */
+ register BoxPtr pPrevBox; /* Current box in previous band */
+ register BoxPtr pCurBox; /* Current box in current band */
+ register BoxPtr pRegEnd; /* End of region */
+ int curNumRects; /* Number of rectangles in current
+ * band */
+ int prevNumRects; /* Number of rectangles in previous
+ * band */
+ int bandY1; /* Y1 coordinate for current band */
pRegEnd = &pReg->rects[pReg->numRects];
pCurBox = &pReg->rects[curStart];
bandY1 = pCurBox->y1;
for (curNumRects = 0;
- (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1);
- curNumRects++)
+ (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1);
+ curNumRects++)
{
- pCurBox++;
+ pCurBox++;
}
-
+
if (pCurBox != pRegEnd)
{
- /*
- * If more than one band was added, we have to find the start
- * of the last band added so the next coalescing job can start
- * at the right place... (given when multiple bands are added,
- * this may be pointless -- see above).
- */
- pRegEnd--;
- while (pRegEnd[-1].y1 == pRegEnd->y1)
- {
- pRegEnd--;
- }
- curStart = pRegEnd - pReg->rects;
- pRegEnd = pReg->rects + pReg->numRects;
+ /*
+ * If more than one band was added, we have to find the start
+ * of the last band added so the next coalescing job can start
+ * at the right place... (given when multiple bands are added,
+ * this may be pointless -- see above).
+ */
+ pRegEnd--;
+ while (pRegEnd[-1].y1 == pRegEnd->y1)
+ {
+ pRegEnd--;
+ }
+ curStart = pRegEnd - pReg->rects;
+ pRegEnd = pReg->rects + pReg->numRects;
}
-
- if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
- pCurBox -= curNumRects;
- /*
- * The bands may only be coalesced if the bottom of the previous
- * matches the top scanline of the current.
- */
- if (pPrevBox->y2 == pCurBox->y1)
- {
- /*
- * Make sure the bands have boxes in the same places. This
- * assumes that boxes have been added in such a way that they
- * cover the most area possible. I.e. two boxes in a band must
- * have some horizontal space between them.
- */
- do
- {
- if ((pPrevBox->x1 != pCurBox->x1) ||
- (pPrevBox->x2 != pCurBox->x2))
- {
- /*
- * The bands don't line up so they can't be coalesced.
- */
- return (curStart);
- }
- pPrevBox++;
- pCurBox++;
- prevNumRects -= 1;
- } while (prevNumRects != 0);
-
- pReg->numRects -= curNumRects;
- pCurBox -= curNumRects;
- pPrevBox -= curNumRects;
-
- /*
- * The bands may be merged, so set the bottom y of each box
- * in the previous band to that of the corresponding box in
- * the current band.
- */
- do
- {
- pPrevBox->y2 = pCurBox->y2;
- pPrevBox++;
- pCurBox++;
- curNumRects -= 1;
- } while (curNumRects != 0);
-
- /*
- * If only one band was added to the region, we have to backup
- * curStart to the start of the previous band.
- *
- * If more than one band was added to the region, copy the
- * other bands down. The assumption here is that the other bands
- * came from the same region as the current one and no further
- * coalescing can be done on them since it's all been done
- * already... curStart is already in the right place.
- */
- if (pCurBox == pRegEnd)
- {
- curStart = prevStart;
- }
- else
- {
- do
- {
- *pPrevBox++ = *pCurBox++;
- } while (pCurBox != pRegEnd);
- }
-
- }
+
+ if ((curNumRects == prevNumRects) && (curNumRects != 0))
+ {
+ pCurBox -= curNumRects;
+ /*
+ * The bands may only be coalesced if the bottom of the previous
+ * matches the top scanline of the current.
+ */
+ if (pPrevBox->y2 == pCurBox->y1)
+ {
+ /*
+ * Make sure the bands have boxes in the same places. This
+ * assumes that boxes have been added in such a way that they
+ * cover the most area possible. I.e. two boxes in a band must
+ * have some horizontal space between them.
+ */
+ do
+ {
+ if ((pPrevBox->x1 != pCurBox->x1) ||
+ (pPrevBox->x2 != pCurBox->x2))
+ {
+ /*
+ * The bands don't line up so they can't be coalesced.
+ */
+ return (curStart);
+ }
+ pPrevBox++;
+ pCurBox++;
+ prevNumRects -= 1;
+ } while (prevNumRects != 0);
+
+ pReg->numRects -= curNumRects;
+ pCurBox -= curNumRects;
+ pPrevBox -= curNumRects;
+
+ /*
+ * The bands may be merged, so set the bottom y of each box
+ * in the previous band to that of the corresponding box in
+ * the current band.
+ */
+ do
+ {
+ pPrevBox->y2 = pCurBox->y2;
+ pPrevBox++;
+ pCurBox++;
+ curNumRects -= 1;
+ } while (curNumRects != 0);
+
+ /*
+ * If only one band was added to the region, we have to backup
+ * curStart to the start of the previous band.
+ *
+ * If more than one band was added to the region, copy the
+ * other bands down. The assumption here is that the other bands
+ * came from the same region as the current one and no further
+ * coalescing can be done on them since it's all been done
+ * already... curStart is already in the right place.
+ */
+ if (pCurBox == pRegEnd)
+ {
+ curStart = prevStart;
+ }
+ else
+ {
+ do
+ {
+ *pPrevBox++ = *pCurBox++;
+ } while (pCurBox != pRegEnd);
+ }
+
+ }
}
return (curStart);
}
/*-
*-----------------------------------------------------------------------
* miRegionOp --
- * Apply an operation to two regions. Called by miUnion, miInverse,
- * miSubtract, miIntersect...
+ * Apply an operation to two regions. Called by miUnion, miInverse,
+ * miSubtract, miIntersect...
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * The new region is overwritten.
+ * The new region is overwritten.
*
* Notes:
- * The idea behind this function is to view the two regions as sets.
- * Together they cover a rectangle of area that this function divides
- * into horizontal bands where points are covered only by one region
- * or by both. For the first case, the nonOverlapFunc is called with
- * each the band and the band's upper and lower extents. For the
- * second, the overlapFunc is called to process the entire band. It
- * is responsible for clipping the rectangles in the band, though
- * this function provides the boundaries.
- * At the end of each band, the new region is coalesced, if possible,
- * to reduce the number of rectangles in the region.
+ * The idea behind this function is to view the two regions as sets.
+ * Together they cover a rectangle of area that this function divides
+ * into horizontal bands where points are covered only by one region
+ * or by both. For the first case, the nonOverlapFunc is called with
+ * each the band and the band's upper and lower extents. For the
+ * second, the overlapFunc is called to process the entire band. It
+ * is responsible for clipping the rectangles in the band, though
+ * this function provides the boundaries.
+ * At the end of each band, the new region is coalesced, if possible,
+ * to reduce the number of rectangles in the region.
*
*-----------------------------------------------------------------------
*/
/* static void*/
void REGION::
miRegionOp(
- register Region newReg, /* Place to store result */
- Region reg1, /* First region in operation */
- Region reg2, /* 2d region in operation */
- int (*overlapFunc)(
+ register Region newReg, /* Place to store result */
+ Region reg1, /* First region in operation */
+ Region reg2, /* 2d region in operation */
+ int (*overlapFunc)(
register Region pReg,
register BoxPtr r1,
BoxPtr r1End,
register BoxPtr r2,
BoxPtr r2End,
wxCoord y1,
- wxCoord y2), /* Function to call for over-
- * lapping bands */
- int (*nonOverlap1Func)(
+ wxCoord y2), /* Function to call for over-
+ * lapping bands */
+ int (*nonOverlap1Func)(
register Region pReg,
register BoxPtr r,
BoxPtr rEnd,
register wxCoord y1,
- register wxCoord y2), /* Function to call for non-
- * overlapping bands in region
- * 1 */
- int (*nonOverlap2Func)(
+ register wxCoord y2), /* Function to call for non-
+ * overlapping bands in region
+ * 1 */
+ int (*nonOverlap2Func)(
register Region pReg,
register BoxPtr r,
BoxPtr rEnd,
register wxCoord y1,
- register wxCoord y2)) /* Function to call for non-
- * overlapping bands in region
- * 2 */
+ register wxCoord y2)) /* Function to call for non-
+ * overlapping bands in region
+ * 2 */
{
- register BoxPtr r1; /* Pointer into first region */
- register BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- register wxCoord ybot; /* Bottom of intersection */
- register wxCoord ytop; /* Top of intersection */
- BoxPtr oldRects; /* Old rects for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- register BoxPtr r1BandEnd; /* End of current band in r1 */
- register BoxPtr r2BandEnd; /* End of current band in r2 */
- wxCoord top; /* Top of non-overlapping
- * band */
- wxCoord bot; /* Bottom of non-overlapping
- * band */
-
+ register BoxPtr r1; /* Pointer into first region */
+ register BoxPtr r2; /* Pointer into 2d region */
+ BoxPtr r1End; /* End of 1st region */
+ BoxPtr r2End; /* End of 2d region */
+ register wxCoord ybot; /* Bottom of intersection */
+ register wxCoord ytop; /* Top of intersection */
+ BoxPtr oldRects; /* Old rects for newReg */
+ int prevBand; /* Index of start of
+ * previous band in newReg */
+ int curBand; /* Index of start of current
+ * band in newReg */
+ register BoxPtr r1BandEnd; /* End of current band in r1 */
+ register BoxPtr r2BandEnd; /* End of current band in r2 */
+ wxCoord top; /* Top of non-overlapping
+ * band */
+ wxCoord bot; /* Bottom of non-overlapping
+ * band */
+
/*
* Initialization:
- * set r1, r2, r1End and r2End appropriately, preserve the important
+ * set r1, r2, r1End and r2End appropriately, preserve the important
* parts of the destination region until the end in case it's one of
* the two source regions, then mark the "new" region empty, allocating
* another array of rectangles for it to use.
r2 = reg2->rects;
r1End = r1 + reg1->numRects;
r2End = r2 + reg2->numRects;
-
+
oldRects = newReg->rects;
-
+
EMPTY_REGION(newReg);
/*
newReg->size = wxMax(reg1->numRects,reg2->numRects) * 2;
if (! (newReg->rects = (BoxPtr)
- malloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) {
- newReg->size = 0;
- return;
+ malloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) {
+ newReg->size = 0;
+ return;
}
-
+
/*
* Initialize ybot and ytop.
* In the upcoming loop, ybot and ytop serve different functions depending
* on whether the band being handled is an overlapping or non-overlapping
* band.
- * In the case of a non-overlapping band (only one of the regions
+ * In the case of a non-overlapping band (only one of the regions
* has points in the band), ybot is the bottom of the most recent
* intersection and thus clips the top of the rectangles in that band.
* ytop is the top of the next intersection between the two regions and
* serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
+ * For an overlapping band (where the two regions intersect), ytop clips
* the top of the rectangles of both regions and ybot clips the bottoms.
*/
if (reg1->extents.y1 < reg2->extents.y1)
- ybot = reg1->extents.y1;
+ ybot = reg1->extents.y1;
else
- ybot = reg2->extents.y1;
-
+ ybot = reg2->extents.y1;
+
/*
* prevBand serves to mark the start of the previous band so rectangles
* can be coalesced into larger rectangles. qv. miCoalesce, above.
* array of rectangles.
*/
prevBand = 0;
-
+
do
{
- curBand = newReg->numRects;
-
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- r1BandEnd = r1;
- while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1))
- {
- r1BandEnd++;
- }
-
- r2BandEnd = r2;
- while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1))
- {
- r2BandEnd++;
- }
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1->y1 < r2->y1)
- {
- top = wxMax(r1->y1,ybot);
- bot = wxMin(r1->y2,r2->y1);
-
- if ((top != bot) && (nonOverlap1Func != NULL))
- {
- (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
- }
-
- ytop = r2->y1;
- }
- else if (r2->y1 < r1->y1)
- {
- top = wxMax(r2->y1,ybot);
- bot = wxMin(r2->y2,r1->y1);
-
- if ((top != bot) && (nonOverlap2Func != NULL))
- {
- (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
- }
-
- ytop = r1->y1;
- }
- else
- {
- ytop = r1->y1;
- }
-
- /*
- * If any rectangles got added to the region, try and coalesce them
- * with rectangles from the previous band. Note we could just do
- * this test in miCoalesce, but some machines incur a not
- * inconsiderable cost for function calls, so...
- */
- if (newReg->numRects != curBand)
- {
- prevBand = miCoalesce (newReg, prevBand, curBand);
- }
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot > ytop
- */
- ybot = wxMin(r1->y2, r2->y2);
- curBand = newReg->numRects;
- if (ybot > ytop)
- {
- (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
-
- }
-
- if (newReg->numRects != curBand)
- {
- prevBand = miCoalesce (newReg, prevBand, curBand);
- }
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->y2 == ybot)
- {
- r1 = r1BandEnd;
- }
- if (r2->y2 == ybot)
- {
- r2 = r2BandEnd;
- }
+ curBand = newReg->numRects;
+
+ /*
+ * This algorithm proceeds one source-band (as opposed to a
+ * destination band, which is determined by where the two regions
+ * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
+ * rectangle after the last one in the current band for their
+ * respective regions.
+ */
+ r1BandEnd = r1;
+ while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1))
+ {
+ r1BandEnd++;
+ }
+
+ r2BandEnd = r2;
+ while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1))
+ {
+ r2BandEnd++;
+ }
+
+ /*
+ * First handle the band that doesn't intersect, if any.
+ *
+ * Note that attention is restricted to one band in the
+ * non-intersecting region at once, so if a region has n
+ * bands between the current position and the next place it overlaps
+ * the other, this entire loop will be passed through n times.
+ */
+ if (r1->y1 < r2->y1)
+ {
+ top = wxMax(r1->y1,ybot);
+ bot = wxMin(r1->y2,r2->y1);
+
+ if ((top != bot) && (nonOverlap1Func != NULL))
+ {
+ (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
+ }
+
+ ytop = r2->y1;
+ }
+ else if (r2->y1 < r1->y1)
+ {
+ top = wxMax(r2->y1,ybot);
+ bot = wxMin(r2->y2,r1->y1);
+
+ if ((top != bot) && (nonOverlap2Func != NULL))
+ {
+ (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
+ }
+
+ ytop = r1->y1;
+ }
+ else
+ {
+ ytop = r1->y1;
+ }
+
+ /*
+ * If any rectangles got added to the region, try and coalesce them
+ * with rectangles from the previous band. Note we could just do
+ * this test in miCoalesce, but some machines incur a not
+ * inconsiderable cost for function calls, so...
+ */
+ if (newReg->numRects != curBand)
+ {
+ prevBand = miCoalesce (newReg, prevBand, curBand);
+ }
+
+ /*
+ * Now see if we've hit an intersecting band. The two bands only
+ * intersect if ybot > ytop
+ */
+ ybot = wxMin(r1->y2, r2->y2);
+ curBand = newReg->numRects;
+ if (ybot > ytop)
+ {
+ (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
+
+ }
+
+ if (newReg->numRects != curBand)
+ {
+ prevBand = miCoalesce (newReg, prevBand, curBand);
+ }
+
+ /*
+ * If we've finished with a band (y2 == ybot) we skip forward
+ * in the region to the next band.
+ */
+ if (r1->y2 == ybot)
+ {
+ r1 = r1BandEnd;
+ }
+ if (r2->y2 == ybot)
+ {
+ r2 = r2BandEnd;
+ }
} while ((r1 != r1End) && (r2 != r2End));
/*
curBand = newReg->numRects;
if (r1 != r1End)
{
- if (nonOverlap1Func != NULL)
- {
- do
- {
- r1BandEnd = r1;
- while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1))
- {
- r1BandEnd++;
- }
- (* nonOverlap1Func) (newReg, r1, r1BandEnd,
- wxMax(r1->y1,ybot), r1->y2);
- r1 = r1BandEnd;
- } while (r1 != r1End);
- }
+ if (nonOverlap1Func != NULL)
+ {
+ do
+ {
+ r1BandEnd = r1;
+ while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1))
+ {
+ r1BandEnd++;
+ }
+ (* nonOverlap1Func) (newReg, r1, r1BandEnd,
+ wxMax(r1->y1,ybot), r1->y2);
+ r1 = r1BandEnd;
+ } while (r1 != r1End);
+ }
}
else if ((r2 != r2End) && (nonOverlap2Func != NULL))
{
- do
- {
- r2BandEnd = r2;
- while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1))
- {
- r2BandEnd++;
- }
- (* nonOverlap2Func) (newReg, r2, r2BandEnd,
- wxMax(r2->y1,ybot), r2->y2);
- r2 = r2BandEnd;
- } while (r2 != r2End);
+ do
+ {
+ r2BandEnd = r2;
+ while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1))
+ {
+ r2BandEnd++;
+ }
+ (* nonOverlap2Func) (newReg, r2, r2BandEnd,
+ wxMax(r2->y1,ybot), r2->y2);
+ r2 = r2BandEnd;
+ } while (r2 != r2End);
}
if (newReg->numRects != curBand)
{
- (void) miCoalesce (newReg, prevBand, curBand);
+ (void) miCoalesce (newReg, prevBand, curBand);
}
/*
*/
if (newReg->numRects < (newReg->size >> 1))
{
- if (REGION_NOT_EMPTY(newReg))
- {
- BoxPtr prev_rects = newReg->rects;
- newReg->size = newReg->numRects;
- newReg->rects = (BoxPtr) realloc ((char *) newReg->rects,
- (unsigned) (sizeof(BoxRec) * newReg->size));
- if (! newReg->rects)
- newReg->rects = prev_rects;
- }
- else
- {
- /*
- * No point in doing the extra work involved in an realloc if
- * the region is empty
- */
- newReg->size = 1;
- free((char *) newReg->rects);
- newReg->rects = (BoxPtr) malloc(sizeof(BoxRec));
- }
+ if (REGION_NOT_EMPTY(newReg))
+ {
+ BoxPtr prev_rects = newReg->rects;
+ newReg->size = newReg->numRects;
+ newReg->rects = (BoxPtr) realloc ((char *) newReg->rects,
+ (unsigned) (sizeof(BoxRec) * newReg->size));
+ if (! newReg->rects)
+ newReg->rects = prev_rects;
+ }
+ else
+ {
+ /*
+ * No point in doing the extra work involved in an realloc if
+ * the region is empty
+ */
+ newReg->size = 1;
+ free((char *) newReg->rects);
+ newReg->rects = (BoxPtr) malloc(sizeof(BoxRec));
+ }
}
free ((char *) oldRects);
return;
}
/*======================================================================
- * Region Union
+ * Region Union
*====================================================================*/
/*-
*-----------------------------------------------------------------------
* miUnionNonO --
- * Handle a non-overlapping band for the union operation. Just
- * Adds the rectangles into the region. Doesn't have to check for
- * subsumption or anything.
+ * Handle a non-overlapping band for the union operation. Just
+ * Adds the rectangles into the region. Doesn't have to check for
+ * subsumption or anything.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * pReg->numRects is incremented and the final rectangles overwritten
- * with the rectangles we're passed.
+ * pReg->numRects is incremented and the final rectangles overwritten
+ * with the rectangles we're passed.
*
*-----------------------------------------------------------------------
*/
/* static void*/
int REGION::
miUnionNonO (
- register Region pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2)
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register wxCoord y1,
+ register wxCoord y2)
{
- register BoxPtr pNextRect;
+ register BoxPtr pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while (r != rEnd)
{
- assert(r->x1 < r->x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = r->x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
- r++;
+ assert(r->x1 < r->x2);
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = r->x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = r->x2;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+
+ assert(pReg->numRects<=pReg->size);
+ r++;
}
- return 0; /* lint */
+ return 0; /* lint */
}
/*-
*-----------------------------------------------------------------------
* miUnionO --
- * Handle an overlapping band for the union operation. Picks the
- * left-most rectangle each time and merges it into the region.
+ * Handle an overlapping band for the union operation. Picks the
+ * left-most rectangle each time and merges it into the region.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * Rectangles are overwritten in pReg->rects and pReg->numRects will
- * be changed.
+ * Rectangles are overwritten in pReg->rects and pReg->numRects will
+ * be changed.
*
*-----------------------------------------------------------------------
*/
/* static void*/
int REGION::
miUnionO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register wxCoord y1,
- register wxCoord y2)
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register wxCoord y1,
+ register wxCoord y2)
{
- register BoxPtr pNextRect;
-
+ register BoxPtr pNextRect;
+
pNextRect = &pReg->rects[pReg->numRects];
#define MERGERECT(r) \
if ((pReg->numRects != 0) && \
- (pNextRect[-1].y1 == y1) && \
- (pNextRect[-1].y2 == y2) && \
- (pNextRect[-1].x2 >= r->x1)) \
+ (pNextRect[-1].y1 == y1) && \
+ (pNextRect[-1].y2 == y2) && \
+ (pNextRect[-1].x2 >= r->x1)) \
{ \
- if (pNextRect[-1].x2 < r->x2) \
- { \
- pNextRect[-1].x2 = r->x2; \
- assert(pNextRect[-1].x1<pNextRect[-1].x2); \
- } \
+ if (pNextRect[-1].x2 < r->x2) \
+ { \
+ pNextRect[-1].x2 = r->x2; \
+ assert(pNextRect[-1].x1<pNextRect[-1].x2); \
+ } \
} \
else \
{ \
- MEMCHECK(pReg, pNextRect, pReg->rects); \
- pNextRect->y1 = y1; \
- pNextRect->y2 = y2; \
- pNextRect->x1 = r->x1; \
- pNextRect->x2 = r->x2; \
- pReg->numRects += 1; \
+ MEMCHECK(pReg, pNextRect, pReg->rects); \
+ pNextRect->y1 = y1; \
+ pNextRect->y2 = y2; \
+ pNextRect->x1 = r->x1; \
+ pNextRect->x2 = r->x2; \
+ pReg->numRects += 1; \
pNextRect += 1; \
} \
assert(pReg->numRects<=pReg->size);\
r++;
-
+
assert (y1<y2);
while ((r1 != r1End) && (r2 != r2End))
{
- if (r1->x1 < r2->x1)
- {
- MERGERECT(r1);
- }
- else
- {
- MERGERECT(r2);
- }
+ if (r1->x1 < r2->x1)
+ {
+ MERGERECT(r1);
+ }
+ else
+ {
+ MERGERECT(r2);
+ }
}
-
+
if (r1 != r1End)
{
- do
- {
- MERGERECT(r1);
- } while (r1 != r1End);
+ do
+ {
+ MERGERECT(r1);
+ } while (r1 != r1End);
}
else while (r2 != r2End)
{
- MERGERECT(r2);
+ MERGERECT(r2);
}
- return 0; /* lint */
+ return 0; /* lint */
}
bool REGION::
XUnionRegion(
- Region reg1,
- Region reg2, /* source regions */
- Region newReg) /* destination Region */
+ Region reg1,
+ Region reg2, /* source regions */
+ Region newReg) /* destination Region */
{
/* checks all the simple cases */
/*
* Region 1 completely subsumes region 2
*/
- if ((reg1->numRects == 1) &&
- (reg1->extents.x1 <= reg2->extents.x1) &&
- (reg1->extents.y1 <= reg2->extents.y1) &&
- (reg1->extents.x2 >= reg2->extents.x2) &&
- (reg1->extents.y2 >= reg2->extents.y2))
+ if ((reg1->numRects == 1) &&
+ (reg1->extents.x1 <= reg2->extents.x1) &&
+ (reg1->extents.y1 <= reg2->extents.y1) &&
+ (reg1->extents.x2 >= reg2->extents.x2) &&
+ (reg1->extents.y2 >= reg2->extents.y2))
{
if (newReg != reg1)
miRegionCopy(newReg, reg1);
/*
* Region 2 completely subsumes region 1
*/
- if ((reg2->numRects == 1) &&
- (reg2->extents.x1 <= reg1->extents.x1) &&
- (reg2->extents.y1 <= reg1->extents.y1) &&
- (reg2->extents.x2 >= reg1->extents.x2) &&
- (reg2->extents.y2 >= reg1->extents.y2))
+ if ((reg2->numRects == 1) &&
+ (reg2->extents.x1 <= reg1->extents.x1) &&
+ (reg2->extents.y1 <= reg1->extents.y1) &&
+ (reg2->extents.x2 >= reg1->extents.x2) &&
+ (reg2->extents.y2 >= reg1->extents.y2))
{
if (newReg != reg2)
miRegionCopy(newReg, reg2);
return 1;
}
- miRegionOp (newReg, reg1, reg2, miUnionO,
- miUnionNonO, miUnionNonO);
+ miRegionOp (newReg, reg1, reg2, miUnionO,
+ miUnionNonO, miUnionNonO);
newReg->extents.x1 = wxMin(reg1->extents.x1, reg2->extents.x1);
newReg->extents.y1 = wxMin(reg1->extents.y1, reg2->extents.y1);
}
/*======================================================================
- * Region Subtraction
+ * Region Subtraction
*====================================================================*/
/*-
*-----------------------------------------------------------------------
* miSubtractNonO --
- * Deal with non-overlapping band for subtraction. Any parts from
- * region 2 we discard. Anything from region 1 we add to the region.
+ * Deal with non-overlapping band for subtraction. Any parts from
+ * region 2 we discard. Anything from region 1 we add to the region.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * pReg may be affected.
+ * pReg may be affected.
*
*-----------------------------------------------------------------------
*/
/* static void*/
int REGION::
miSubtractNonO1 (
- register Region pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register wxCoord y1,
- register wxCoord y2)
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register wxCoord y1,
+ register wxCoord y2)
{
- register BoxPtr pNextRect;
-
+ register BoxPtr pNextRect;
+
pNextRect = &pReg->rects[pReg->numRects];
-
+
assert(y1<y2);
while (r != rEnd)
{
- assert(r->x1<r->x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = r->x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects <= pReg->size);
-
- r++;
+ assert(r->x1<r->x2);
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = r->x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = r->x2;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+
+ assert(pReg->numRects <= pReg->size);
+
+ r++;
}
- return 0; /* lint */
+ return 0; /* lint */
}
/*-
*-----------------------------------------------------------------------
* miSubtractO --
- * Overlapping band subtraction. x1 is the left-most point not yet
- * checked.
+ * Overlapping band subtraction. x1 is the left-most point not yet
+ * checked.
*
* Results:
- * None.
+ * None.
*
* Side Effects:
- * pReg may have rectangles added to it.
+ * pReg may have rectangles added to it.
*
*-----------------------------------------------------------------------
*/
/* static void*/
int REGION::
miSubtractO (
- register Region pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register wxCoord y1,
- register wxCoord y2)
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register wxCoord y1,
+ register wxCoord y2)
{
- register BoxPtr pNextRect;
- register int x1;
-
+ register BoxPtr pNextRect;
+ register int x1;
+
x1 = r1->x1;
-
+
assert(y1<y2);
pNextRect = &pReg->rects[pReg->numRects];
while ((r1 != r1End) && (r2 != r2End))
{
- if (r2->x2 <= x1)
- {
- /*
- * Subtrahend missed the boat: go to next subtrahend.
- */
- r2++;
- }
- else if (r2->x1 <= x1)
- {
- /*
- * Subtrahend preceeds minuend: nuke left edge of minuend.
- */
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend completely covered: advance to next minuend and
- * reset left fence to edge of new minuend.
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend now used up since it doesn't extend beyond
- * minuend
- */
- r2++;
- }
- }
- else if (r2->x1 < r1->x2)
- {
- /*
- * Left part of subtrahend covers part of minuend: add uncovered
- * part of minuend to region and skip to next subtrahend.
- */
- assert(x1<r2->x1);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r2->x1;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
-
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend used up: advance to new...
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend used up
- */
- r2++;
- }
- }
- else
- {
- /*
- * Minuend used up: add any remaining piece before advancing.
- */
- if (r1->x2 > x1)
- {
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r1->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
- assert(pReg->numRects<=pReg->size);
- }
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
+ if (r2->x2 <= x1)
+ {
+ /*
+ * Subtrahend missed the boat: go to next subtrahend.
+ */
+ r2++;
+ }
+ else if (r2->x1 <= x1)
+ {
+ /*
+ * Subtrahend preceeds minuend: nuke left edge of minuend.
+ */
+ x1 = r2->x2;
+ if (x1 >= r1->x2)
+ {
+ /*
+ * Minuend completely covered: advance to next minuend and
+ * reset left fence to edge of new minuend.
+ */
+ r1++;
+ if (r1 != r1End)
+ x1 = r1->x1;
+ }
+ else
+ {
+ /*
+ * Subtrahend now used up since it doesn't extend beyond
+ * minuend
+ */
+ r2++;
+ }
+ }
+ else if (r2->x1 < r1->x2)
+ {
+ /*
+ * Left part of subtrahend covers part of minuend: add uncovered
+ * part of minuend to region and skip to next subtrahend.
+ */
+ assert(x1<r2->x1);
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = r2->x1;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+
+ assert(pReg->numRects<=pReg->size);
+
+ x1 = r2->x2;
+ if (x1 >= r1->x2)
+ {
+ /*
+ * Minuend used up: advance to new...
+ */
+ r1++;
+ if (r1 != r1End)
+ x1 = r1->x1;
+ }
+ else
+ {
+ /*
+ * Subtrahend used up
+ */
+ r2++;
+ }
+ }
+ else
+ {
+ /*
+ * Minuend used up: add any remaining piece before advancing.
+ */
+ if (r1->x2 > x1)
+ {
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = r1->x2;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+ assert(pReg->numRects<=pReg->size);
+ }
+ r1++;
+ if (r1 != r1End)
+ x1 = r1->x1;
+ }
}
/*
*/
while (r1 != r1End)
{
- assert(x1<r1->x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r1->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
-
- r1++;
- if (r1 != r1End)
- {
- x1 = r1->x1;
- }
+ assert(x1<r1->x2);
+ MEMCHECK(pReg, pNextRect, pReg->rects);
+ pNextRect->x1 = x1;
+ pNextRect->y1 = y1;
+ pNextRect->x2 = r1->x2;
+ pNextRect->y2 = y2;
+ pReg->numRects += 1;
+ pNextRect++;
+
+ assert(pReg->numRects<=pReg->size);
+
+ r1++;
+ if (r1 != r1End)
+ {
+ x1 = r1->x1;
+ }
}
- return 0; /* lint */
+ return 0; /* lint */
}
-
+
/*-
*-----------------------------------------------------------------------
* miSubtract --
- * Subtract regS from regM and leave the result in regD.
- * S stands for subtrahend, M for minuend and D for difference.
+ * Subtract regS from regM and leave the result in regD.
+ * S stands for subtrahend, M for minuend and D for difference.
*
* Results:
- * true.
+ * true.
*
* Side Effects:
- * regD is overwritten.
+ * regD is overwritten.
*
*-----------------------------------------------------------------------
*/
bool REGION::
XSubtractRegion(
- Region regM,
- Region regS,
- register Region regD)
+ Region regM,
+ Region regS,
+ register Region regD)
{
/* check for trivial reject */
if ( (!(regM->numRects)) || (!(regS->numRects)) ||
- (!EXTENTCHECK(®M->extents, ®S->extents)) )
+ (!EXTENTCHECK(®M->extents, ®S->extents)) )
{
- miRegionCopy(regD, regM);
+ miRegionCopy(regD, regM);
return true;
}
-
- miRegionOp (regD, regM, regS, miSubtractO,
- miSubtractNonO1, NULL);
+
+ miRegionOp (regD, regM, regS, miSubtractO,
+ miSubtractNonO1, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
Region tra, trb;
if ((! (tra = XCreateRegion())) || (! (trb = XCreateRegion())))
- return 0;
+ return 0;
(void) XSubtractRegion(sra,srb,tra);
(void) XSubtractRegion(srb,sra,trb);
(void) XUnionRegion(tra,trb,dr);
}
/*
- * Check to see if the region is empty. Assumes a region is passed
+ * Check to see if the region is empty. Assumes a region is passed
* as a parameter
*/
bool REGION::
}
/*
- * Check to see if two regions are equal
+ * Check to see if two regions are equal
*/
bool REGION::
XEqualRegion(Region r1, Region r2)
else if ( r1->extents.y1 != r2->extents.y1 ) return false;
else if ( r1->extents.y2 != r2->extents.y2 ) return false;
else for( i=0; i < r1->numRects; i++ ) {
- if ( r1->rects[i].x1 != r2->rects[i].x1 ) return false;
- else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return false;
- else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return false;
- else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return false;
+ if ( r1->rects[i].x1 != r2->rects[i].x1 ) return false;
+ else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return false;
+ else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return false;
+ else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return false;
}
return true;
}
for (i=0; i<pRegion->numRects; i++)
{
if (INBOX (pRegion->rects[i], x, y))
- return true;
+ return true;
}
return false;
}
wxRegionContain REGION::
XRectInRegion(
- register Region region,
+ register Region region,
int rx, int ry,
unsigned int rwidth, unsigned int rheight)
{
prect->y1 = ry;
prect->x2 = rwidth + rx;
prect->y2 = rheight + ry;
-
+
/* this is (just) a useful optimization */
if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect))
return(wxOutRegion);
- partOut = FALSE;
- partIn = FALSE;
+ partOut = false;
+ partIn = false;
- /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */
+ /* can stop when both partOut and partIn are true, or we reach prect->y2 */
for (pbox = region->rects, pboxEnd = pbox + region->numRects;
- pbox < pboxEnd;
- pbox++)
+ pbox < pboxEnd;
+ pbox++)
{
- if (pbox->y2 <= ry)
- continue; /* getting up to speed or skipping remainder of band */
-
- if (pbox->y1 > ry)
- {
- partOut = TRUE; /* missed part of rectangle above */
- if (partIn || (pbox->y1 >= prect->y2))
- break;
- ry = pbox->y1; /* x guaranteed to be == prect->x1 */
- }
-
- if (pbox->x2 <= rx)
- continue; /* not far enough over yet */
-
- if (pbox->x1 > rx)
- {
- partOut = TRUE; /* missed part of rectangle to left */
- if (partIn)
- break;
- }
-
- if (pbox->x1 < prect->x2)
- {
- partIn = TRUE; /* definitely overlap */
- if (partOut)
- break;
- }
-
- if (pbox->x2 >= prect->x2)
- {
- ry = pbox->y2; /* finished with this band */
- if (ry >= prect->y2)
- break;
- rx = prect->x1; /* reset x out to left again */
- } else
- {
- /*
- * Because boxes in a band are maximal width, if the first box
- * to overlap the rectangle doesn't completely cover it in that
- * band, the rectangle must be partially out, since some of it
- * will be uncovered in that band. partIn will have been set true
- * by now...
- */
- break;
- }
+ if (pbox->y2 <= ry)
+ continue; /* getting up to speed or skipping remainder of band */
+
+ if (pbox->y1 > ry)
+ {
+ partOut = true; /* missed part of rectangle above */
+ if (partIn || (pbox->y1 >= prect->y2))
+ break;
+ ry = pbox->y1; /* x guaranteed to be == prect->x1 */
+ }
+
+ if (pbox->x2 <= rx)
+ continue; /* not far enough over yet */
+
+ if (pbox->x1 > rx)
+ {
+ partOut = true; /* missed part of rectangle to left */
+ if (partIn)
+ break;
+ }
+
+ if (pbox->x1 < prect->x2)
+ {
+ partIn = true; /* definitely overlap */
+ if (partOut)
+ break;
+ }
+
+ if (pbox->x2 >= prect->x2)
+ {
+ ry = pbox->y2; /* finished with this band */
+ if (ry >= prect->y2)
+ break;
+ rx = prect->x1; /* reset x out to left again */
+ } else
+ {
+ /*
+ * Because boxes in a band are maximal width, if the first box
+ * to overlap the rectangle doesn't completely cover it in that
+ * band, the rectangle must be partially out, since some of it
+ * will be uncovered in that band. partIn will have been set true
+ * by now...
+ */
+ break;
+ }
}
- return(partIn ? ((ry < prect->y2) ? wxPartRegion : wxInRegion) :
- wxOutRegion);
+ return(partIn ? ((ry < prect->y2) ? wxPartRegion : wxInRegion) :
+ wxOutRegion);
}
{
if (sm_rendererGeneric)
delete sm_rendererGeneric;
-
+
sm_rendererGeneric = NULL;
}
const wxCoord h = size.y;
wxCoord offset = 0;
-
+
// If we're drawing the border, draw the sash 3d lines shorter
if ( win->HasFlag(wxSP_3DBORDER) )
{
}
dc.SetPen(*wxTRANSPARENT_PEN);
- dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
-
+ dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
+
if ( win->HasFlag(wxSP_3DSASH) )
{
// Draw the 3D sash
m_maximumPaneSizeY = 10000;
m_sashCursorWE = new wxCursor(wxCURSOR_SIZEWE);
m_sashCursorNS = new wxCursor(wxCURSOR_SIZENS);
- m_mouseCaptured = FALSE;
+ m_mouseCaptured = false;
m_currentCursor = NULL;
// Eventually, we'll respond to colour change messages
if (event.LeftDown())
{
CaptureMouse();
- m_mouseCaptured = TRUE;
+ m_mouseCaptured = true;
if ( sashHit != wxSASH_NONE )
{
// Wasn't a proper drag
if (m_mouseCaptured)
ReleaseMouse();
- m_mouseCaptured = FALSE;
+ m_mouseCaptured = false;
wxScreenDC::EndDrawingOnTop();
m_dragMode = wxSASH_DRAG_NONE;
m_dragMode = wxSASH_DRAG_NONE;
if (m_mouseCaptured)
ReleaseMouse();
- m_mouseCaptured = FALSE;
+ m_mouseCaptured = false;
// Erase old tracker
DrawSashTracker(m_draggingEdge, m_oldX, m_oldY);
wxSashDragStatus status = wxSASH_STATUS_OK;
// the new height and width of the window - if -1, it didn't change
- int newHeight = -1,
- newWidth = -1;
+ int newHeight = wxDefaultSize.y,
+ newWidth = wxDefaultSize.x;
// NB: x and y may be negative and they're relative to the sash window
// upper left corner, while xp and yp are expressed in the parent
break;
}
- if ( newHeight == -1 )
+ if ( newHeight == wxDefaultSize.y )
{
// didn't change
newHeight = h;
newHeight = wxMin(newHeight, m_maximumPaneSizeY);
}
- if ( newWidth == -1 )
+ if ( newWidth == wxDefaultSize.x )
{
// didn't change
newWidth = w;
{
if (m_mouseCaptured)
ReleaseMouse();
- m_mouseCaptured = FALSE;
+ m_mouseCaptured = false;
}
else if (event.Moving() && !event.Dragging())
{
IMPLEMENT_CLASS(wxScrolledWindow, wxGenericScrolledWindow)
/*
- TODO PROPERTIES
- style wxHSCROLL | wxVSCROLL
+ TODO PROPERTIES
+ style wxHSCROLL | wxVSCROLL
*/
// ----------------------------------------------------------------------------
virtual bool ProcessEvent(wxEvent& event);
- void ResetDrawnFlag() { m_hasDrawnWindow = FALSE; }
+ void ResetDrawnFlag() { m_hasDrawnWindow = false; }
private:
wxScrollHelper *m_scrollHelper;
// anything in the window. We set it to true here but reset it to false in
// wxScrolledWindow::OnPaint() handler (which wouldn't be called if the
// user code defined OnPaint() in the derived class)
- m_hasDrawnWindow = TRUE;
+ m_hasDrawnWindow = true;
// pass it on to the real handler
bool processed = wxEvtHandler::ProcessEvent(event);
{
m_scrollHelper->HandleOnSize((wxSizeEvent &)event);
- return TRUE;
+ return true;
}
if ( processed )
// OnDraw() below (from HandleOnPaint)
if ( m_hasDrawnWindow )
{
- return TRUE;
+ return true;
}
}
- // reset the skipped flag to FALSE as it might have been set to TRUE in
+ // reset the skipped flag to false as it might have been set to true in
// ProcessEvent() above
- event.Skip(FALSE);
+ event.Skip(false);
if ( evType == wxEVT_PAINT )
{
m_scrollHelper->HandleOnPaint((wxPaintEvent &)event);
- return TRUE;
+ return true;
}
if ( evType == wxEVT_SCROLLWIN_TOP ||
return !event.GetSkipped();
}
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
m_yScrollLinesPerPage = 0;
m_xScrollingEnabled =
- m_yScrollingEnabled = TRUE;
+ m_yScrollingEnabled = true;
m_scaleX =
m_scaleY = 1.0;
m_targetWindow->SetVirtualSize( w, h );
if (do_refresh && !noRefresh)
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
#ifndef __WXUNIVERSAL__
// If the target is not the same as the window with the scrollbars,
m_win->SetScrollPos(wxVERTICAL, m_yScrollPosition);
}
- bool needsRefresh = FALSE;
+ bool needsRefresh = false;
int dx = 0,
dy = 0;
if (orient == wxHORIZONTAL)
}
else
{
- needsRefresh = TRUE;
+ needsRefresh = true;
}
}
else
}
else
{
- needsRefresh = TRUE;
+ needsRefresh = true;
}
}
if ( needsRefresh )
{
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
else
{
nScrollInc = noPositions - m_xScrollPosition; // As +ve as we can go
}
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
else
{
else
{
// VZ: why do we do this? (FIXME)
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
}
{
m_xScrollLines = 0;
m_xScrollPosition = 0;
- m_win->SetScrollbar (wxHORIZONTAL, 0, 0, 0, FALSE);
+ m_win->SetScrollbar (wxHORIZONTAL, 0, 0, 0, false);
}
else
{
m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0,
GetScrollRect() );
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
if (oldYScroll != m_yScrollPosition)
m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition),
GetScrollRect() );
else
- m_targetWindow->Refresh(TRUE, GetScrollRect());
+ m_targetWindow->Refresh(true, GetScrollRect());
}
}
CalcScrolledPosition(0,0, &x,&y);
GetVirtualSize(&w, &h);
GetSizer()->SetDimension(x, y, w, h);
- return TRUE;
+ return true;
}
// fall back to default for LayoutConstraints
{
m_itemsSel.AddAt(item, index);
- return TRUE;
+ return true;
}
}
else // reset to default state
if ( isSel )
{
m_itemsSel.RemoveAt(index);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
bool wxSelectionStore::SelectRange(size_t itemFrom, size_t itemTo,
: wxTextCtrl(spin->GetParent(), wxID_ANY, value)
{
m_spin = spin;
-
+
// remove the default minsize, the spinctrl will have one instead
SetSizeHints(wxDefaultSize.x,wxDefaultSize.y);
}
m_text = new wxSpinCtrlText(this, value);
m_btn = new wxSpinCtrlButton(this, style);
-
+
m_btn->SetRange(min, max);
m_btn->SetValue(initial);
SetBestSize(size);
-
+
// have to disable this window to avoid interfering it with message
// processing to the text and the button... but pretend it is enabled to
// make IsEnabled() return true
m_splashStyle = splashStyle;
m_milliseconds = milliseconds;
- m_window = new wxSplashScreenWindow(bitmap, this, -1, pos, size, wxNO_BORDER);
+ m_window = new wxSplashScreenWindow(bitmap, this, wxID_ANY, pos, size, wxNO_BORDER);
SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
if (m_splashStyle & wxSPLASH_TIMEOUT)
{
m_timer.SetOwner(this, wxSPLASH_TIMER_ID);
- m_timer.Start(milliseconds, TRUE);
+ m_timer.Start(milliseconds, true);
}
- Show(TRUE);
+ Show(true);
m_window->SetFocus();
#if defined( __WXMSW__ ) || defined(__WXMAC__)
Update(); // Without this, you see a blank screen for an instant
void wxSplashScreen::OnNotify(wxTimerEvent& WXUNUSED(event))
{
- Close(TRUE);
+ Close(true);
}
void wxSplashScreen::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
void wxSplashScreenWindow::OnMouseEvent(wxMouseEvent& event)
{
if (event.LeftDown() || event.RightDown())
- GetParent()->Close(TRUE);
+ GetParent()->Close(true);
}
void wxSplashScreenWindow::OnChar(wxKeyEvent& WXUNUSED(event))
{
- GetParent()->Close(TRUE);
+ GetParent()->Close(true);
}
#endif // wxUSE_SPLASH
IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
/*
- TODO PROPERTIES
- style wxSP_3D
- sashpos (long , 0 )
- minsize (long -1 )
- object, object_ref
- orientation
+ TODO PROPERTIES
+ style wxSP_3D
+ sashpos (long , 0 )
+ minsize (long -1 )
+ object, object_ref
+ orientation
*/
IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent)
SizeWindows();
return; // it won't needUpdating in this case
}
-
+
if (m_needUpdating)
SizeWindows();
}
{
// Start the drag now
m_dragMode = wxSPLIT_DRAG_DRAGGING;
-
+
// Capture mouse and set the cursor
CaptureMouse();
SetResizeCursor();
{
// We can stop dragging now and see what we've got.
m_dragMode = wxSPLIT_DRAG_NONE;
-
+
// Release mouse and unset the cursor
ReleaseMouse();
SetCursor(* wxSTANDARD_CURSOR);
int z = m_splitMode == wxSPLIT_VERTICAL ? x : y;
int hitMin = m_sashPosition - tolerance;
int hitMax = m_sashPosition + GetSashSize() + tolerance;
-
+
return z >= hitMin && z <= hitMax;
}
// right now (e.g. because the window is too small)
m_requestedSashPosition = sashPosition;
m_checkRequestedSashPosition = false;
-
+
DoSetSashPosition(ConvertSashPosition(sashPosition));
SizeWindows();
// right now (e.g. because the window is too small)
m_requestedSashPosition = position;
m_checkRequestedSashPosition = false;
-
+
DoSetSashPosition(ConvertSashPosition(position));
if ( redraw )
m_statbox = NULL;
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
// ok, this is ugly but it's better than nothing: use a thin static box to
// emulate static line
wxSize sizeReal = AdjustSize(size);
- m_statbox = new wxStaticBox(parent, id, wxT(""), pos, sizeReal, style, name);
+ m_statbox = new wxStaticBox(parent, id, wxEmptyString, pos, sizeReal, style, name);
- return TRUE;
+ return true;
}
wxStaticLine::~wxStaticLine()
if ( !wxWindow::Create(parent, id,
wxDefaultPosition, wxDefaultSize,
style | wxTAB_TRAVERSAL, name) )
- return FALSE;
+ return false;
// The status bar should have a themed background
- SetThemeEnabled( TRUE );
+ SetThemeEnabled( true );
// Don't wish this to be found as a child
#ifndef __WXMAC__
int height = (int)( (11*y)/10 + 2*GetBorderY());
- SetSize(-1, -1, -1, height);
+ SetSize(wxDefaultPosition.x, wxDefaultPosition.y, wxDefaultSize.x, height);
SetFieldsCount(1);
- return TRUE;
+ return true;
}
height = (int)( (11*y)/10 + 2*GetBorderY());
return wxSize(width, height);
-}
+}
void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
{
wxRect rect;
GetFieldRect(number, rect);
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
}
// Get the position and size of the field's internal bounding rectangle
bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const
{
- wxCHECK_MSG( (n >= 0) && (n < m_nFields), FALSE,
+ wxCHECK_MSG( (n >= 0) && (n < m_nFields), false,
_T("invalid status bar field index") );
// FIXME: workarounds for OS/2 bugs have nothing to do here (VZ)
rect.width = m_widthsAbs[n] - 2*m_borderX;
rect.height = height - 2*m_borderY;
- return TRUE;
+ return true;
}
// Initialize colours
if ( height > (11*y)/10 )
{
- SetSize(-1, -1, -1, height + 2*m_borderY);
+ SetSize(wxDefaultPosition.x, wxDefaultPosition.y, wxDefaultSize.x, height + 2*m_borderY);
}
}
}
else
{
- event.Skip( TRUE );
+ event.Skip( true );
}
#else
- event.Skip( TRUE );
+ event.Skip( true );
#endif
}
}
else
{
- event.Skip( TRUE );
+ event.Skip( true );
}
#else
- event.Skip( TRUE );
+ event.Skip( true );
#endif
}
wxTabControl::wxTabControl(wxTabView *v)
{
m_view = v;
- m_isSelected = FALSE;
+ m_isSelected = false;
m_offsetX = 0;
m_offsetY = 0;
m_width = 0;
int tabY2 = tabY1 + GetHeight();
if (x >= tabX1 && y >= tabY1 && x <= tabX2 && y <= tabY2)
- return TRUE;
+ return true;
else
- return FALSE;
+ return false;
}
IMPLEMENT_DYNAMIC_CLASS(wxTabView, wxObject)
wxTabView::~wxTabView()
{
- ClearTabs(TRUE);
+ ClearTabs(true);
}
// Automatically positions tabs
// The layout has changed
LayoutTabs();
- return TRUE;
+ return true;
}
tabNode = tabNode->GetNext();
}
layerNode = layerNode->GetNext();
}
- return FALSE;
+ return false;
}
bool wxTabView::SetTabText(int id, const wxString& label)
{
wxTabControl* control = FindTabControlForId(id);
if (!control)
- return FALSE;
+ return false;
control->SetLabel(label);
- return TRUE;
+ return true;
}
wxString wxTabView::GetTabText(int id) const
#endif
}
-// Process mouse event, return FALSE if we didn't process it
+// Process mouse event, return false if we didn't process it
bool wxTabView::OnEvent(wxMouseEvent& event)
{
if (!event.LeftDown())
- return FALSE;
+ return false;
wxCoord x, y;
event.GetPosition(&x, &y);
}
if (!hitControl)
- return FALSE;
+ return false;
wxTabControl *currentTab = FindTabControlForId(m_tabSelection);
if (hitControl == currentTab)
- return FALSE;
+ return false;
ChangeTab(hitControl);
- return TRUE;
+ return true;
}
bool wxTabView::ChangeTab(wxTabControl *control)
oldTab = currentTab->GetId();
if (control == currentTab)
- return TRUE;
+ return true;
if (m_layers.GetCount() == 0)
- return FALSE;
+ return false;
if (!OnTabPreActivate(control->GetId(), oldTab))
- return FALSE;
+ return false;
// Move the tab to the bottom
MoveSelectionTab(control);
if (currentTab)
- currentTab->SetSelected(FALSE);
+ currentTab->SetSelected(false);
- control->SetSelected(TRUE);
+ control->SetSelected(true);
m_tabSelection = control->GetId();
OnTabActivate(control->GetId(), oldTab);
// Leave window refresh for the implementing window
- return TRUE;
+ return true;
}
// Move the selected tab to the bottom layer, if necessary,
bool wxTabView::MoveSelectionTab(wxTabControl *control)
{
if (m_layers.GetCount() == 0)
- return FALSE;
+ return false;
wxTabLayer *firstLayer = (wxTabLayer *)m_layers.GetFirst()->GetData();
int col = 0;
wxList::compatibility_iterator thisNode = FindTabNodeAndColumn(control, &col);
if (!thisNode)
- return FALSE;
+ return false;
wxList::compatibility_iterator otherNode = firstLayer->Item(col);
if (!otherNode)
- return FALSE;
+ return false;
// If this is already in the bottom layer, return now
if (otherNode == thisNode)
- return TRUE;
+ return true;
wxTabControl *otherTab = (wxTabControl *)otherNode->GetData();
thisNode->SetData(otherTab);
otherNode->SetData(control);
}
- return TRUE;
+ return true;
}
// Called when a tab is activated
}
if (oldControl)
- oldControl->SetSelected(FALSE);
+ oldControl->SetSelected(false);
m_tabSelection = sel;
wxPanelTabView::~wxPanelTabView(void)
{
- ClearWindows(TRUE);
+ ClearWindows(true);
}
// Called when a tab is activated
wxWindow *newWindow = GetTabWindow(activateId);
if (oldWindow)
- oldWindow->Show(FALSE);
+ oldWindow->Show(false);
if (newWindow)
- newWindow->Show(TRUE);
+ newWindow->Show(true);
m_panel->Refresh();
}
{
wxASSERT(m_tabWindows.find(id) == m_tabWindows.end());
m_tabWindows[id] = window;
- window->Show(FALSE);
+ window->Show(false);
}
wxWindow *wxPanelTabView::GetTabWindow(int id) const
if (newWindow == m_currentWindow)
return;
if (m_currentWindow)
- m_currentWindow->Show(FALSE);
- newWindow->Show(TRUE);
+ m_currentWindow->Show(false);
+ newWindow->Show(true);
newWindow->Refresh();
}
const wxString& value,
long style,
const wxPoint& pos)
- : wxDialog(parent, -1, caption, pos, wxDefaultSize,
+ : wxDialog(parent, wxID_ANY, caption, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL),
m_value(value)
{
// 2) text ctrl
m_textctrl = new wxTextCtrl(this, wxID_TEXT, value,
- wxDefaultPosition, wxSize(300, -1),
+ wxDefaultPosition, wxSize(300, wxDefaultSize.y),
style & ~wxTextEntryDialogStyle);
topsizer->Add( m_textctrl, 1, wxEXPAND | wxLEFT|wxRIGHT, 15 );
#if wxUSE_STATLINE
// 3) static line
- topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
#endif
// 4) buttons
topsizer->Add( CreateButtonSizer( style ), 0, wxCENTRE | wxALL, 10 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{
#if wxUSE_VALIDATORS
- if( Validate() && TransferDataFromWindow() )
+ if( Validate() && TransferDataFromWindow() )
{
EndModal( wxID_OK );
}
#endif
// ----------------------------------------------------------------------------
-// NB: when using generic wxTimer implementation in your port, you *must* call
-// wxTimer::NotifyTimers() often enough. The ideal place for this
+// NB: when using generic wxTimer implementation in your port, you *must* call
+// wxTimer::NotifyTimers() often enough. The ideal place for this
// is in wxEventLoop::Dispatch().
// ----------------------------------------------------------------------------
class wxTimerDesc
{
public:
- wxTimerDesc(wxTimer *t) :
- timer(t), running(FALSE), next(NULL), prev(NULL),
+ wxTimerDesc(wxTimer *t) :
+ timer(t), running(false), next(NULL), prev(NULL),
shotTime(0), deleteFlag(NULL) {}
wxTimer *timer;
bool running;
wxTimerDesc *next, *prev;
- wxTimerTick_t shotTime;
+ wxTimerTick_t shotTime;
volatile bool *deleteFlag; // see comment in ~wxTimer
};
void QueueTimer(wxTimerDesc *desc, wxTimerTick_t when = 0);
void RemoveTimer(wxTimerDesc *desc);
void NotifyTimers();
-
+
private:
wxTimerDesc *m_timers;
};
{
if ( desc->running )
return; // already scheduled
-
+
if ( when == 0 )
when = GetMillisecondsTime() + desc->timer->GetInterval();
desc->shotTime = when;
- desc->running = TRUE;
+ desc->running = true;
wxLogTrace( wxT("timer"),
- wxT("queued timer %p at tick %") wxTimerTickFmtSpec,
+ wxT("queued timer %p at tick %") wxTimerTickFmtSpec,
desc->timer, wxTimerTickPrintfArg(when));
if ( m_timers )
void wxTimerScheduler::RemoveTimer(wxTimerDesc *desc)
{
- desc->running = FALSE;
+ desc->running = false;
if ( desc == m_timers )
m_timers = desc->next;
if ( desc->prev )
oneShot = desc->timer->IsOneShot();
RemoveTimer(desc);
- timerDeleted = FALSE;
+ timerDeleted = false;
desc->deleteFlag = &timerDeleted;
desc->timer->Notify();
-
+
if ( !timerDeleted )
{
wxLogTrace( wxT("timer"),
wxT("notified timer %p sheduled for %")
- wxTimerTickFmtSpec,
+ wxTimerTickFmtSpec,
desc->timer,
wxTimerTickPrintfArg(desc->shotTime) );
Stop();
// NB: this is a hack: wxTimerScheduler must have some way of knowing
- // that wxTimer object was deleted under its hands -- this may
+ // that wxTimer object was deleted under its hands -- this may
// happen if somebody is really nasty and deletes the timer
// from wxTimer::Notify()
if ( m_desc->deleteFlag != NULL )
- *m_desc->deleteFlag = TRUE;
+ *m_desc->deleteFlag = true;
delete m_desc;
wxLogTrace( wxT("timer"), wxT(" ...done destroying timer %p..."), this);
bool wxTimer::Start(int millisecs, bool oneShot)
{
- wxLogTrace( wxT("timer"), wxT("started timer %p: %i ms, oneshot=%i"),
+ wxLogTrace( wxT("timer"), wxT("started timer %p: %i ms, oneshot=%i"),
this, millisecs, oneShot);
if ( !wxTimerBase::Start(millisecs, oneShot) )
- return FALSE;
-
+ return false;
+
gs_scheduler->QueueTimer(m_desc);
- return TRUE;
+ return true;
}
void wxTimer::Stop()
{
if ( !m_desc->running ) return;
-
+
gs_scheduler->RemoveTimer(m_desc);
}
DECLARE_DYNAMIC_CLASS(wxTimerModule)
public:
wxTimerModule() {}
- bool OnInit() { return TRUE; }
+ bool OnInit() { return true; }
void OnExit() { delete gs_scheduler; gs_scheduler = NULL; }
};
wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next Tip"));
- wxStaticText *text = new wxStaticText(this, wxID_ANY, _("Did you know..."), wxDefaultPosition, wxSize(-1,30) );
+ wxStaticText *text = new wxStaticText(this, wxID_ANY, _("Did you know..."), wxDefaultPosition, wxSize(wxDefaultSize.x,30) );
#if defined(__WXMSW__) || defined(__WXPM__)
text->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD));
#else
#if wxUSE_POPUPWIN
: wxPopupTransientWindow(parent)
#else
- : wxFrame(parent, -1, _T(""),
+ : wxFrame(parent, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxNO_BORDER | wxFRAME_NO_TASKBAR )
#endif
#ifdef __WXGTK__
if (!GTK_WIDGET_HAS_GRAB(m_widget))
gtk_grab_add( m_widget );
- #endif
+ #endif
#else
Move(x, y);
- Show(TRUE);
+ Show(true);
#endif
}
}
#if wxUSE_POPUPWIN
- Show(FALSE);
+ Show(false);
#ifdef __WXGTK__
if (GTK_WIDGET_HAS_GRAB(m_widget))
gtk_grab_remove( m_widget );
- #endif
+ #endif
Destroy();
#else
wxFrame::Close();
// ----------------------------------------------------------------------------
wxTipWindowView::wxTipWindowView(wxWindow *parent)
- : wxWindow(parent, -1,
+ : wxWindow(parent, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxNO_BORDER)
{
widthMax = 0;
m_parent->m_heightLine = 0;
- bool breakLine = FALSE;
+ bool breakLine = false;
for ( const wxChar *p = text.c_str(); ; p++ )
{
if ( *p == _T('\n') || *p == _T('\0') )
}
current.clear();
- breakLine = FALSE;
+ breakLine = false;
}
else if ( breakLine && (*p == _T(' ') || *p == _T('\t')) )
{
// word boundary - break the line here
m_parent->m_textLines.Add(current);
current.clear();
- breakLine = FALSE;
+ breakLine = false;
}
else // line goes on
{
current += *p;
dc.GetTextExtent(current, &width, &height);
if ( width > maxLength )
- breakLine = TRUE;
+ breakLine = true;
if ( width > widthMax )
widthMax = width;
#ifdef __WXMAC__
#include "wx/mac/private.h"
#endif
-
+
// -----------------------------------------------------------------------------
// array types
// -----------------------------------------------------------------------------
void SetImage(int image, wxTreeItemIcon which) { m_images[which] = image; }
void SetData(wxTreeItemData *data) { m_data = data; }
- void SetHasPlus(bool has = TRUE) { m_hasPlus = has; }
+ void SetHasPlus(bool has = true) { m_hasPlus = has; }
void SetBold(bool bold) { m_isBold = bold; }
void DeleteChildren(wxGenericTreeCtrl *tree = NULL);
// get count of all children (and grand children if 'recursively')
- size_t GetChildrenCount(bool recursively = TRUE) const;
+ size_t GetChildrenCount(bool recursively = true) const;
void Insert(wxGenericTreeItem *child, size_t index)
{ m_children.Insert(child, index); }
void GetSize( int &x, int &y, const wxGenericTreeCtrl* );
// return the item at given position (or NULL if no item), onButton is
- // TRUE if the point belongs to the item's button, otherwise it lies
+ // true if the point belongs to the item's button, otherwise it lies
// on the item's label
wxGenericTreeItem *HitTest( const wxPoint& point,
const wxGenericTreeCtrl *,
int &flags,
int level );
- void Expand() { m_isCollapsed = FALSE; }
- void Collapse() { m_isCollapsed = TRUE; }
+ void Expand() { m_isCollapsed = false; }
+ void Collapse() { m_isCollapsed = true; }
- void SetHilight( bool set = TRUE ) { m_hasHilight = set; }
+ void SetHilight( bool set = true ) { m_hasHilight = set; }
// status inquiries
bool HasChildren() const { return !m_children.IsEmpty(); }
if ( !m_attr )
{
m_attr = new wxTreeItemAttr;
- m_ownsAttr = TRUE;
+ m_ownsAttr = true;
}
return *m_attr;
}
{
if ( m_ownsAttr ) delete m_attr;
m_attr = attr;
- m_ownsAttr = FALSE;
+ m_ownsAttr = false;
}
// set them and delete when done
void AssignAttributes(wxTreeItemAttr *attr)
{
SetAttributes(attr);
- m_ownsAttr = TRUE;
+ m_ownsAttr = true;
}
private:
if ( item == parent )
{
// item is a descendant of parent
- return TRUE;
+ return true;
}
item = item->GetParent();
}
- return FALSE;
+ return false;
}
// -----------------------------------------------------------------------------
: m_itemEdited(item), m_startValue(item->GetText())
{
m_owner = owner;
- m_finished = FALSE;
+ m_finished = false;
int w = m_itemEdited->GetWidth(),
h = m_itemEdited->GetHeight();
if ( value == m_startValue )
{
// nothing changed, always accept
- return TRUE;
+ return true;
}
if ( !m_owner->OnRenameAccept(m_itemEdited, value) )
{
// vetoed by the user
- return FALSE;
+ return false;
}
// accepted, do rename the item
m_owner->SetItemText(m_itemEdited, value);
- return TRUE;
+ return true;
}
void wxTreeTextCtrl::Finish()
wxPendingDelete.Append(this);
- m_finished = TRUE;
+ m_finished = true;
m_owner->SetFocus(); // This doesn't work. TODO.
}
sx = parentSize.x - myPos.x;
if (mySize.x > sx)
sx = mySize.x;
- SetSize(sx, -1);
+ SetSize(sx, wxDefaultSize.y);
}
event.Skip();
m_data = data;
m_x = m_y = 0;
- m_isCollapsed = TRUE;
- m_hasHilight = FALSE;
- m_hasPlus = FALSE;
- m_isBold = FALSE;
+ m_isCollapsed = true;
+ m_hasHilight = false;
+ m_hasPlus = false;
+ m_isBold = false;
m_parent = parent;
m_attr = (wxTreeItemAttr *)NULL;
- m_ownsAttr = FALSE;
+ m_ownsAttr = false;
// We don't know the height here yet.
m_width = 0;
EVT_CHAR (wxGenericTreeCtrl::OnChar)
EVT_SET_FOCUS (wxGenericTreeCtrl::OnSetFocus)
EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus)
- EVT_TREE_ITEM_GETTOOLTIP(-1, wxGenericTreeCtrl::OnGetToolTip)
+ EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxGenericTreeCtrl::OnGetToolTip)
END_EVENT_TABLE()
#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
void wxGenericTreeCtrl::Init()
{
m_current = m_key_current = m_anchor = m_select_me = (wxGenericTreeItem *) NULL;
- m_hasFocus = FALSE;
- m_dirty = FALSE;
+ m_hasFocus = false;
+ m_dirty = false;
m_lineHeight = 10;
m_indent = 15;
m_imageListNormal = m_imageListButtons =
m_imageListState = (wxImageList *) NULL;
m_ownsImageListNormal = m_ownsImageListButtons =
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
m_dragCount = 0;
- m_isDragging = FALSE;
+ m_isDragging = false;
m_dropTarget = m_oldSelection = NULL;
m_underMouse = NULL;
m_textCtrl = NULL;
m_findTimer = NULL;
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
#if defined( __WXMAC__ ) && __WXMAC_CARBON__
m_normalFont.MacCreateThemeFont( kThemeViewsFont ) ;
SetValidator( validator );
#endif
- wxVisualAttributes attr = GetDefaultAttributes();
+ wxVisualAttributes attr = GetDefaultAttributes();
SetDefaultForegroundColour( attr.colFg );
SetDefaultBackgroundColour( attr.colBg );
SetDefaultFont(attr.font);
m_dottedPen = wxPen( wxT("grey"), 0, 0 );
SetBestSize(size);
-
- return TRUE;
+
+ return true;
}
wxGenericTreeCtrl::~wxGenericTreeCtrl()
void wxGenericTreeCtrl::SetIndent(unsigned int indent)
{
m_indent = (unsigned short) indent;
- m_dirty = TRUE;
+ m_dirty = true;
}
void wxGenericTreeCtrl::SetSpacing(unsigned int spacing)
{
m_spacing = (unsigned short) spacing;
- m_dirty = TRUE;
+ m_dirty = true;
}
size_t
// want to update the inherited styles, but right now
// none of the parents has updatable styles
m_windowStyle = styles;
- m_dirty = TRUE;
+ m_dirty = true;
}
// -----------------------------------------------------------------------------
if (data)
data->SetId( item );
-
+
((wxGenericTreeItem*) item.m_pItem)->SetData(data);
}
m_normalFont.GetFaceName(),
m_normalFont.GetEncoding());
- return TRUE;
+ return true;
}
bool wxGenericTreeCtrl::IsVisible(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
// An item is only visible if it's not a descendant of a collapsed item
wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem;
while (parent)
{
if (!parent->IsExpanded())
- return FALSE;
+ return false;
parent = parent->GetParent();
}
wxRect rect;
if (!GetBoundingRect(item, rect))
- return FALSE;
+ return false;
if (rect.GetWidth() == 0 || rect.GetHeight() == 0)
- return FALSE;
+ return false;
if (rect.GetBottom() < 0 || rect.GetTop() > clientSize.y)
- return FALSE;
+ return false;
if (rect.GetRight() < 0 || rect.GetLeft() > clientSize.x)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
bool wxGenericTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
// consider that the item does have children if it has the "+" button: it
// might not have them (if it had never been expanded yet) but then it
bool wxGenericTreeCtrl::IsExpanded(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
return ((wxGenericTreeItem*) item.m_pItem)->IsExpanded();
}
bool wxGenericTreeCtrl::IsSelected(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
return ((wxGenericTreeItem*) item.m_pItem)->IsSelected();
}
bool wxGenericTreeCtrl::IsBold(const wxTreeItemId& item) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, wxT("invalid tree item") );
+ wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
return ((wxGenericTreeItem*) item.m_pItem)->IsBold();
}
return AddRoot(text, image, selImage, data);
}
- m_dirty = TRUE; // do this first so stuff below doesn't cause flicker
+ m_dirty = true; // do this first so stuff below doesn't cause flicker
wxGenericTreeItem *item =
new wxGenericTreeItem( parent, text, image, selImage, data );
{
wxCHECK_MSG( !m_anchor, wxTreeItemId(), wxT("tree can have only one root") );
- m_dirty = TRUE; // do this first so stuff below doesn't cause flicker
+ m_dirty = true; // do this first so stuff below doesn't cause flicker
m_anchor = new wxGenericTreeItem((wxGenericTreeItem *)NULL, text,
image, selImage, data);
if (!HasFlag(wxTR_MULTIPLE))
{
m_current = m_key_current = m_anchor;
- m_current->SetHilight( TRUE );
+ m_current->SetHilight( true );
}
return m_anchor;
void wxGenericTreeCtrl::DeleteChildren(const wxTreeItemId& itemId)
{
- m_dirty = TRUE; // do this first so stuff below doesn't cause flicker
+ m_dirty = true; // do this first so stuff below doesn't cause flicker
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
item->DeleteChildren(this);
void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId)
{
- m_dirty = TRUE; // do this first so stuff below doesn't cause flicker
+ m_dirty = true; // do this first so stuff below doesn't cause flicker
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
// Don't silently change the selection:
// do it properly in idle time, so event
// handlers get called.
-
+
// m_key_current = parent;
m_key_current = NULL;
}
// Don't silently change the selection:
// do it properly in idle time, so event
// handlers get called.
-
+
// m_current = parent;
m_current = NULL;
m_select_me = parent;
{
if (m_current)
{
- m_current->SetHilight( FALSE );
+ m_current->SetHilight( false );
RefreshLine( m_current );
m_current = NULL;
{
if (item->IsSelected())
{
- item->SetHilight(FALSE);
+ item->SetHilight(false);
RefreshLine(item);
}
size_t count = children.Count();
for (size_t n=(size_t)(index+1); n<count; ++n)
{
- if (TagAllChildrenUntilLast(children[n], last_item, select)) return TRUE;
+ if (TagAllChildrenUntilLast(children[n], last_item, select)) return true;
}
return TagNextChildren(parent, last_item, select);
RefreshLine(crt_item);
if (crt_item==last_item)
- return TRUE;
+ return true;
if (crt_item->HasChildren())
{
for ( size_t n = 0; n < count; ++n )
{
if (TagAllChildrenUntilLast(children[n], last_item, select))
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2)
wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") );
m_select_me = NULL;
-
+
bool is_single=!(GetWindowStyleFlag() & wxTR_MULTIPLE);
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
{
if (item->IsSelected())
return; // nothing to do
- unselect_others = TRUE;
- extended_select = FALSE;
+ unselect_others = true;
+ extended_select = false;
}
else if ( unselect_others && item->IsSelected() )
{
}
else
{
- bool select=TRUE; // the default
+ bool select = true; // the default
// Check if we need to toggle hilight (ctrl mode)
if (!unselect_others)
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
- item->SetHilight(FALSE);
+ item->SetHilight(false);
RefreshLine(item);
}
}
// We have to call this here because the label in
// question might just have been added and no screen
// update taken place.
- if (m_dirty)
+ if (m_dirty)
#if defined( __WXMSW__ ) || defined(__WXMAC__)
Update();
#else
wxArrayGenericTreeItems& children = item->GetChildren();
if ( children.Count() > 1 )
{
- m_dirty = TRUE;
+ m_dirty = true;
s_treeBeingSorted = this;
children.Sort(tree_ctrl_compare_func);
{
if (m_ownsImageListNormal) delete m_imageListNormal;
m_imageListNormal = imageList;
- m_ownsImageListNormal = FALSE;
- m_dirty = TRUE;
+ m_ownsImageListNormal = false;
+ m_dirty = true;
// Don't do any drawing if we're setting the list to NULL,
// since we may be in the process of deleting the tree control.
if (imageList)
{
if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
}
void wxGenericTreeCtrl::SetButtonsImageList(wxImageList *imageList)
{
if (m_ownsImageListButtons) delete m_imageListButtons;
m_imageListButtons = imageList;
- m_ownsImageListButtons = FALSE;
- m_dirty = TRUE;
+ m_ownsImageListButtons = false;
+ m_dirty = true;
CalculateLineHeight();
}
void wxGenericTreeCtrl::AssignImageList(wxImageList *imageList)
{
SetImageList(imageList);
- m_ownsImageListNormal = TRUE;
+ m_ownsImageListNormal = true;
}
void wxGenericTreeCtrl::AssignStateImageList(wxImageList *imageList)
{
SetStateImageList(imageList);
- m_ownsImageListState = TRUE;
+ m_ownsImageListState = true;
}
void wxGenericTreeCtrl::AssignButtonsImageList(wxImageList *imageList)
{
SetButtonsImageList(imageList);
- m_ownsImageListButtons = TRUE;
+ m_ownsImageListButtons = true;
}
// -----------------------------------------------------------------------------
{
static const int wImage = 9;
static const int hImage = 9;
-
+
int flag = 0;
if (item->IsExpanded())
flag |= wxCONTROL_EXPANDED;
if (item == m_underMouse)
flag |= wxCONTROL_CURRENT;
-
+
wxRendererNative::Get().DrawTreeItemButton
(
this,
if (HasButtons()) y_mid += 5;
// Only draw the portion of the line that is visible, in case it is huge
- wxCoord xOrigin=0, yOrigin=0, width, height;
+ wxCoord xOrigin=0, yOrigin=0, width, height;
dc.GetDeviceOrigin(&xOrigin, &yOrigin);
yOrigin = abs(yOrigin);
GetClientSize(&width, &height);
{
// draw a line under the drop target because the item will be
// dropped there
- DrawLine(item, TRUE /* below */);
+ DrawLine(item, true /* below */);
}
SetCursor(wxCURSOR_BULLSEYE);
void wxGenericTreeCtrl::OnSetFocus( wxFocusEvent &event )
{
- m_hasFocus = TRUE;
+ m_hasFocus = true;
RefreshSelected();
void wxGenericTreeCtrl::OnKillFocus( wxFocusEvent &event )
{
- m_hasFocus = FALSE;
+ m_hasFocus = false;
RefreshSelected();
// it may happen if the item was expanded but then all of
// its children have been deleted - so IsExpanded() returned
- // TRUE, but GetLastChild() returned invalid item
+ // true, but GetLastChild() returned invalid item
if ( !lastChild )
break;
wxRect& rect,
bool WXUNUSED(textOnly)) const
{
- wxCHECK_MSG( item.IsOk(), FALSE, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );
+ wxCHECK_MSG( item.IsOk(), false, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );
wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem;
//rect.height = i->GetHeight();
rect.height = GetLineHeight(i);
- return TRUE;
+ return true;
}
void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
le.m_item = item;
le.SetEventObject( this );
le.m_label = value;
- le.m_editCancelled = FALSE;
+ le.m_editCancelled = false;
return !GetEventHandler()->ProcessEvent( le ) || le.IsAllowed();
}
le.m_item = item;
le.SetEventObject( this );
le.m_label = wxEmptyString;
- le.m_editCancelled = TRUE;
+ le.m_editCancelled = true;
GetEventHandler()->ProcessEvent( le );
}
if ( !m_anchor ) return;
wxPoint pt = CalcUnscrolledPosition(event.GetPosition());
-
+
// Is the mouse over a tree item button?
int flags = 0;
wxGenericTreeItem *thisItem = m_anchor->HitTest(pt, this, flags, 0);
if ((underMouse) &&
(flags & wxTREE_HITTEST_ONITEMBUTTON) &&
(!event.LeftIsDown()) &&
- (!m_isDragging) &&
+ (!m_isDragging) &&
(!m_renameTimer || !m_renameTimer->IsRunning()))
{
}
{
underMouse = NULL;
}
-
+
if (underMouse != m_underMouse)
{
if (m_underMouse)
m_underMouse = NULL;
RefreshLine( tmp );
}
-
+
m_underMouse = underMouse;
if (m_underMouse)
RefreshLine( m_underMouse );
}
}
#endif
-
+
// we process left mouse up event (enables in-place edit), right down
// (pass to the user code), left dbl click (activate item) and
// dragging/moving events for items drag-and-drop
if ( GetEventHandler()->ProcessEvent(nevent) && nevent.IsAllowed() )
{
// we're going to drag this item
- m_isDragging = TRUE;
+ m_isDragging = true;
// remember the old cursor because we will change it while
// dragging
if ( m_oldSelection )
{
- m_oldSelection->SetHilight(FALSE);
+ m_oldSelection->SetHilight(false);
RefreshLine(m_oldSelection);
}
}
if ( m_oldSelection )
{
- m_oldSelection->SetHilight(TRUE);
+ m_oldSelection->SetHilight(true);
RefreshLine(m_oldSelection);
m_oldSelection = (wxGenericTreeItem *)NULL;
}
(void)GetEventHandler()->ProcessEvent(event);
- m_isDragging = FALSE;
+ m_isDragging = false;
m_dropTarget = (wxGenericTreeItem *)NULL;
ReleaseMouse();
m_renameTimer = new wxTreeRenameTimer( this );
}
- m_renameTimer->Start( wxTreeRenameTimer::DELAY, TRUE );
+ m_renameTimer->Start( wxTreeRenameTimer::DELAY, true );
}
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
}
}
else // !RightDown() && !LeftUp() ==> LeftDown() || LeftDClick()
if ( m_renameTimer )
m_renameTimer->Stop();
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
// send activate event first
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
void wxGenericTreeCtrl::OnInternalIdle()
{
wxWindow::OnInternalIdle();
-
+
// Check if we need to select the root item
// because nothing else has been selected.
// Delaying it means that we can invoke event handlers
if (!m_dirty) return;
if (m_freezeCount) return;
-
- m_dirty = FALSE;
+
+ m_dirty = false;
CalculatePositions();
Refresh();
rect.width = client.x;
rect.height = client.y;
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
AdjustMyScrollbars();
}
rect.width = GetClientSize().x;
rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6;
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
}
void wxGenericTreeCtrl::RefreshSelected()
{
if (m_freezeCount) return;
-
+
// TODO: this is awfully inefficient, we should keep the list of all
// selected items internally, should be much faster
if ( m_anchor )
void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item)
{
if (m_freezeCount) return;
-
+
if ( item->IsSelected() )
RefreshLine(item);
void wxGenericTreeCtrl::Thaw()
{
wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") );
-
+
if ( !--m_freezeCount )
{
Refresh();
bool wxGenericTreeCtrl::SetBackgroundColour(const wxColour& colour)
{
if ( !wxWindow::SetBackgroundColour(colour) )
- return FALSE;
+ return false;
+
+ if (m_freezeCount) return true;
- if (m_freezeCount) return TRUE;
-
Refresh();
- return TRUE;
+ return true;
}
bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxWindow::SetForegroundColour(colour) )
- return FALSE;
+ return false;
+
+ if (m_freezeCount) return true;
- if (m_freezeCount) return TRUE;
-
Refresh();
- return TRUE;
+ return true;
}
// Process the tooltip event, to speed up event processing.
{
lineFirstNew = event.GetPosition();
}
-
+
else // unknown scroll event?
{
wxFAIL_MSG( _T("unknown scroll event type?") );
wxSize GetMaxChildSize();
int Border() const;
-
+
private:
wxSize SiblingSize(wxSizerItem *child);
-
+
wxWizard *m_owner;
bool m_childSizeValid;
wxSize m_childSize;
EVT_BUTTON(wxID_FORWARD, wxWizard::OnBackOrNext)
EVT_BUTTON(wxID_HELP, wxWizard::OnHelp)
- EVT_WIZARD_PAGE_CHANGED(-1, wxWizard::OnWizEvent)
- EVT_WIZARD_PAGE_CHANGING(-1, wxWizard::OnWizEvent)
- EVT_WIZARD_CANCEL(-1, wxWizard::OnWizEvent)
- EVT_WIZARD_FINISHED(-1, wxWizard::OnWizEvent)
- EVT_WIZARD_HELP(-1, wxWizard::OnWizEvent)
+ EVT_WIZARD_PAGE_CHANGED(wxID_ANY, wxWizard::OnWizEvent)
+ EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxWizard::OnWizEvent)
+ EVT_WIZARD_CANCEL(wxID_ANY, wxWizard::OnWizEvent)
+ EVT_WIZARD_FINISHED(wxID_ANY, wxWizard::OnWizEvent)
+ EVT_WIZARD_HELP(wxID_ANY, wxWizard::OnWizEvent)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxWizard, wxDialog)
/*
- TODO PROPERTIES :
- wxWizard
- extstyle
- title
+ TODO PROPERTIES :
+ wxWizard
+ extstyle
+ title
*/
IMPLEMENT_ABSTRACT_CLASS(wxWizardPage, wxPanel)
const wxBitmap& bitmap,
const wxChar *resource)
{
- if ( !wxPanel::Create(parent, -1) )
- return FALSE;
+ if ( !wxPanel::Create(parent, wxID_ANY) )
+ return false;
if ( resource != NULL )
{
// initially the page is hidden, it's shown only when it becomes current
Hide();
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
m_childSizeValid = true;
m_childSize = maxOfMin;
}
-
+
return maxOfMin;
}
wxSize wxWizardSizer::SiblingSize(wxSizerItem *child)
{
wxSize maxSibling;
-
+
if ( child->IsWindow() )
{
wxWizardPage *page = wxDynamicCast(child->GetWindow(), wxWizardPage);
}
}
}
-
+
return maxSibling;
}
long style)
{
bool result = wxDialog::Create(parent,id,title,pos,wxDefaultSize,style);
-
+
m_posWizard = pos;
m_bitmap = bitmap ;
DoCreateControls();
-
+
return result;
}
#if wxUSE_STATBMP
if ( m_bitmap.Ok() )
{
- m_statbmp = new wxStaticBitmap(this, -1, m_bitmap);
+ m_statbmp = new wxStaticBitmap(this, wxID_ANY, m_bitmap);
m_sizerBmpAndPage->Add(
m_statbmp,
0, // No horizontal stretching
{
#if wxUSE_STATLINE
mainColumn->Add(
- new wxStaticLine(this, -1),
+ new wxStaticLine(this, wxID_ANY),
0, // Vertically unstretchable
wxEXPAND | wxALL, // Border all around, horizontally stretchable
5 // Border width
wxALL, // Border all around
5 // Border width
);
-
+
backNextPair->Add(m_btnPrev);
backNextPair->Add(BACKNEXT_MARGIN,0,
0, // No horizontal stretching
);
AddBackNextPair(buttonRow);
-
+
buttonRow->Add(
btnCancel,
0, // Horizontally unstretchable
// do nothing if the controls were already created
if ( WasCreated() )
return;
-
+
// wxWindow::SetSizer will be called at end
wxBoxSizer *windowSizer = new wxBoxSizer(wxVERTICAL);
-
+
wxBoxSizer *mainColumn = new wxBoxSizer(wxVERTICAL);
windowSizer->Add(
mainColumn,
wxALL | wxEXPAND, // Border all around, horizontal stretching
5 // Border width
);
-
+
AddBitmapRow(mainColumn);
AddStaticLine(mainColumn);
AddButtonRow(mainColumn);
-
+
// wxWindow::SetSizer should be followed by wxWindow::Fit, but
// this is done in FinishLayout anyway so why duplicate it
SetSizer(windowSizer);
wxEXPAND | wxALL, // Vertically stretchable
m_sizerPage->Border()
);
-
+
GetSizer()->SetSizeHints(this);
if ( m_posWizard == wxDefaultPosition )
CentreOnScreen();
void wxWizard::FitToPage(const wxWizardPage *page)
{
wxCHECK_RET(!m_started,wxT("wxWizard::FitToPage after RunWizard"));
-
+
while ( page )
{
wxSize size = page->GetBestSize();
// we'll use this to decide whether we have to change the label of this
// button or not (initially the label is "Next")
- bool btnLabelWasNext = TRUE;
+ bool btnLabelWasNext = true;
// Modified 10-20-2001 Robert Cavanaugh.
// Fixed bug for displaying a new bitmap
// in each *consecutive* page
// flag to indicate if this page uses a new bitmap
- bool bmpIsDefault = TRUE;
+ bool bmpIsDefault = true;
// use these labels to determine if we need to change the bitmap
// for this page
!event.IsAllowed() )
{
// vetoed by the page
- return FALSE;
+ return false;
}
m_page->Hide();
// and notify the user code (this is especially useful for modeless
// wizards)
- wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), FALSE, 0);
+ wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, 0);
(void)GetEventHandler()->ProcessEvent(event);
- return TRUE;
+ return true;
}
// position and show the new page
(void)m_page->TransferDataToWindow();
-
+
// wxWizardSizer::RecalcSizes wants to be called when m_page changes
m_sizerPage->RecalcSizes();
if ( m_page->GetBitmap().Ok() )
{
bmpCur = m_page->GetBitmap();
- bmpIsDefault = FALSE;
+ bmpIsDefault = false;
}
#if wxUSE_STATBMP
m_page->Show();
m_page->SetFocus();
- return TRUE;
+ return true;
}
bool wxWizard::RunWizard(wxWizardPage *firstPage)
{
- wxCHECK_MSG( firstPage, FALSE, wxT("can't run empty wizard") );
-
+ wxCHECK_MSG( firstPage, false, wxT("can't run empty wizard") );
+
// Set before FinishLayout to enable wxWizardSizer::GetMaxChildSize
m_started = true;
-
+
// This cannot be done sooner, because user can change layout options
// up to this moment
FinishLayout();
-
- // can't return FALSE here because there is no old page
- (void)ShowPage(firstPage, TRUE /* forward */);
+
+ // can't return false here because there is no old page
+ (void)ShowPage(firstPage, true /* forward */);
return ShowModal() == wxID_OK;
}
static const int DEFAULT_PAGE_HEIGHT = 290;
wxSize totalPageSize(DEFAULT_PAGE_WIDTH,DEFAULT_PAGE_HEIGHT);
-
+
totalPageSize.IncTo(m_sizePage);
-
+
if ( m_statbmp )
{
totalPageSize.IncTo(wxSize(0, m_bitmap.GetHeight()));
}
-
+
return totalPageSize;
}
// page, but a small extra check won't hurt
wxWindow *win = m_page ? (wxWindow *)m_page : (wxWindow *)this;
- wxWizardEvent event(wxEVT_WIZARD_CANCEL, GetId(), FALSE, m_page);
+ wxWizardEvent event(wxEVT_WIZARD_CANCEL, GetId(), false, m_page);
if ( !win->GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
{
// no objections - close the dialog
// Create and send the help event to the specific page handler
// event data contains the active page so that context-sensitive
// help is possible
- wxWizardEvent eventHelp(wxEVT_WIZARD_HELP, GetId(), TRUE, m_page);
+ wxWizardEvent eventHelp(wxEVT_WIZARD_HELP, GetId(), true, m_page);
(void)m_page->GetEventHandler()->ProcessEvent(eventHelp);
}
}