wxBitmapButtonBase::SetMargins(x, y);
}
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
- virtual bool SetCurrent(bool doit = TRUE);
+ virtual bool SetCurrent(bool doit = true);
virtual void Press();
virtual void Release();
virtual void OnSetBitmap();
// set bitmap to the given one if it's ok or to m_bmpNormal and return
- // TRUE if the bitmap really changed
+ // true if the bitmap really changed
bool ChangeBitmap(const wxBitmap& bmp);
private:
virtual bool DoDrawBackground(wxDC& dc);
virtual void DoDraw(wxControlRenderer *renderer);
- virtual bool CanBeHighlighted() const { return TRUE; }
+ virtual bool CanBeHighlighted() const { return true; }
// common part of all ctors
void Init();
// the actions supported by wxCheckBox
// ----------------------------------------------------------------------------
-#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(TRUE)
-#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(FALSE)
+#define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(true)
+#define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(false)
#define wxACTION_CHECKBOX_TOGGLE _T("toggle") // toggle the check state
// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE
// overridden base class virtuals
virtual bool IsPressed() const { return m_isPressed; }
- virtual bool HasTransparentBackground() { return TRUE; }
+ virtual bool HasTransparentBackground() { return true; }
protected:
virtual bool PerformAction(const wxControlAction& action,
virtual void DoDraw(wxControlRenderer *renderer);
virtual wxSize DoGetBestClientSize() const;
- virtual bool CanBeHighlighted() const { return TRUE; }
+ virtual bool CanBeHighlighted() const { return true; }
// get the size of the bitmap using either the current one or the default
// one (query renderer then)
// implement check list box methods
virtual bool IsChecked(size_t item) const;
- virtual void Check(size_t item, bool check = TRUE);
+ virtual void Check(size_t item, bool check = true);
// and input handling
virtual bool PerformAction(const wxControlAction& action,
// called before showing the control to set the initial selection - notice
// that the text passed to this method might not correspond to any valid
// item (if the user edited it directly), in which case the method should
- // just return FALSE but not emit any errors
+ // just return false but not emit any errors
virtual bool SetSelection(const wxString& value) = 0;
// called immediately after the control is shown
void ShowPopup();
void HidePopup();
- // return TRUE if the popup is currently shown
+ // return true if the popup is currently shown
bool IsPopupShown() const { return m_isPopupShown; }
// get the popup window containing the popup control
virtual void OnDismiss();
// 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);
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
// is the dialog in modal state right now?
virtual bool IsModal() const;
- // For now, same as Show(TRUE) but returns return code
+ // For now, same as Show(true) but returns return code
virtual int ShowModal();
// may be called to terminate the dialog with the given return code
virtual void EndModal(int retCode);
- // returns TRUE if we're in a modal loop
+ // returns true if we're in a modal loop
bool IsModalShowing() const;
- bool Show(bool show = TRUE);
+ bool Show(bool show = true);
// implementation only from now on
// -------------------------------
const wxString& name = wxFrameNameStr);
virtual wxPoint GetClientAreaOrigin() const;
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
#if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number = 1,
#if wxUSE_TOOLBAR
// create main toolbar bycalling OnCreateToolBar()
virtual wxToolBar* CreateToolBar(long style = -1,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxString& name = wxToolBarNameStr);
virtual void PositionToolBar();
#endif // wxUSE_TOOLBAR
class WXDLLEXPORT wxInputHandler : public wxObject
{
public:
- // map a keyboard event to one or more actions (pressed == TRUE if the key
- // was pressed, FALSE if released), returns TRUE if something was done
+ // map a keyboard event to one or more actions (pressed == true if the key
+ // was pressed, false if released), returns true if something was done
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed) = 0;
// HandleMouseMove() as the mouse maybe over the control without it having
// focus
//
- // return TRUE to refresh the control, FALSE otherwise
+ // return true to refresh the control, false otherwise
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
// react to the app getting/losing activation
//
- // return TRUE to refresh the control, FALSE otherwise
+ // return true to refresh the control, false otherwise
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
// virtual dtor for any base class
bool pressed)
{
return m_handler ? m_handler->HandleKey(consumer, event, pressed)
- : FALSE;
+ : false;
}
virtual bool HandleMouse(wxInputConsumer *consumer,
const wxMouseEvent& event)
{
- return m_handler ? m_handler->HandleMouse(consumer, event) : FALSE;
+ return m_handler ? m_handler->HandleMouse(consumer, event) : false;
}
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event)
{
- return m_handler ? m_handler->HandleMouseMove(consumer, event) : FALSE;
+ return m_handler ? m_handler->HandleMouseMove(consumer, event) : false;
}
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event)
{
- return m_handler ? m_handler->HandleFocus(consumer, event) : FALSE;
+ return m_handler ? m_handler->HandleFocus(consumer, event) : false;
}
private:
virtual bool IsSelected(int n) const
{ return m_selections.Index(n) != wxNOT_FOUND; }
- virtual void SetSelection(int n, bool select = TRUE);
+ virtual void SetSelection(int n, bool select = true);
virtual int GetSelection() const;
virtual int GetSelections(wxArrayInt& aSelections) const;
void Activate(int item = -1);
// select or unselect the specified or current (if -1) item
- void DoSelect(int item = -1, bool sel = TRUE);
+ void DoSelect(int item = -1, bool sel = true);
// more readable wrapper
- void DoUnselect(int item) { DoSelect(item, FALSE); }
+ void DoUnselect(int item) { DoSelect(item, false); }
// select an item and send a notification about it
void SelectAndNotify(int item);
virtual void EnsureVisible(int n);
// find the first item [strictly] after the current one which starts with
- // the given string and make it the current one, return TRUE if the current
+ // the given string and make it the current one, return true if the current
// item changed
- bool FindItem(const wxString& prefix, bool strictlyAfter = FALSE);
- bool FindNextItem(const wxString& prefix) { return FindItem(prefix, TRUE); }
+ bool FindItem(const wxString& prefix, bool strictlyAfter = false);
+ bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); }
// extend the selection to span the range from the anchor (see below) to
// the specified or current item
{
public:
// if pressing the mouse button in a multiselection listbox should toggle
- // the item under mouse immediately, then specify TRUE as the second
+ // the item under mouse immediately, then specify true as the second
// parameter (this is the standard behaviour, under GTK the item is toggled
// only when the mouse is released in the multi selection listbox)
wxStdListboxInputHandler(wxInputHandler *inphand,
- bool toggleOnPressAlways = TRUE);
+ bool toggleOnPressAlways = true);
// base class methods
virtual bool HandleKey(wxInputConsumer *consumer,
// parts of HitTest(): first finds the pseudo (because not in range) index
// of the item and the second one adjusts it if necessary - that is if the
- // third one returns FALSE
+ // third one returns false
int HitTestUnsafe(const wxListBox *listbox, const wxMouseEvent& event);
int FixItemIndex(const wxListBox *listbox, int item);
bool IsValidIndex(const wxListBox *listbox, int item);
// show this menu at the given position (in screen coords) and optionally
// select its first item
void Popup(const wxPoint& pos, const wxSize& size,
- bool selectFirst = TRUE);
+ bool selectFirst = true);
// dismiss the menu
void Dismiss();
// implementation only from here
- // do as if this item were clicked, return TRUE if the resulting event was
- // processed, FALSE otherwise
+ // do as if this item were clicked, return true if the resulting event was
+ // processed, false otherwise
bool ClickItem(wxMenuItem *item);
- // process the key event, return TRUE if done
+ // process the key event, return true if done
bool ProcessKeyDown(int key);
#if wxUSE_ACCEL
// get the next item for the givan accel letter (used by wxFrame), return
// -1 if none
//
- // if unique is not NULL, filled with TRUE if there is only one item with
- // this accel, FALSE if two or more
+ // if unique is not NULL, filled with true if there is only one item with
+ // this accel, false if two or more
int FindNextItemForAccel(int idxStart,
int keycode,
bool *unique = NULL) const;
#endif // wxUSE_ACCEL
// called by wxMenu when it is dismissed
- void OnDismissMenu(bool dismissMenuBar = FALSE);
+ void OnDismissMenu(bool dismissMenuBar = false);
protected:
// common part of all ctors
void OnKeyDown(wxKeyEvent& event);
void OnKillFocus(wxFocusEvent& event);
- // process the mouse move event, return TRUE if we did, FALSE to continue
+ // process the mouse move event, return true if we did, false to continue
// processing as usual
//
// the coordinates are client coordinates of menubar, convert if necessary
void DoSelectMenu(size_t pos);
// popup the currently selected menu
- void PopupCurrentMenu(bool selectFirst = TRUE);
+ void PopupCurrentMenu(bool selectFirst = true);
// hide the currently selected menu
void DismissMenu();
virtual void SetText(const wxString& text);
virtual void SetCheckable(bool checkable);
- virtual void Enable(bool enable = TRUE);
- virtual void Check(bool check = TRUE);
+ virtual void Enable(bool enable = true);
+ virtual void Check(bool check = true);
// we add some extra functions which are also available under MSW from
// wxOwnerDrawn class - they will be moved to wxMenuItemBase later
void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap);
void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
- const wxBitmap& GetBitmap(bool checked = TRUE) const
+ const wxBitmap& GetBitmap(bool checked = true) const
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
void SetDisabledBitmap( const wxBitmap& bmpDisabled )
wxCoord GetPosition() const
{
- wxASSERT_MSG( m_posY != -1, _T("must call SetHeight first!") );
+ wxASSERT_MSG( m_posY != wxDefaultCoord, _T("must call SetHeight first!") );
return m_posY;
}
wxCoord GetHeight() const
{
- wxASSERT_MSG( m_height != -1, _T("must call SetHeight first!") );
+ wxASSERT_MSG( m_height != wxDefaultCoord, _T("must call SetHeight first!") );
return m_height;
}
// the positions of the first and last items of the radio group this item
// belongs to or -1: start is the radio group start and is valid for all
- // but first radio group items (m_isRadioGroupStart == FALSE), end is valid
+ // but first radio group items (m_isRadioGroupStart == false), end is valid
// only for the first one
union
{
virtual bool InsertPage(size_t nPage,
wxNotebookPage *pPage,
const wxString& strText,
- bool bSelect = FALSE,
+ bool bSelect = false,
int imageId = -1);
// style tests
// -----------
- // return TRUE if all tabs have the same width
+ // return true if all tabs have the same width
bool FixedSizeTabs() const { return HasFlag(wxNB_FIXEDWIDTH); }
// return wxTOP/wxBOTTOM/wxRIGHT/wxLEFT
wxDirection GetTabOrientation() const;
- // return TRUE if the notebook has tabs at the sidesand not at the top (or
+ // return true if the notebook has tabs at the sidesand not at the top (or
// bottom) as usual
bool IsVertical() const;
void PositionSpinBtn();
// refresh the given tab only
- void RefreshTab(int page, bool forceSelected = FALSE);
+ void RefreshTab(int page, bool forceSelected = false);
// refresh all tabs
void RefreshAllTabs();
wxCoord GetTabWidth(int page) const
{ return FixedSizeTabs() ? m_widthMax : m_widths[page]; }
- // return TRUE if the tab has an associated image
+ // return true if the tab has an associated image
bool HasImage(int page) const
{ return m_imageList && m_images[page] != -1; }
virtual wxString GetString(int n) const;
virtual void SetString(int n, const wxString& label);
- virtual void Enable(int n, bool enable = TRUE);
- virtual void Show(int n, bool show = TRUE);
+ virtual void Enable(int n, bool enable = true);
+ virtual void Show(int n, bool show = true);
// we also override the wxControl methods to avoid virtual function hiding
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
virtual wxString GetLabel() const;
virtual void SetLabel(const wxString& label);
const wxRect& rect,
int flags )
{ DrawBackground( dc, col, rect, flags ); }
-
+
// draw the label inside the given rectangle with the specified alignment
// and optionally emphasize the character with the given index
// common part of DrawItems() and DrawCheckItems()
void DoDrawItems(const wxListBox *listbox,
size_t itemFirst, size_t itemLast,
- bool isCheckLbox = FALSE);
+ bool isCheckLbox = false);
wxWindow *m_window;
wxRenderer *m_renderer;
// draws the arrow on the given DC in the given rectangle, uses
// wxControlWithArrows::GetArrowState() to get its current state
void DrawArrow(Arrow arrow, wxDC& dc, const wxRect& rect,
- bool scrollbarLike = FALSE) const;
+ bool scrollbarLike = false) const;
// process a mouse move, enter or leave event, possibly calling
// wxControlWithArrows::SetArrowState() if wxControlWithArrows::HitTest()
// set or clear the specified flag in the arrow state: this function is
// responsible for refreshing the control
virtual void SetArrowFlag(wxScrollArrows::Arrow arrow,
- int flag, bool set = TRUE) = 0;
+ int flag, bool set = true) = 0;
// hit testing: return on which arrow the point is (or Arrow_None)
virtual wxScrollArrows::Arrow HitTest(const wxPoint& pt) const = 0;
- // called when the arrow is pressed, return TRUE to continue scrolling and
- // FALSE to stop it
+ // called when the arrow is pressed, return true to continue scrolling and
+ // false to stop it
virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0;
};
virtual void SetThumbPosition(int thumbPos);
virtual void SetScrollbar(int position, int thumbSize,
int range, int pageSize,
- bool refresh = TRUE);
+ bool refresh = true);
// wxScrollBar actions
void ScrollToStart();
virtual void DoDraw(wxControlRenderer *renderer);
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
- // forces update of thumb's visual appearence (does nothing if m_dirty=FALSE)
+ // forces update of thumb's visual appearence (does nothing if m_dirty=false)
void UpdateThumb();
// SetThumbPosition() helper
// this method is called by wxScrollBarTimer only and may be overridden
//
- // return TRUE to continue scrolling, FALSE to stop the timer
+ // return true to continue scrolling, false to stop the timer
virtual bool OnScrollTimer(wxScrollBar *scrollbar,
const wxControlAction& action);
protected:
// the methods which must be overridden in the derived class
- // return TRUE if the mouse button can be used to activate scrollbar, FALSE
+ // return true if the mouse button can be used to activate scrollbar, false
// if not (only left mouse button can do it under Windows, any button under
// GTK+)
virtual bool IsAllowedButton(int button) = 0;
// responsible for refreshing the control
virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
int flag,
- bool set = TRUE) = 0;
+ bool set = true) = 0;
// called when the user starts dragging the thumb
virtual void OnThumbDragStart(int pos) = 0;
virtual void OnPageScrollStart() = 0;
// called while the user keeps the mouse pressed above/below the thumb,
- // return TRUE to continue scrollign and FALSE to stop it (e.g. because the
+ // return true to continue scrollign and false to stop it (e.g. because the
// scrollbar has reached the top/bottom)
virtual bool OnPageScroll(int pageInc) = 0;
};
protected:
// to implement in derived classes: perform the scroll action and return
- // TRUE to continue scrolling or FALSE to stop
+ // true to continue scrolling or false to stop
virtual bool DoNotify() = 0;
// should we skip the next timer event?
virtual void SetShaftPartState(wxScrollThumb::Shaft shaftPart,
int flag,
- bool set = TRUE);
+ bool set = true);
virtual void OnThumbDragStart(int pos);
virtual void OnThumbDrag(int pos);
// normalize the value to fit in the range
int NormalizeValue(int value) const;
- // change the value by the given increment, return TRUE if really changed
+ // change the value by the given increment, return true if really changed
bool ChangeValueBy(int inc);
// change the value to the given one
public:
wxSpinButton();
wxSpinButton(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
const wxString& name = wxSPIN_BUTTON_NAME);
bool Create(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
// normalize the value to fit into min..max range
int NormalizeValue(int value) const;
- // change the value by +1/-1 and send the event, return TRUE if value was
+ // change the value by +1/-1 and send the event, return true if value was
// changed
bool ChangeValue(int inc);
const wxSize& size = wxDefaultSize,
long style = 0)
{
- Create(parent, -1, label, pos, size, style);
+ Create(parent, wxID_ANY, label, pos, size, style);
}
wxStaticBitmap(wxWindow *parent,
wxIcon GetIcon() const;
- virtual bool HasTransparentBackground() { return TRUE; }
+ virtual bool HasTransparentBackground() { return true; }
private:
virtual void DoDraw(wxControlRenderer *renderer);
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize)
{
- Create(parent, -1, label, pos, size);
+ Create(parent, wxID_ANY, label, pos, size);
}
wxStaticBox(wxWindow *parent, wxWindowID id,
// take account of this
virtual wxPoint GetBoxAreaOrigin() const;
- virtual bool HasTransparentBackground() { return TRUE; }
+ virtual bool HasTransparentBackground() { return true; }
protected:
// draw the control
// get the size of the border
wxRect GetBorderGeometry() const;
- // returning TRUE from here ensures that we act as a container window for
+ // returning true from here ensures that we act as a container window for
// our children
- virtual bool IsStaticBox() const { return TRUE; }
+ virtual bool IsStaticBox() const { return true; }
private:
DECLARE_DYNAMIC_CLASS(wxStaticBox)
wxCoord length,
long style = wxLI_HORIZONTAL)
{
- Create(parent, -1, pos,
- style & wxLI_VERTICAL ? wxSize(-1, length)
- : wxSize(length, -1),
+ Create(parent, wxID_ANY, pos,
+ style & wxLI_VERTICAL ? wxSize(wxDefaultCoord, length)
+ : wxSize(length, wxDefaultCoord),
style);
}
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize)
{
- Create(parent, -1, label, pos, size, 0, wxStaticTextNameStr);
+ Create(parent, wxID_ANY, label, pos, size, 0, wxStaticTextNameStr);
}
// full form
virtual void SetLabel(const wxString& label);
- virtual bool HasTransparentBackground() { return TRUE; }
+ virtual bool HasTransparentBackground() { return true; }
- virtual bool IsFocused() const { return FALSE; }
+ virtual bool IsFocused() const { return false; }
protected:
// calculate the optimal size for the label
wxStatusBarUniv() { Init(); }
wxStatusBarUniv(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
long style = 0,
const wxString& name = wxPanelNameStr)
{
}
bool Create(wxWindow *parent,
- wxWindowID id = -1,
+ wxWindowID id = wxID_ANY,
long style = 0,
const wxString& name = wxPanelNameStr);
// -----------------------
// caret stuff
- virtual void ShowCaret(bool show = TRUE);
- void HideCaret() { ShowCaret(FALSE); }
+ virtual void ShowCaret(bool show = true);
+ void HideCaret() { ShowCaret(false); }
void CreateCaret(); // for the current font size
// helpers for cursor movement
// override these methods to handle the caret
virtual bool SetFont(const wxFont &font);
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
// more readable flag testing methods
bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
wxRect GetRealTextArea() const;
// refresh the text in the given (in logical coords) rect
- void RefreshTextRect(const wxRect& rect, bool textOnly = TRUE);
+ void RefreshTextRect(const wxRect& rect, bool textOnly = true);
// refresh the line wrap marks for the given range of lines (inclusive)
void RefreshLineWrapMarks(wxTextCoord rowFirst, wxTextCoord rowLast);
wxCoord *widthReal = NULL) const;
// get the start and end of the selection for this line: if the line is
- // outside the selection, both will be -1 and FALSE will be returned
+ // outside the selection, both will be -1 and false will be returned
bool GetSelectedPartOfLine(wxTextCoord line,
wxTextPos *start, wxTextPos *end) const;
wxTextCoord *colStart,
wxTextCoord *colEnd,
wxTextCoord *colRowStart,
- bool devCoords = TRUE) const;
+ bool devCoords = true) const;
// HitTest() version which takes the logical text coordinates and not the
// device ones
wxTextCoord *row) const;
// get the line and the row in this line corresponding to the given row,
- // return TRUE if ok and FALSE if row is out of range
+ // return true if ok and false if row is out of range
//
// NB: this function can only be called for controls which wrap lines
bool GetLineAndRow(wxTextCoord row,
inline const wxArrayString& GetLines() const;
inline size_t GetLineCount() const;
- // replace a line (returns TRUE if the number of rows in thel ine changed)
+ // replace a line (returns true if the number of rows in thel ine changed)
bool ReplaceLine(wxTextCoord line, const wxString& text);
// remove a line
WXDLLEXPORT_DATA(extern bool) wxThemeUse##themename; \
static struct wxThemeUserFor##themename \
{ \
- wxThemeUserFor##themename() { wxThemeUse##themename = TRUE; } \
+ wxThemeUserFor##themename() { wxThemeUse##themename = true; } \
} wxThemeDoUse##themename
// to declare a new theme, this macro must be used in the class declaration
// and this one must be inserted in the source file
#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \
- WXDLLEXPORT_DATA(bool) wxThemeUse##themename = TRUE; \
+ WXDLLEXPORT_DATA(bool) wxThemeUse##themename = true; \
wxTheme *wxCtorFor##themename() { return new classname; } \
wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
wxT( #themename ), themedesc)
void RefreshTool(wxToolBarToolBase *tool);
// (re)calculate the tool positions, should only be called if it is
- // necessary to do it, i.e. m_needsLayout == TRUE
+ // necessary to do it, i.e. m_needsLayout == true
void DoLayout();
// get the rect limits depending on the orientation: top/bottom for a
virtual int GetMinWidth() const;
virtual int GetMinHeight() const;
- virtual bool ProvidesBackground() const { return TRUE; }
+ virtual bool ProvidesBackground() const { return true; }
protected:
// handle titlebar button click event
void OnNcPaint(wxNcPaintEvent& event);
void OnSystemMenu(wxCommandEvent& event);
- // TRUE if wxTLW should render decorations (aka titlebar) itself
+ // true if wxTLW should render decorations (aka titlebar) itself
static int ms_drawDecorations;
- // TRUE if wxTLW can be iconized
+ // true if wxTLW can be iconized
static int ms_canIconize;
// true for currently active frame
bool m_isActive:1;
int pos,
int page,
int range,
- bool refresh = TRUE );
- virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
+ bool refresh = true );
+ virtual void SetScrollPos(int orient, int pos, bool refresh = true);
virtual int GetScrollPos(int orient) const;
virtual int GetScrollThumb(int orient) const;
virtual int GetScrollRange(int orient) const;
// return all state flags at once (combination of wxCONTROL_XXX values)
int GetStateFlags() const;
- // set the "highlighted" flag and return TRUE if it changed
- virtual bool SetCurrent(bool doit = TRUE);
+ // set the "highlighted" flag and return true if it changed
+ virtual bool SetCurrent(bool doit = true);
// get the scrollbar (may be NULL) for the given orientation
wxScrollBar *GetScrollbar(int orient) const
// methods used by wxColourScheme to choose the colours for this window
// --------------------------------------------------------------------
- // return TRUE if this is a panel/canvas window which contains other
+ // return true if this is a panel/canvas window which contains other
// controls only
- virtual bool IsCanvasWindow() const { return FALSE; }
+ virtual bool IsCanvasWindow() const { return false; }
- // returns TRUE if the control has "transparent" areas such
+ // returns true if the control has "transparent" areas such
// as a wxStaticText and wxCheckBox and the background should
// be adapted from a parent window
- virtual bool HasTransparentBackground() { return FALSE; }
+ virtual bool HasTransparentBackground() { return false; }
// to be used with function above: transparent windows get
- // their background from parents that return TRUE here,
+ // their background from parents that return true here,
// so this is mostly for wxPanel, wxTopLevelWindow etc.
- virtual bool ProvidesBackground() const { return FALSE; }
+ virtual bool ProvidesBackground() const { return false; }
- // return TRUE if this control can be highlighted when the mouse is over
+ // return true if this control can be highlighted when the mouse is over
// it (the theme decides itself whether it is really highlighted or not)
- virtual bool CanBeHighlighted() const { return FALSE; }
+ virtual bool CanBeHighlighted() const { return false; }
- // return TRUE if we should use the colours/fonts returned by the
+ // return true if we should use the colours/fonts returned by the
// corresponding GetXXX() methods instead of the default ones
bool UseBgCol() const { return m_hasBgCol; }
bool UseFgCol() const { return m_hasFgCol; }
bool UseFont() const { return m_hasFont; }
- // return TRUE if this window serves as a container for the other windows
+ // return true if this window serves as a container for the other windows
// only and doesn't get any input itself
- virtual bool IsStaticBox() const { return FALSE; }
+ virtual bool IsStaticBox() const { return false; }
// returns the (low level) renderer to use for drawing the control by
// querying the current theme
// the rect coordinates are, for us, in client coords, but if no rect is
// specified, the entire window is refreshed
- virtual void Refresh(bool eraseBackground = TRUE,
+ virtual void Refresh(bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL);
// we refresh the window when it is dis/enabled
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
// should we use the standard control colours or not?
virtual bool ShouldInheritColours() const { return false; }
void OnKeyUp(wxKeyEvent& event);
#endif // wxUSE_MENUS
- // draw the control background, return TRUE if done
+ // draw the control background, return true if done
virtual bool DoDrawBackground(wxDC& dc);
// draw the controls border
// typically too big for them
if ( !wxButton::Create(parent, id, bitmap, _T(""),
pos, size, style | wxBU_EXACTFIT, validator, name) )
- return FALSE;
+ return false;
m_bmpNormal = bitmap;
- return TRUE;
+ return true;
}
void wxBitmapButton::OnSetBitmap()
{
m_bitmap = bitmap;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxBitmapButton::Enable(bool enable)
{
if ( !wxButton::Enable(enable) )
- return FALSE;
+ return false;
if ( !enable && ChangeBitmap(m_bmpDisabled) )
Refresh();
- return TRUE;
+ return true;
}
bool wxBitmapButton::SetCurrent(bool doit)
void wxButton::Init()
{
m_isPressed =
- m_isDefault = FALSE;
+ m_isDefault = false;
}
bool wxButton::Create(wxWindow *parent,
}
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
SetLabel(label);
SetImageLabel(bitmap);
CreateInputHandler(wxINP_HANDLER_BUTTON);
- return TRUE;
+ return true;
}
wxButton::~wxButton()
rect, GetStateFlags());
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
if ( !m_isPressed )
{
- m_isPressed = TRUE;
+ m_isPressed = true;
Refresh();
}
{
if ( m_isPressed )
{
- m_isPressed = FALSE;
+ m_isPressed = false;
Refresh();
}
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
void wxButton::SetDefault()
{
- m_isDefault = TRUE;
+ m_isDefault = true;
}
// ============================================================================
: wxStdInputHandler(handler)
{
m_winCapture = NULL;
- m_winHasMouse = FALSE;
+ m_winHasMouse = false;
}
bool wxStdButtonInputHandler::HandleKey(wxInputConsumer *consumer,
{
consumer->PerformAction(wxACTION_BUTTON_TOGGLE);
- return TRUE;
+ return true;
}
return wxStdInputHandler::HandleKey(consumer, event, pressed);
{
m_winCapture = consumer->GetInputWindow();
m_winCapture->CaptureMouse();
- m_winHasMouse = TRUE;
+ m_winHasMouse = true;
consumer->PerformAction(wxACTION_BUTTON_PRESS);
- return TRUE;
+ return true;
}
else if ( event.LeftUp() )
{
// this will generate a click event
consumer->PerformAction(wxACTION_BUTTON_TOGGLE);
- return TRUE;
+ return true;
}
//else: the mouse was released outside the window, this doesn't
// count as a click
if ( event.Leaving() )
{
// remember that the mouse is now outside
- m_winHasMouse = FALSE;
+ m_winHasMouse = false;
// we do have a pressed button, so release it
- consumer->GetInputWindow()->SetCurrent(FALSE);
+ consumer->GetInputWindow()->SetCurrent(false);
consumer->PerformAction(wxACTION_BUTTON_RELEASE);
- return TRUE;
+ return true;
}
// and entering it back should make it pressed again if it had been
// pressed
else if ( event.Entering() )
{
// the mouse is (back) inside the button
- m_winHasMouse = TRUE;
+ m_winHasMouse = true;
// we did have a pressed button which we released when leaving the
// window, press it again
- consumer->GetInputWindow()->SetCurrent(TRUE);
+ consumer->GetInputWindow()->SetCurrent(true);
consumer->PerformAction(wxACTION_BUTTON_PRESS);
- return TRUE;
+ return true;
}
}
bool wxStdButtonInputHandler::HandleFocus(wxInputConsumer * WXUNUSED(consumer),
const wxFocusEvent& WXUNUSED(event))
{
- // buttons change appearance when they get/lose focus, so return TRUE to
+ // buttons change appearance when they get/lose focus, so return true to
// refresh
- return TRUE;
+ return true;
}
bool wxStdButtonInputHandler::HandleActivation(wxInputConsumer *consumer,
bool WXUNUSED(activated))
{
// the default button changes appearance when the app is [de]activated, so
- // return TRUE to refresh
+ // return true to refresh
return wxStaticCast(consumer->GetInputWindow(), wxButton)->IsDefault();
}
void wxCheckBox::Init()
{
- m_isPressed = FALSE;
+ m_isPressed = false;
m_status = Status_Unchecked;
}
const wxString &name)
{
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
SetLabel(label);
SetBestSize(size);
CreateInputHandler(wxINP_HANDLER_CHECKBOX);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
if ( !m_isPressed )
{
- m_isPressed = TRUE;
+ m_isPressed = true;
Refresh();
}
{
if ( m_isPressed )
{
- m_isPressed = FALSE;
+ m_isPressed = false;
Refresh();
}
void wxCheckBox::Toggle()
{
- m_isPressed = FALSE;
+ m_isPressed = false;
ChangeValue(!GetValue());
}
else if ( action == wxACTION_BUTTON_RELEASE )
Release();
if ( action == wxACTION_CHECKBOX_CHECK )
- ChangeValue(TRUE);
+ ChangeValue(true);
else if ( action == wxACTION_CHECKBOX_CLEAR )
- ChangeValue(FALSE);
+ ChangeValue(false);
else if ( action == wxACTION_CHECKBOX_TOGGLE )
Toggle();
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
if ( !wxListBox::Create(parent, id, pos, size,
n, choices, style, validator, name) )
- return FALSE;
+ return false;
CreateInputHandler(wxINP_HANDLER_CHECKLISTBOX);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxCheckListBox::IsChecked(size_t item) const
{
- wxCHECK_MSG( item < m_checks.GetCount(), FALSE,
+ wxCHECK_MSG( item < m_checks.GetCount(), false,
_T("invalid index in wxCheckListBox::IsChecked") );
return m_checks[item] != 0;
int pos = wxListBox::DoAppend(item);
// the item is initially unchecked
- m_checks.Insert(FALSE, pos);
+ m_checks.Insert(false, pos);
return pos;
}
size_t count = items.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_checks.Insert(FALSE, pos + n);
+ m_checks.Insert(false, pos + n);
}
}
size_t count = items.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_checks.Add(FALSE);
+ m_checks.Add(false);
}
}
return wxListBox::PerformAction(action, numArg, strArg);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
lbox->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE, item);
- return TRUE;
+ return true;
}
}
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
- EVT_COMBOBOX(-1, wxChoice::OnComboBox)
+ EVT_COMBOBOX(wxID_ANY, wxChoice::OnComboBox)
END_EVENT_TABLE()
wxChoice::wxChoice(wxWindow *parent, wxWindowID id,
{
public:
wxComboButton(wxComboControl *combo)
- : wxBitmapButton(combo->GetParent(), -1, wxNullBitmap,
+ : wxBitmapButton(combo->GetParent(), wxID_ANY, wxNullBitmap,
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | wxBU_EXACTFIT)
{
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxComboButton, wxButton)
- EVT_BUTTON(-1, wxComboButton::OnButton)
+ EVT_BUTTON(wxID_ANY, wxComboButton::OnButton)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxComboListBox, wxListBox)
- EVT_LISTBOX(-1, wxComboListBox::OnSelect)
- EVT_LISTBOX_DCLICK(-1, wxComboListBox::OnSelect)
+ EVT_LISTBOX(wxID_ANY, wxComboListBox::OnSelect)
+ EVT_LISTBOX_DCLICK(wxID_ANY, wxComboListBox::OnSelect)
EVT_MOTION(wxComboListBox::OnMouseMove)
EVT_LEFT_UP(wxComboListBox::OnLeftUp)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxComboTextCtrl, wxTextCtrl)
EVT_KEY_DOWN(wxComboTextCtrl::OnKey)
EVT_KEY_UP(wxComboTextCtrl::OnKey)
- EVT_TEXT(-1, wxComboTextCtrl::OnText)
+ EVT_TEXT(wxID_ANY, wxComboTextCtrl::OnText)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
{
m_popup = (wxComboPopup *)NULL;
m_winPopup = (wxPopupComboWindow *)NULL;
- m_isPopupShown = FALSE;
+ m_isPopupShown = false;
m_btn = NULL;
m_text = NULL;
}
style &= ~wxBORDER_NONE;
style |= wxBORDER_SUNKEN;
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
// create the text control and the button as our siblings (*not* children),
// don't care about size/position here - they will be set in DoMoveWindow()
// for compatibility with the other ports, the height specified is the
// combined height of the combobox itself and the popup
- if ( size.y == -1 )
+ if ( size.y == wxDefaultCoord )
{
// ok, use default height for popup too
- m_heightPopup = -1;
+ m_heightPopup = wxDefaultCoord;
}
else
{
// 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
- wxControl::Enable(FALSE); // don't use non virtual Disable() here!
- m_isEnabled = TRUE;
+ // make IsEnabled() return true
+ wxControl::Enable(false); // don't use non virtual Disable() here!
+ m_isEnabled = true;
CreateInputHandler(wxINP_HANDLER_COMBOBOX);
- return TRUE;
+ return true;
}
wxComboControl::~wxComboControl()
bool wxComboControl::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
- return FALSE;
+ return false;
m_btn->Enable(enable);
m_text->Enable(enable);
- return TRUE;
+ return true;
}
bool wxComboControl::Show(bool show)
{
if ( !wxControl::Show(show) )
- return FALSE;
+ return false;
if (m_btn)
m_btn->Show(show);
if (m_text)
m_text->Show(show);
- return TRUE;
+ return true;
}
#if wxUSE_TOOLTIPS
// size and position the popup window correctly
m_winPopup->SetSize(GetSize().x,
- m_heightPopup == -1 ? control->GetBestSize().y
+ m_heightPopup == wxDefaultCoord ? control->GetBestSize().y
: m_heightPopup);
wxSize sizePopup = m_winPopup->GetClientSize();
control->SetSize(0, 0, sizePopup.x, sizePopup.y);
m_text->SelectAll();
m_popup->SetSelection(m_text->GetValue());
- m_isPopupShown = TRUE;
+ m_isPopupShown = true;
}
void wxComboControl::HidePopup()
m_winPopup->Dismiss();
- m_isPopupShown = FALSE;
+ m_isPopupShown = false;
}
void wxComboControl::OnSelect(const wxString& value)
const wxString& value,
long style,
const wxValidator& validator)
- : wxTextCtrl(combo->GetParent(), -1, value,
+ : wxTextCtrl(combo->GetParent(), wxID_ANY, value,
wxDefaultPosition, wxDefaultSize,
wxBORDER_NONE | style,
validator)
// ----------------------------------------------------------------------------
wxComboListBox::wxComboListBox(wxComboControl *combo, int style)
- : wxListBox(combo->GetPopupWindow(), -1,
+ : wxListBox(combo->GetPopupWindow(), wxID_ANY,
wxDefaultPosition, wxDefaultSize,
0, NULL,
wxBORDER_SIMPLE | wxLB_INT_HEIGHT | style),
else if ( !FindItem(value) )
{
// no match att all
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void wxComboListBox::OnSelect(wxCommandEvent& event)
void wxComboListBox::OnShow()
{
// nobody clicked us yet
- m_clicked = FALSE;
+ m_clicked = false;
}
bool wxComboListBox::PerformAction(const wxControlAction& action,
// we don't let the listbox handle this as instead of just using the
// single key presses, as usual, we use the text ctrl value as prefix
// and this is done by wxComboControl itself
- return TRUE;
+ return true;
}
return wxListBox::PerformAction(action, numArg, strArg);
void wxComboListBox::OnLeftUp(wxMouseEvent& event)
{
// we should dismiss the combo now
- m_clicked = TRUE;
+ m_clicked = true;
event.Skip();
}
if ( !wxComboControl::Create(parent, id, value, pos, size, style,
validator, name) )
{
- return FALSE;
+ return false;
}
wxComboListBox *combolbox =
SetPopupControl(combolbox);
- return TRUE;
+ return true;
}
wxComboBox::~wxComboBox()
long numArg,
const wxString& strArg)
{
- bool processed = FALSE;
+ bool processed = false;
if ( action == wxACTION_COMBOBOX_POPUP )
{
if ( !m_isPopupShown )
{
ShowPopup();
- processed = TRUE;
+ processed = true;
}
}
else if ( action == wxACTION_COMBOBOX_DISMISS )
{
HidePopup();
- processed = TRUE;
+ processed = true;
}
}
return wxControl::PerformAction(action, numArg, strArg);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action);
- return TRUE;
+ return true;
}
}
if ( !wxControlBase::Create(parent, id, pos, size, style, validator, name) )
{
// underlying window creation failed?
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
}
// do draw it
- dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
+ dc.DrawBitmap(bmp, x, y, true /* use mask */);
}
void wxControlRenderer::DrawScrollbar(const wxScrollBar *scrollbar,
rectUpdate.GetBottom());
#if 0 //def WXDEBUG_SCROLLBAR
- static bool s_refreshDebug = FALSE;
+ static bool s_refreshDebug = false;
if ( s_refreshDebug )
{
wxClientDC dc(wxConstCast(scrollbar, wxScrollBar));
(wxScrollArrows::Arrow)nArrow,
m_dc,
rectArrow,
- TRUE // draw a scrollbar arrow, not just an arrow
+ true // draw a scrollbar arrow, not just an arrow
);
}
}
void wxControlRenderer::DrawCheckItems(const wxCheckListBox *lbox,
size_t itemFirst, size_t itemLast)
{
- DoDrawItems(lbox, itemFirst, itemLast, TRUE);
+ DoDrawItems(lbox, itemFirst, itemLast, true);
}
#endif // wxUSE_CHECKLISTBOX
m_returnCode = 0;
m_windowDisabler = NULL;
m_eventLoop = NULL;
- m_isShowingModal = FALSE;
+ m_isShowingModal = false;
}
wxDialog::~wxDialog()
else
{
SetReturnCode(wxID_CANCEL);
- Show(FALSE);
+ Show(false);
}
}
else
{
SetReturnCode(wxID_OK);
- Show(FALSE);
+ Show(false);
}
}
}
}
}
- Show(TRUE);
+ Show(true);
- m_isShowingModal = TRUE;
+ m_isShowingModal = true;
wxASSERT_MSG( !m_windowDisabler, _T("disabling windows twice?") );
return;
}
- m_isShowingModal = FALSE;
+ m_isShowingModal = false;
m_eventLoop->Exit();
- Show(FALSE);
+ Show(false);
}
#endif // wxUSE_TOOLBAR
m_frameMenuBar->SetSize(0,
-#ifdef __WXPM__ // FIXME -- remove this, make wxOS2/Univ behave as
+#ifdef __WXPM__ // FIXME -- remove this, make wxOS2/Univ behave as
// the rest of the world!!!
GetClientSize().y - heightMbar - heightTbar,
#else
if ( m_frameStatusBar )
{
wxSize size = GetClientSize();
- m_frameStatusBar->SetSize(0, size.y, size.x, -1);
+ m_frameStatusBar->SetSize(0, size.y, size.x, wxDefaultCoord);
}
}
bool wxFrame::Enable(bool enable)
{
if (!wxFrameBase::Enable(enable))
- return FALSE;
+ return false;
#ifdef __WXMICROWIN__
if (m_frameMenuBar)
m_frameMenuBar->Enable(enable);
#endif
- return TRUE;
+ return true;
}
if ( !wxGaugeBase::Create(parent, id, range, pos, size, style,
validator, name) )
{
- return FALSE;
+ return false;
}
SetBestSize(size);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if ( IsVertical() )
{
size.x = (3*size.y) / 2 + 2;
- size.y = -1;
+ size.y = wxDefaultCoord;
}
else
{
size.y = (3*size.x) / 2 + 2;
- size.x = -1;
+ size.x = wxDefaultCoord;
}
return size;
void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
{
- if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, TRUE) )
+ if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) )
event.Skip();
}
void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
{
- if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, FALSE) )
+ if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) )
event.Skip();
}
long WXUNUSED(numArg),
const wxString& WXUNUSED(strArg))
{
- return FALSE;
+ return false;
}
bool wxInputHandler::HandleMouseMove(wxInputConsumer * WXUNUSED(consumer),
const wxMouseEvent& WXUNUSED(event))
{
- return FALSE;
+ return false;
}
bool wxInputHandler::HandleFocus(wxInputConsumer *WXUNUSED(consumer),
const wxFocusEvent& WXUNUSED(event))
{
- return FALSE;
+ return false;
}
bool wxInputHandler::HandleActivation(wxInputConsumer *WXUNUSED(consumer),
bool WXUNUSED(activated))
{
- return FALSE;
+ return false;
}
wxInputHandler::~wxInputHandler()
// no items hence no current item
m_current = -1;
m_selAnchor = -1;
- m_currentChanged = FALSE;
+ m_currentChanged = false;
// no need to update anything initially
m_updateCount = 0;
m_updateScrollbarX =
m_showScrollbarX =
m_updateScrollbarY =
- m_showScrollbarY = FALSE;
+ m_showScrollbarY = false;
}
wxListBox::wxListBox(wxWindow *parent,
if ( !wxControl::Create(parent, id, pos, size, style,
validator, name) )
- return FALSE;
+ return false;
SetWindow(this);
CreateInputHandler(wxINP_HANDLER_LISTBOX);
- return TRUE;
+ return true;
}
wxListBox::~wxListBox()
m_itemsClientData.Insert(NULL, index);
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
if ( HasHorzScrollbar() )
{
{
m_maxWidth = width;
m_maxWidthItem = index;
- m_updateScrollbarX = TRUE;
+ m_updateScrollbarX = true;
}
}
}
// the number of items has changed so we might have to show the scrollbar
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
// the max width also might have changed - just recalculate it instead of
// keeping track of it here, this is probably more efficient for a typical
m_itemsClientData.Insert(clientData ? clientData[n] : NULL, index);
}
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
RefreshAll();
}
{
m_maxWidth = width;
m_maxWidthItem = n;
- m_updateScrollbarX = TRUE;
+ m_updateScrollbarX = true;
}
// or also decreased if the old string was the longest one
else if ( n == m_maxWidthItem )
{
DoClear();
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
RefreshHorzScrollbar();
}
// the number of items has changed, hence the scrollbar may disappear
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
// finally, if the longest item was deleted the scrollbar may disappear
if ( n == m_maxWidthItem )
void wxListBox::RefreshHorzScrollbar()
{
m_maxWidth = 0; // recalculate it
- m_updateScrollbarX = TRUE;
+ m_updateScrollbarX = true;
}
void wxListBox::UpdateScrollbars()
else // never show it
{
charWidth = maxWidth = 0;
- showScrollbarX = FALSE;
+ showScrollbarX = false;
}
// what should be the scrollbar range now?
m_updateFrom, m_updateFrom + m_updateCount - 1,
rect.GetTop(), rect.GetBottom());
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
}
}
UpdateScrollbars();
m_updateScrollbarX =
- m_updateScrollbarY = FALSE;
+ m_updateScrollbarY = false;
}
if ( m_currentChanged )
{
DoEnsureVisible(m_current);
- m_currentChanged = FALSE;
+ m_currentChanged = false;
}
if ( m_updateCount )
bool wxListBox::SetFont(const wxFont& font)
{
if ( !wxControl::SetFont(font) )
- return FALSE;
+ return false;
CalcItemsPerPage();
RefreshAll();
- return TRUE;
+ return true;
}
void wxListBox::CalcItemsPerPage()
// the scrollbars might [dis]appear
m_updateScrollbarX =
- m_updateScrollbarY = TRUE;
+ m_updateScrollbarY = true;
event.Skip();
}
if ( m_current != -1 )
{
- m_currentChanged = TRUE;
+ m_currentChanged = true;
RefreshItem(m_current);
}
if ( !count )
{
// empty listbox, we can't find anything in it
- return FALSE;
+ return false;
}
// start either from the current item or from the next one if strictlyAfter
AnchorSelection(item);
}
- return TRUE;
+ return true;
}
}
// nothing found
- return FALSE;
+ return false;
}
void wxListBox::EnsureVisible(int n)
UpdateScrollbars();
m_updateScrollbarX =
- m_updateScrollbarY = FALSE;
+ m_updateScrollbarY = false;
}
DoEnsureVisible(n);
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ============================================================================
m_btnCapture = 0;
m_toggleOnPressAlways = toggleOnPressAlways;
m_actionMouse = wxACTION_NONE;
- m_trackMouseOutside = TRUE;
+ m_trackMouseOutside = true;
}
int wxStdListboxInputHandler::HitTest(const wxListBox *lbox,
}
// by default we always do track it
- m_trackMouseOutside = TRUE;
+ m_trackMouseOutside = true;
return action;
}
// we're only interested in the key press events
if ( pressed && !event.AltDown() )
{
- bool isMoveCmd = TRUE;
+ bool isMoveCmd = true;
int style = consumer->GetInputWindow()->GetWindowStyle();
wxControlAction action;
if ( style & wxLB_MULTIPLE )
{
action = wxACTION_LISTBOX_TOGGLE;
- isMoveCmd = FALSE;
+ isMoveCmd = false;
}
break;
case WXK_RETURN:
action = wxACTION_LISTBOX_ACTIVATE;
- isMoveCmd = FALSE;
+ isMoveCmd = false;
break;
default:
}
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action, -1, strArg);
//else: nothing to do for multiple selection listboxes
}
- return TRUE;
+ return true;
}
}
action = wxACTION_LISTBOX_ACTIVATE;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
lbox->PerformAction(action, item);
- return TRUE;
+ return true;
}
return wxStdInputHandler::HandleMouse(consumer, event);
// when we do it ourselves): in this case we only react to
// the mouse messages when they happen inside the listbox
if ( lbox->HitTest(event.GetPosition()) != wxHT_WINDOW_INSIDE )
- return FALSE;
+ return false;
}
int item = HitTest(lbox, event);
// events
SetupCapture(lbox, event, item);
- m_trackMouseOutside = FALSE;
+ m_trackMouseOutside = false;
}
if ( IsValidIndex(lbox, item) )
m_width = 0;
}
- void SetEnabled(bool enabled = TRUE) { m_isEnabled = enabled; }
+ void SetEnabled(bool enabled = true) { m_isEnabled = enabled; }
// accessors
virtual void OnDismiss();
// called when a submenu is dismissed
- void OnSubmenuDismiss() { m_hasOpenSubMenu = FALSE; }
+ void OnSubmenuDismiss() { m_hasOpenSubMenu = false; }
// get the currently selected item (may be NULL)
wxMenuItem *GetCurrentItem() const
// preselect the first item
void SelectFirst() { SetCurrent(m_menu->GetMenuItems().GetFirst()); }
- // process the key event, return TRUE if done
+ // process the key event, return true if done
bool ProcessKeyDown(int key);
// process mouse move event
void ChangeCurrent(wxMenuItemList::compatibility_iterator node);
// activate item, i.e. call either ClickItem() or OpenSubmenu() depending
- // on what it is, return TRUE if something was done (i.e. it's not a
+ // on what it is, return true if something was done (i.e. it's not a
// separator...)
bool ActivateItem(wxMenuItem *item, InputMethod how = WithKeyboard);
}
else
{
- // return FALSE;
+ // return false;
return wxEvtHandler::ProcessEvent(event);
}
wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
{
m_menu = menu;
- m_hasOpenSubMenu = FALSE;
+ m_hasOpenSubMenu = false;
ResetCurrent();
{
// when we are dismissed because the user clicked elsewhere or we lost
// focus in any other way, hide the parent menu as well
- HandleDismiss(TRUE);
+ HandleDismiss(true);
}
void wxPopupMenuWindow::HandleDismiss(bool dismissParent)
void wxPopupMenuWindow::DismissAndNotify()
{
Dismiss();
- HandleDismiss(TRUE);
+ HandleDismiss(true);
}
// ----------------------------------------------------------------------------
wxSize(m_menu->GetGeometryInfo().GetSize().x, 0),
how == WithKeyboard /* preselect first item then */);
- m_hasOpenSubMenu = TRUE;
+ m_hasOpenSubMenu = true;
}
bool wxPopupMenuWindow::ActivateItem(wxMenuItem *item, InputMethod how)
// don't activate disabled items
if ( !item || !item->IsEnabled() )
{
- return FALSE;
+ return false;
}
// normal menu items generate commands, submenus can be opened and
}
else // separator, can't activate
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
wxPopupMenuWindow *win = menu->m_popupMenu;
- wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
+ wxCHECK_MSG( win, false, _T("parent menu not shown?") );
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
// eat the event
- return TRUE;
+ return true;
}
//else: it is outside the parent menu as well, do dismiss this one
}
}
- return FALSE;
+ return false;
}
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
else
{
// this menu is the last opened
- resetCurrent = TRUE;
+ resetCurrent = true;
}
if ( resetCurrent )
// to open it inspit of this)
if ( HasOpenSubmenu() )
{
- wxCHECK_MSG( CanOpen(item), FALSE,
+ wxCHECK_MSG( CanOpen(item), false,
_T("has open submenu but another item selected?") );
if ( item->GetSubMenu()->ProcessKeyDown(key) )
- return TRUE;
+ return true;
}
- bool processed = TRUE;
+ bool processed = true;
// handle the up/down arrows, home, end, esc and return here, pass the
// left/right arrows to the menu bar except when the right arrow can be
// menubar
if ( !m_menu->GetParent() )
{
- processed = FALSE;
+ processed = false;
break;
}
case WXK_ESCAPE:
// close just this menu
Dismiss();
- HandleDismiss(FALSE);
+ HandleDismiss(false);
break;
case WXK_RETURN:
}
else
{
- processed = FALSE;
+ processed = false;
}
}
break;
}
else
{
- processed = FALSE;
+ processed = false;
}
break;
wxMenuItemList::compatibility_iterator nodeStart = GetNextNode();
// do we have more than one item with this accel?
- bool notUnique = FALSE;
+ bool notUnique = false;
// translate everything to lower case before comparing
wxChar chAccel = wxTolower(key);
}
else // we already had found such item
{
- notUnique = TRUE;
+ notUnique = true;
// no need to continue further, we won't find
// anything we don't already know
//else: just select it but don't activate as the user might
// have wanted to activate another item
- // skip "processed = FALSE" below
+ // skip "processed = false" below
break;
}
}
- processed = FALSE;
+ processed = false;
}
return processed;
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
- #if 0
- // not used at all
- bool check = FALSE;
- #endif
-
if ( item->GetKind() == wxITEM_RADIO )
{
int count = GetMenuItemCount();
// for now it has just one element
item->SetAsRadioGroupStart();
item->SetRadioGroupEnd(m_startRadioGroup);
-
- // ensure that we have a checked item in the radio group
- #if 0
- // not used at all
- check = TRUE;
- #endif
}
else // extend the current radio group
{
{
// dismissParent is recursive
m_menuParent->Dismiss();
- m_menuParent->OnDismiss(TRUE);
+ m_menuParent->OnDismiss(true);
}
}
else // no parent menu
bool wxMenu::ProcessKeyDown(int key)
{
- wxCHECK_MSG( m_popupMenu, FALSE,
+ wxCHECK_MSG( m_popupMenu, false,
_T("can't process key events if not shown") );
return m_popupMenu->ProcessKeyDown(key);
// try its elements
if ( item->GetSubMenu()->ProcessAccelEvent(event) )
{
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
void wxMenu::AddAccelFor(wxMenuItem *item)
: wxMenuItemBase(parentMenu, id, text, help, kind, subMenu)
{
m_posY =
- m_height = -1;
+ m_height = wxDefaultCoord;
m_radioGroup.start = -1;
- m_isRadioGroupStart = FALSE;
+ m_isRadioGroupStart = false;
m_bmpDisabled = wxNullBitmap;
{
if ( n != pos )
{
- node->GetData()->m_isChecked = FALSE;
+ node->GetData()->m_isChecked = false;
}
node = node->GetNext();
}
void wxMenuItem::SetAsRadioGroupStart()
{
- m_isRadioGroupStart = TRUE;
+ m_isRadioGroupStart = true;
}
void wxMenuItem::SetRadioGroupStart(int start)
m_menuShown = NULL;
- m_shouldShowMenu = FALSE;
+ m_shouldShowMenu = false;
}
void wxMenuBar::Attach(wxFrame *frame)
else // not created yet, do it now
{
// we have no way to return the error from here anyhow :-(
- (void)Create(frame, -1);
+ (void)Create(frame, wxID_ANY);
SetCursor(wxCURSOR_ARROW);
SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
// calculate and set our height (it won't be changed any more)
- SetSize(-1, GetBestSize().y);
+ SetSize(wxDefaultCoord, GetBestSize().y);
}
// remember the last frame which had us to avoid unnecessarily reparenting
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
if ( !wxMenuBarBase::Insert(pos, menu, title) )
- return FALSE;
+ return false;
wxMenuInfo *info = new wxMenuInfo(title);
m_menuInfos.Insert(info, pos);
RefreshAllItemsAfter(pos);
- return TRUE;
+ return true;
}
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
bool wxMenuBar::IsEnabledTop(size_t pos) const
{
- wxCHECK_MSG( pos < GetCount(), FALSE, _T("invalid index in IsEnabledTop") );
+ wxCHECK_MSG( pos < GetCount(), false, _T("invalid index in IsEnabledTop") );
return m_menuInfos[pos].IsEnabled();
}
if ( IsShowingMenu() )
{
// restore m_shouldShowMenu flag after DismissMenu() which resets
- // it to FALSE
+ // it to false
bool old = m_shouldShowMenu;
DismissMenu();
}
else // on item
{
- wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
+ wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
CaptureMouse();
// show it as selected
RefreshItem((size_t)m_current);
// show the menu
- PopupCurrentMenu(FALSE /* don't select first item - as Windows does */);
+ PopupCurrentMenu(false /* don't select first item - as Windows does */);
}
}
}
static wxPoint s_ptLast;
if ( pt == s_ptLast )
{
- return FALSE;
+ return false;
}
s_ptLast = pt;
int currentNew = GetMenuFromPoint(pt);
if ( (currentNew == -1) || (currentNew == m_current) )
{
- return FALSE;
+ return false;
}
// select the new active item
if ( m_shouldShowMenu && !m_menuShown)
{
// open the new menu if the old one we closed had been opened
- PopupCurrentMenu(FALSE /* don't select first item - as Windows does */);
+ PopupCurrentMenu(false /* don't select first item - as Windows does */);
}
- return TRUE;
+ return true;
}
void wxMenuBar::OnKeyDown(wxKeyEvent& event)
// do we have more than one item with this accel?
if ( unique )
- *unique = TRUE;
+ *unique = true;
// translate everything to lower case before comparing
wxChar chAccel = wxTolower(key);
else // we already had found such item
{
if ( unique )
- *unique = FALSE;
+ *unique = false;
// no need to continue further, we won't find
// anything we don't already know
if ( node->GetData()->ProcessAccelEvent(event) )
{
// menu processed it
- return TRUE;
+ return true;
}
}
}
// not found
- return FALSE;
+ return false;
}
#endif // wxUSE_ACCEL
wxASSERT_MSG( !m_menuShown, _T("shouldn't show two menus at once!") );
// in any case, we should show it - even if we won't
- m_shouldShowMenu = TRUE;
+ m_shouldShowMenu = true;
if ( IsEnabledTop(m_current) )
{
void wxMenuBar::OnDismissMenu(bool dismissMenuBar)
{
- m_shouldShowMenu = FALSE;
+ m_shouldShowMenu = false;
m_menuShown = NULL;
if ( dismissMenuBar )
{
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
{
- wxCHECK_MSG( !ms_evtLoopPopup, FALSE,
+ wxCHECK_MSG( !ms_evtLoopPopup, false,
_T("can't show more than one popup menu at a time") );
#ifdef __WXMSW__
ms_evtLoopPopup = NULL;
// remove the handler
- PopEventHandler(TRUE /* delete it */);
+ PopEventHandler(true /* delete it */);
menu->SetInvokingWindow(NULL);
SetCursor(cursorOld);
#endif // __WXMSW__
- return TRUE;
+ return true;
}
void wxWindow::DismissPopupMenu()
{
public:
wxNotebookSpinBtn(wxNotebook *nb)
- : wxSpinButton(nb, -1,
+ : wxSpinButton(nb, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
nb->IsVertical() ? wxSP_VERTICAL : wxSP_HORIZONTAL)
{
};
BEGIN_EVENT_TABLE(wxNotebookSpinBtn, wxSpinButton)
- EVT_SPIN(-1, wxNotebookSpinBtn::OnSpin)
+ EVT_SPIN(wxID_ANY, wxNotebookSpinBtn::OnSpin)
END_EVENT_TABLE()
// ============================================================================
{
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
- return FALSE;
+ return false;
m_sizePad = GetRenderer()->GetTabPadding();
CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), false, _T("invalid notebook page") );
if ( strText != m_titles[nPage] )
{
}
}
- return TRUE;
+ return true;
}
int wxNotebook::GetPageImage(size_t nPage) const
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), false, _T("invalid notebook page") );
- wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
+ wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), false,
_T("invalid image index in SetPageImage()") );
if ( nImage != m_images[nPage] )
RefreshTab(nPage);
}
- return TRUE;
+ return true;
}
wxNotebook::~wxNotebook()
if ( selOld != INVALID_PAGE )
{
- RefreshTab(selOld, TRUE /* this tab was selected */);
+ RefreshTab(selOld, true /* this tab was selected */);
m_pages[selOld]->Hide();
}
int imageId)
{
size_t nPages = GetPageCount();
- wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage), FALSE,
+ wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage), false,
_T("invalid notebook page in InsertPage()") );
// modify the data
if ( nPages == 0 )
{
// always select the first tab to have at least some selection
- bSelect = TRUE;
+ bSelect = true;
Relayout();
Refresh();
pPage->Hide();
}
- return TRUE;
+ return true;
}
bool wxNotebook::DeleteAllPages()
{
if ( !wxNotebookBase::DeleteAllPages() )
- return FALSE;
+ return false;
// clear the other arrays as well
m_titles.Clear();
Relayout();
- return TRUE;
+ return true;
}
wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
- m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, TRUE);
+ m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, true);
dc.SelectObject(wxNullBitmap);
#else
bmp = *m_imageList->GetBitmap(image);
wxSize sizeTab = CalcTabSize(page);
// we only need full relayout if the page size changes
- bool needsRelayout = FALSE;
+ bool needsRelayout = false;
if ( IsVertical() )
{
if ( sizeTab.y > m_heightTab )
{
- needsRelayout = TRUE;
+ needsRelayout = true;
m_heightTab = sizeTab.y;
}
{
// this case is special, get rid of it immediately: everything is
// visible and we don't need any spin buttons
- allTabsShown = TRUE;
+ allTabsShown = true;
// have to reset them manually as we don't call CalcLastVisibleTab()
m_firstVisible =
const wxString& strArg)
{
if ( action == wxACTION_NOTEBOOK_NEXT )
- SetSelection(GetNextPage(TRUE));
+ SetSelection(GetNextPage(true));
else if ( action == wxACTION_NOTEBOOK_PREV )
- SetSelection(GetNextPage(FALSE));
+ SetSelection(GetNextPage(false));
else if ( action == wxACTION_NOTEBOOK_GOTO )
SetSelection((int)numArg);
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
return consumer->PerformAction(action, page);
}
{
consumer->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
- return FALSE;
+ return false;
}
}
{
HandleFocusChange(consumer);
- return FALSE;
+ return false;
}
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
// we react to the focus change in the same way as to the [de]activation
HandleFocusChange(consumer);
- return FALSE;
+ return false;
}
void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer)
{
if ( m_radio->OnKeyDown((wxKeyEvent &)event) )
{
- return TRUE;
+ return true;
}
}
}
if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) )
- return FALSE;
+ return false;
#if wxUSE_VALIDATORS
SetValidator(val);
// radiobox should already have selection so select at least one item
SetSelection(0);
- return TRUE;
+ return true;
}
wxRadioBox::~wxRadioBox()
size_t count = m_buttons.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_buttons[n]->PopEventHandler(TRUE /* delete it */);
+ m_buttons[n]->PopEventHandler(true /* delete it */);
delete m_buttons[n];
}
{
// make the first button in the box the start of new group by giving it
// wxRB_GROUP style
- wxRadioButton *btn = new wxRadioButton(parent, -1, choices[n],
+ wxRadioButton *btn = new wxRadioButton(parent, wxID_ANY, choices[n],
wxDefaultPosition,
wxDefaultSize,
n == 0 ? wxRB_GROUP : 0);
btn->SetFocus();
// this will also unselect the previously selected button in our group
- btn->SetValue(TRUE);
+ btn->SetValue(true);
}
int wxRadioBox::GetSelection() const
bool wxRadioBox::Enable(bool enable)
{
if ( !wxStaticBox::Enable(enable) )
- return FALSE;
+ return false;
// also enable/disable the buttons
size_t count = m_buttons.GetCount();
Enable(n, enable);
}
- return TRUE;
+ return true;
}
bool wxRadioBox::Show(bool show)
{
if ( !wxStaticBox::Show(show) )
- return FALSE;
+ return false;
// also show/hide the buttons
size_t count = m_buttons.GetCount();
Show(n, show);
}
- return TRUE;
+ return true;
}
wxString wxRadioBox::GetLabel() const
break;
default:
- return FALSE;
+ return false;
}
int selOld = GetSelection();
SendRadioEvent();
}
- return TRUE;
+ return true;
}
#endif // wxUSE_RADIOBOX
if ( !wxCheckBox::Create(parent, id, label, pos, size, style,
validator, name) )
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
if ( IsChecked() )
{
- SetValue(FALSE);
+ SetValue(false);
}
}
if ( arrow == m_captureData->m_arrowPressed )
{
// resume now
- m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE);
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true);
timer->Start();
- return TRUE;
+ return true;
}
}
else // if ( 1 ) FIXME: m_control->ShouldPauseScrolling() )
{
// stop as the mouse left the arrow
m_control->SetArrowFlag(m_captureData->m_arrowPressed,
- wxCONTROL_PRESSED, FALSE);
+ wxCONTROL_PRESSED, false);
timer->Stop();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// reset the wxCONTROL_CURRENT flag for the arrows which don't have the
UpdateCurrentFlag(Arrow_First, arrow);
UpdateCurrentFlag(Arrow_Second, arrow);
- // return TRUE if it was really an event for an arrow
+ // return true if it was really an event for an arrow
return !event.Leaving() && arrow != Arrow_None;
}
if ( btn == -1 )
{
// we only care about button press/release events
- return FALSE;
+ return false;
}
if ( event.ButtonDown() || event.ButtonDClick() )
if ( arrow == Arrow_None )
{
// mouse pressed over something else
- return FALSE;
+ return false;
}
if ( m_control->GetArrowState(arrow) & wxCONTROL_DISABLED )
{
// don't allow to press disabled arrows
- return TRUE;
+ return true;
}
wxConstCast(this, wxScrollArrows)->m_captureData =
{
m_captureData->m_timerScroll = tmpTimerScroll;
- m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, TRUE);
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, true);
}
else
{
delete m_captureData;
wxConstCast(this, wxScrollArrows)->m_captureData = NULL;
- m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, FALSE);
+ m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, false);
}
else
{
// we don't process this
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
m_elementsState[n] = 0;
}
- m_dirty = FALSE;
+ m_dirty = false;
}
bool wxScrollBar::Create(wxWindow *parent,
style &= ~wxBORDER_MASK;
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
SetBestSize(size);
CreateInputHandler(wxINP_HANDLER_SCROLLBAR);
- return TRUE;
+ return true;
}
wxScrollBar::~wxScrollBar()
wxWindow *parent = GetParent();
if ( !parent )
{
- return TRUE;
+ return true;
}
return (parent->GetScrollbar(wxHORIZONTAL) != this) &&
m_elementsState[Element_Thumb] |= wxCONTROL_DIRTY;
m_elementsState[m_thumbPos > m_thumbPosOld
? Element_Bar_1 : Element_Bar_2] |= wxCONTROL_DIRTY;
- m_dirty = TRUE;
+ m_dirty = true;
}
int wxScrollBar::GetThumbPosition() const
}
#ifdef WXDEBUG_SCROLLBAR
- static bool s_refreshDebug = FALSE;
+ static bool s_refreshDebug = false;
if ( s_refreshDebug )
{
wxClientDC dc(this);
}
#endif // WXDEBUG_SCROLLBAR
- Refresh(FALSE, &rect);
+ Refresh(false, &rect);
}
m_elementsState[n] &= ~wxCONTROL_DIRTY;
}
}
- m_dirty = FALSE;
+ m_dirty = false;
}
}
renderer->DrawScrollbar(this, m_thumbPosOld);
// clear all dirty flags
- m_dirty = FALSE;
+ m_dirty = false;
m_thumbPosOld = -1;
}
{
m_elementsState[which] = flags | wxCONTROL_DIRTY;
- m_dirty = TRUE;
+ m_dirty = true;
}
}
{
int thumbOld = m_thumbPos;
- bool notify = FALSE; // send an event about the change?
+ bool notify = false; // send an event about the change?
wxEventType scrollType;
else if ( action == wxACTION_SCROLL_THUMB_RELEASE )
{
// always notify about this
- notify = TRUE;
+ notify = true;
scrollType = wxEVT_SCROLLWIN_THUMBRELEASE;
}
else
GetParent()->GetEventHandler()->ProcessEvent(event);
}
- return TRUE;
+ return true;
}
void wxScrollBar::ScrollToStart()
bool wxScrollBar::ScrollLines(int nLines)
{
DoSetThumb(m_thumbPos + nLines);
- return TRUE;
+ return true;
}
bool wxScrollBar::ScrollPages(int nPages)
{
DoSetThumb(m_thumbPos + nPages*m_pageSize);
- return TRUE;
+ return true;
}
// ============================================================================
int oldThumbPos = scrollbar->GetThumbPosition();
scrollbar->PerformAction(action);
if ( scrollbar->GetThumbPosition() != oldThumbPos )
- return TRUE;
+ return true;
// we scrolled till the end
m_timerScroll->Stop();
- return FALSE;
+ return false;
}
void wxStdScrollBarInputHandler::StopScrolling(wxScrollBar *control)
}
// unpress the arrow and highlight the current element
- Press(control, FALSE);
+ Press(control, false);
}
wxCoord
case WXK_NEXT: action = wxACTION_SCROLL_PAGE_DOWN; break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action);
- return TRUE;
+ return true;
}
}
m_winCapture->CaptureMouse();
// generate the command
- bool hasAction = TRUE;
+ bool hasAction = true;
wxControlAction action;
switch ( ht )
{
// fall through: there is no immediate action
default:
- hasAction = FALSE;
+ hasAction = false;
}
// remove highlighting
- Highlight(scrollbar, FALSE);
+ Highlight(scrollbar, false);
m_htLast = ht;
// and press the arrow or highlight thumb now instead
if ( m_htLast == wxHT_SCROLLBAR_THUMB )
- Highlight(scrollbar, TRUE);
+ Highlight(scrollbar, true);
else
- Press(scrollbar, TRUE);
+ Press(scrollbar, true);
// start dragging
if ( hasAction )
}
m_htLast = ht;
- Highlight(scrollbar, TRUE);
+ Highlight(scrollbar, true);
}
else
{
// between the mouse position and the top/left of the thumb
HandleThumbMove(scrollbar, event);
- return TRUE;
+ return true;
}
// no other changes are possible while the mouse is captured
- return FALSE;
+ return false;
}
bool isArrow = scrollbar->GetArrows().HandleMouseMove(event);
if ( ht == m_htLast )
{
// nothing changed
- return FALSE;
+ return false;
}
#ifdef DEBUG_MOUSE
wxLogDebug("Scrollbar::OnMouseMove: ht = %d", ht);
#endif // DEBUG_MOUSE
- Highlight(scrollbar, FALSE);
+ Highlight(scrollbar, false);
m_htLast = ht;
if ( !isArrow )
- Highlight(scrollbar, TRUE);
+ Highlight(scrollbar, true);
//else: already done by wxScrollArrows::HandleMouseMove
}
else if ( event.Leaving() )
{
if ( !isArrow )
- Highlight(scrollbar, FALSE);
+ Highlight(scrollbar, false);
m_htLast = wxHT_NOWHERE;
}
else // event.Entering()
{
// we don't process this event
- return FALSE;
+ return false;
}
// we did something
- return TRUE;
+ return true;
}
#endif // wxUSE_SCROLLBAR
wxScrollTimer::wxScrollTimer()
{
- m_skipNext = FALSE;
+ m_skipNext = false;
}
void wxScrollTimer::StartAutoScroll()
// there is an initial delay before the scrollbar starts scrolling -
// implement it by ignoring the first timer expiration and only start
// scrolling from the second one
- m_skipNext = TRUE;
+ m_skipNext = true;
Start(200); // FIXME: hardcoded delay
}
Stop();
Start(50); // FIXME: hardcoded delay
- m_skipNext = FALSE;
+ m_skipNext = false;
}
else
{
if ( btn == -1 )
{
// no...
- return FALSE;
+ return false;
}
// when the mouse is pressed on any scrollbar element, we capture it
if ( HasCapture() )
{
// mouse already captured, nothing to do
- return FALSE;
+ return false;
}
// determine which part of the window the user clicked in
if ( shaftPart == Shaft_None )
{
// mouse pressed over something else
- return FALSE;
+ return false;
}
// capture the mouse
delete m_captureData;
wxConstCast(this, wxScrollThumb)->m_captureData = NULL;
- m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, FALSE);
+ m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, false);
}
else // another mouse button released
{
// we don't process this
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxScrollThumb::HandleMouseMove(const wxMouseEvent& event) const
}
// we process all mouse events while the mouse is captured by us
- return TRUE;
+ return true;
}
else // no capture
{
if ( shaftPart != m_shaftPart )
{
// update the highlighted state
- m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, FALSE);
+ m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, false);
wxConstCast(this, wxScrollThumb)->m_shaftPart = shaftPart;
- m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, TRUE);
+ m_control->SetShaftPartState(m_shaftPart, wxCONTROL_CURRENT, true);
}
// if the event happened on the shaft, it was for us and we processed
{
if ( !wxSliderBase::Create(parent, id, pos, size, style,
validator, name) )
- return FALSE;
+ return false;
SetRange(minValue, maxValue);
SetValue(value);
CreateInputHandler(wxINP_HANDLER_SLIDER);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxSlider::ChangeValueTo(int value)
{
// check if the value is going to change at all
- if (value == m_value) return FALSE;
+ if (value == m_value) return false;
// this method is protected and we should only call it with normalized
// value!
- wxCHECK_MSG( IsInRange(value), FALSE, _T("invalid slider value") );
+ wxCHECK_MSG( IsInRange(value), false, _T("invalid slider value") );
m_value = value;
(void)GetEventHandler()->ProcessEvent(event);
- return TRUE;
+ return true;
}
void wxSlider::SetValue(int value)
else if ( action == wxACTION_SLIDER_THUMB_DRAG )
{
// no special processing for it
- return TRUE;
+ return true;
}
else if ( action == wxACTION_SLIDER_THUMB_MOVE ||
action == wxACTION_SLIDER_THUMB_RELEASE )
return wxControl::PerformAction(action, numArg, strArg);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action);
- return TRUE;
+ return true;
}
}
if ( slider->GetThumb().HandleMouse(event) )
{
// processed by the thumb
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouse(consumer, event);
if ( slider->GetThumb().HandleMouseMove(event) )
{
// processed by the thumb
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouseMove(consumer, event);
const wxFocusEvent& WXUNUSED(event))
{
// slider's appearance changes when it gets/loses focus
- return TRUE;
+ return true;
}
#endif // wxUSE_SLIDER
if ( !wxSpinButtonBase::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
- return FALSE;
+ return false;
SetBestSize(size);
CreateInputHandler(wxINP_HANDLER_SPINBTN);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
// nothing changed - most likely because we are already at min/max
// value
- return FALSE;
+ return false;
}
wxSpinEvent event(inc > 0 ? wxEVT_SCROLL_LINEUP : wxEVT_SCROLL_LINEDOWN,
if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
{
// programm has vetoed the event
- return FALSE;
+ return false;
}
m_value = valueNew;
event.SetEventType(wxEVT_SCROLL_THUMBTRACK);
(void)GetEventHandler()->ProcessEvent(event);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
consumer->PerformAction(action);
- return TRUE;
+ return true;
}
}
if ( spinbtn->GetArrows().HandleMouse(event) )
{
// don't refresh, everything is already done
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouse(consumer, event);
if ( spinbtn->GetArrows().HandleMouseMove(event) )
{
// processed by the arrows
- return FALSE;
+ return false;
}
return wxStdInputHandler::HandleMouseMove(consumer, event);
const wxString &name)
{
if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
// set bitmap first
SetBitmap(label);
// and adjust our size to fit it after this
SetBestSize(size);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
const wxString &name)
{
if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
SetLabel(label);
- return TRUE;
+ return true;
}
void wxStaticBox::DoDraw(wxControlRenderer *renderer)
const wxString &name)
{
if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
wxSize sizeReal = AdjustSize(size);
if ( sizeReal != size )
SetSize(sizeReal);
- return TRUE;
+ return true;
}
void wxStaticLine::DoDraw(wxControlRenderer *renderer)
const wxString &name)
{
if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
SetLabel(label);
SetBestSize(size);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
wxDefaultPosition, wxDefaultSize,
style, name) )
{
- return FALSE;
+ return false;
}
SetFieldsCount(1);
SetSize(DoGetBestSize());
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxStatusBarUniv::GetFieldRect(int n, wxRect& rect) const
{
- wxCHECK_MSG( n >= 0 && n < m_nFields, FALSE,
+ wxCHECK_MSG( n >= 0 && n < m_nFields, false,
_T("invalid field index in GetFieldRect()") );
// this is a fix for a bug exhibited by the statbar sample: if
rect = DoGetFieldRect(n);
- return TRUE;
+ return true;
}
wxRect wxStatusBarUniv::DoGetFieldRect(int n) const
Everywhere in this file LINE refers to a logical line of text, and ROW to a
physical line of text on the display. They are the same unless WrapLines()
- is TRUE in which case a single LINE may correspond to multiple ROWs.
+ is true in which case a single LINE may correspond to multiple ROWs.
A text position is an unsigned int (which for reasons of compatibility is
still a long) from 0 to GetLastPosition() inclusive. The positions
m_scrollRangeY = 0;
m_updateScrollbarX =
- m_updateScrollbarY = FALSE;
+ m_updateScrollbarY = false;
m_widthMax = -1;
m_lineLongest = 0;
// this code is unused any longer
#if 0
- // return TRUE if the column is in the start of the last row (hence the row
+ // return true if the column is in the start of the last row (hence the row
// it is in is not wrapped)
bool IsLastRow(wxTextCoord colRowStart) const
{
return colRowStart == GetRowStart(m_rowsStart.GetCount());
}
- // return TRUE if the column is the last column of the row starting in
+ // return true if the column is the last column of the row starting in
// colRowStart
bool IsLastColInRow(wxTextCoord colRowStart,
wxTextCoord colRowEnd,
// caller got it wrong
wxFAIL_MSG( _T("this column is not in the start of the row!") );
- return FALSE;
+ return false;
}
#endif // 0
class wxTextCtrlCommand : public wxCommand
{
public:
- wxTextCtrlCommand(const wxString& name) : wxCommand(TRUE, name) { }
+ wxTextCtrlCommand(const wxString& name) : wxCommand(true, name) { }
// we don't use these methods as they don't make sense for us as we need a
// wxTextCtrl to be applied
- virtual bool Do() { wxFAIL_MSG(_T("shouldn't be called")); return FALSE; }
- virtual bool Undo() { wxFAIL_MSG(_T("shouldn't be called")); return FALSE; }
+ virtual bool Do() { wxFAIL_MSG(_T("shouldn't be called")); return false; }
+ virtual bool Undo() { wxFAIL_MSG(_T("shouldn't be called")); return false; }
// instead, our command processor uses these methods
virtual bool Do(wxTextCtrl *text) = 0;
public:
wxTextCtrlCommandProcessor(wxTextCtrl *text)
{
- m_compressInserts = FALSE;
+ m_compressInserts = false;
m_text = text;
}
virtual void Store(wxCommand *command);
// stop compressing insert commands when this is called
- void StopCompressing() { m_compressInserts = FALSE; }
+ void StopCompressing() { m_compressInserts = false; }
// accessors
wxTextCtrl *GetTextCtrl() const { return m_text; }
// the control we're associated with
wxTextCtrl *m_text;
- // if the flag is TRUE we're compressing subsequent insert commands into
+ // if the flag is true we're compressing subsequent insert commands into
// one so that the entire typing could be undone in one call to Undo()
bool m_compressInserts;
};
m_selStart =
m_selEnd = -1;
- m_isModified = FALSE;
- m_isEditable = TRUE;
+ m_isModified = false;
+ m_isEditable = true;
m_posLast =
m_curPos =
if ( !wxControl::Create(parent, id, pos, size, style,
validator, name) )
{
- return FALSE;
+ return false;
}
SetCursor(wxCURSOR_IBEAM);
// we can't show caret right now as we're not shown yet and so it would
// result in garbage on the screen - we'll do it after first OnPaint()
- m_hasCaret = FALSE;
+ m_hasCaret = false;
CreateInputHandler(wxINP_HANDLER_TEXTCTRL);
wxSizeEvent sizeEvent(GetSize(), GetId());
GetEventHandler()->ProcessEvent(sizeEvent);
- return TRUE;
+ return true;
}
wxTextCtrl::~wxTextCtrl()
}
// the number of rows changed
- return TRUE;
+ return true;
}
}
else // no line wrap
}
// the number of rows didn't change
- return FALSE;
+ return false;
}
void wxTextCtrl::RemoveLine(wxTextCoord line)
// as if it does we need to refresh everything below the changed
// text (it will be shifted...) and we can avoid it if there is no
// row relayout
- bool rowsNumberChanged = FALSE;
+ bool rowsNumberChanged = false;
// (1) join lines
const wxArrayString& linesOld = GetLines();
// we have the replacement line for this one
if ( ReplaceLine(line, lines[nReplaceLine]) )
{
- rowsNumberChanged = TRUE;
+ rowsNumberChanged = true;
}
UpdateMaxWidth(line);
{
// (4b) delete all extra lines (note that we need to delete
// them backwards because indices shift while we do it)
- bool deletedLongestLine = FALSE;
+ bool deletedLongestLine = false;
for ( wxTextCoord lineDel = lineEnd; lineDel >= line; lineDel-- )
{
if ( lineDel == MData().m_lineLongest )
{
// we will need to recalc the max line width
- deletedLongestLine = TRUE;
+ deletedLongestLine = true;
}
RemoveLine(lineDel);
}
// even the line number changed
- rowsNumberChanged = TRUE;
+ rowsNumberChanged = true;
// update line to exit the loop
line = lineEnd + 1;
if ( nReplaceLine < nReplaceCount )
{
// even the line number changed
- rowsNumberChanged = TRUE;
+ rowsNumberChanged = true;
do
{
RefreshLineRange(lineEnd + 1, 0);
// the vert scrollbar might [dis]appear
- MData().m_updateScrollbarY = TRUE;
+ MData().m_updateScrollbarY = true;
}
// must recalculate it - will do later
if ( !HasSelection() )
{
// no selection at all, hence no selection in this line
- return FALSE;
+ return false;
}
wxTextCoord lineStart, colStart;
if ( lineStart > line )
{
// this line is entirely above the selection
- return FALSE;
+ return false;
}
wxTextCoord lineEnd, colEnd;
if ( lineEnd < line )
{
// this line is entirely below the selection
- return FALSE;
+ return false;
}
if ( line == lineStart )
*end = GetLineLength(line);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
void wxTextCtrl::MarkDirty()
{
- m_isModified = TRUE;
+ m_isModified = true;
}
void wxTextCtrl::DiscardEdits()
{
- m_isModified = FALSE;
+ m_isModified = false;
}
void wxTextCtrl::SetEditable(bool editable)
// if they are out of range
if ( IsSingleLine() )
{
- return x > GetLastPosition() || y > 0 ? -1 : x;
+ return x > GetLastPosition() || y > 0 ? wxDefaultCoord : x;
}
else // multiline
{
if ( IsSingleLine() )
{
if ( (size_t)pos > m_value.length() )
- return FALSE;
+ return false;
if ( x )
*x = pos;
if ( y )
*y = 0;
- return TRUE;
+ return true;
}
else // multiline
{
_T("XYToPosition() or PositionToXY() broken") );
#endif // WXDEBUG_TEXT
- return TRUE;
+ return true;
}
else // go further down
{
}
// beyond the last line
- return FALSE;
+ return false;
}
}
else // must really calculate col/line from pos
{
if ( !PositionToXY(pos, &col, &line) )
- return FALSE;
+ return false;
}
int hLine = GetLineHeight();
if ( yOut )
*yOut = y;
- return TRUE;
+ return true;
}
bool wxTextCtrl::PositionToDeviceXY(wxTextPos pos,
{
wxCoord x, y;
if ( !PositionToLogicalXY(pos, &x, &y) )
- return FALSE;
+ return false;
// finally translate the logical text rect coords into physical client
// coords
CalcScrolledPosition(m_rectText.x + x, m_rectText.y + y, xOut, yOut);
- return TRUE;
+ return true;
}
wxPoint wxTextCtrl::GetCaretPosition() const
bool wxTextCtrl::DoCut()
{
if ( !HasSelection() )
- return FALSE;
+ return false;
Copy();
RemoveSelection();
- return TRUE;
+ return true;
}
void wxTextCtrl::Paste()
{
WriteText(text);
- return TRUE;
+ return true;
}
}
#endif // wxUSE_CLIPBOARD
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
}
// append the following insert commands to this one
- m_compressInserts = TRUE;
+ m_compressInserts = true;
// let the base class version will do the job normally
}
// and now do insert it
text->WriteText(m_text);
- return TRUE;
+ return true;
}
bool wxTextCtrlInsertCommand::Undo(wxTextCtrl *text)
{
- wxCHECK_MSG( CanUndo(), FALSE, _T("impossible to undo insert cmd") );
+ wxCHECK_MSG( CanUndo(), false, _T("impossible to undo insert cmd") );
// remove the text from where we inserted it
text->Remove(m_from, m_from + m_text.length());
- return TRUE;
+ return true;
}
bool wxTextCtrlRemoveCommand::CanUndo() const
m_textDeleted = text->GetSelectionText();
text->RemoveSelection();
- return TRUE;
+ return true;
}
bool wxTextCtrlRemoveCommand::Undo(wxTextCtrl *text)
text->SetInsertionPoint(m_from > posLast ? posLast : m_from);
text->WriteText(m_textDeleted);
- return TRUE;
+ return true;
}
void wxTextCtrl::Undo()
#endif // 0
MData().m_updateScrollbarX =
- MData().m_updateScrollbarY = TRUE;
+ MData().m_updateScrollbarY = true;
}
event.Skip();
wxString s(text);
wxTextCoord col;
- wxCoord wReal = -1;
+ wxCoord wReal = wxDefaultCoord;
switch ( HitTestLine(s, m_rectText.width, &col) )
{
/*
col--;
// recalc the width
- wReal = -1;
+ wReal = wxDefaultCoord;
}
//else: we can just see it
if ( colWordStart != col )
{
// will have to recalc the real width
- wReal = -1;
+ wReal = wxDefaultCoord;
col = colWordStart;
}
if ( widthReal )
{
- if ( wReal == -1 )
+ if ( wReal == wxDefaultCoord )
{
// calc it if not done yet
wReal = GetTextWidth(s.Truncate(col));
wxTextCoord *colOut,
wxTextCoord *rowOut) const
{
- return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL, FALSE);
+ return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL, false);
}
wxTextCtrlHitTestResult wxTextCtrl::HitTest2(wxCoord y0,
rowInLine = 0;
if ( row < 0 )
- return FALSE;
+ return false;
int nLines = GetNumberOfLines();
if ( WrapLines() )
if ( line == nLines )
{
// the row is out of range
- return FALSE;
+ return false;
}
}
else // no line wrapping, everything is easy
{
if ( row >= nLines )
- return FALSE;
+ return false;
line = row;
}
if ( rowInLineOut )
*rowInLineOut = rowInLine;
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if ( dx > 0 )
{
// refresh the uncovered part on the left
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
// and now the area on the right
rect.x = m_rectText.x + posLastVisible;
rect.width += m_rectText.width - posLastVisible;
}
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
// I don't know exactly why is this needed here but without it we may
// scroll the window again (from the same method) before the previously
// just to suppress compiler warnings about using uninit vars below
charWidth = maxWidth = 0;
- showScrollbarX = FALSE;
+ showScrollbarX = false;
}
// calc the scrollbars ranges
SetScrollbars(charWidth, lineHeight,
scrollRangeX, scrollRangeY,
x, y,
- TRUE /* no refresh */);
+ true /* no refresh */);
if ( scrollRangeXOld )
{
}
MData().m_updateScrollbarX =
- MData().m_updateScrollbarY = FALSE;
+ MData().m_updateScrollbarY = false;
}
void wxTextCtrl::OnInternalIdle()
rect.Offset(m_rectText.GetPosition());
// don't refresh beyond the text area unless we're refreshing the line wrap
- // marks in which case textOnly is FALSE
+ // marks in which case textOnly is false
if ( textOnly )
{
if ( rect.GetRight() > m_rectText.GetRight() )
wxLogTrace(_T("text"), _T("Refreshing (%d, %d)-(%d, %d)"),
rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
- Refresh(TRUE, &rect);
+ Refresh(true, &rect);
}
void wxTextCtrl::RefreshLineWrapMarks(wxTextCoord rowFirst,
rectMarks.y = rowFirst*GetLineHeight();
rectMarks.height = (rowLast - rowFirst)*GetLineHeight();
- RefreshTextRect(rectMarks, FALSE /* don't limit to text area */);
+ RefreshTextRect(rectMarks, false /* don't limit to text area */);
}
}
{
ShowCaret();
- m_hasCaret = TRUE;
+ m_hasCaret = true;
}
}
bool wxTextCtrl::SetFont(const wxFont& font)
{
if ( !wxControl::SetFont(font) )
- return FALSE;
+ return false;
// and refresh everything, of course
InitInsertionPoint();
Refresh();
- return TRUE;
+ return true;
}
bool wxTextCtrl::Enable(bool enable)
{
if ( !wxTextCtrlBase::Enable(enable) )
- return FALSE;
+ return false;
if (FindFocus() == this && GetCaret() &&
((enable && !GetCaret()->IsVisible()) ||
(!enable && GetCaret()->IsVisible())))
ShowCaret(enable);
- return TRUE;
+ return true;
}
void wxTextCtrl::CreateCaret()
const wxString& strArg)
{
// has the text changed as result of this action?
- bool textChanged = FALSE;
+ bool textChanged = false;
// the remembered cursor abscissa for multiline text controls is usually
// reset after each user action but for ones which do use it (UP and DOWN
// for example) we shouldn't do it - as indicated by this flag
- bool rememberAbscissa = FALSE;
+ bool rememberAbscissa = false;
// the command this action corresponds to or NULL if this action doesn't
// change text at all or can't be undone
wxTextCtrlCommand *command = (wxTextCtrlCommand *)NULL;
wxString action;
- bool del = FALSE,
- sel = FALSE;
+ bool del = false,
+ sel = false;
if ( actionOrig.StartsWith(wxACTION_TEXT_PREFIX_DEL, &action) )
{
if ( IsEditable() )
- del = TRUE;
+ del = true;
}
else if ( actionOrig.StartsWith(wxACTION_TEXT_PREFIX_SEL, &action) )
{
- sel = TRUE;
+ sel = true;
}
else // not selection nor delete action
{
if ( newPos != INVALID_POS_VALUE )
{
// remember where the cursor original had been
- rememberAbscissa = TRUE;
+ rememberAbscissa = true;
}
}
}
if ( newPos != INVALID_POS_VALUE )
{
// remember where the cursor original had been
- rememberAbscissa = TRUE;
+ rememberAbscissa = true;
}
}
}
// inserting text can be undone
command = new wxTextCtrlInsertCommand(strArg);
- textChanged = TRUE;
+ textChanged = true;
}
}
else if ( (action == wxACTION_TEXT_PAGE_UP) ||
}
// remember where the cursor original had been
- rememberAbscissa = TRUE;
+ rememberAbscissa = true;
bool goUp = action == wxACTION_TEXT_PAGE_UP;
for ( size_t line = 0; line < count; line++ )
}
// scroll vertically only
- Scroll(-1, y);
+ Scroll(wxDefaultCoord, y);
}
}
else if ( action == wxACTION_TEXT_SEL_WORD )
m_cmdProcessor->Submit(command);
// undoable commands always change text
- textChanged = TRUE;
+ textChanged = true;
}
else // no undoable command
{
GetEventHandler()->ProcessEvent(event);
// as the text changed...
- m_isModified = TRUE;
+ m_isModified = true;
}
- return TRUE;
+ return true;
}
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
// we're only interested in key presses
if ( !pressed )
- return FALSE;
+ return false;
int keycode = event.GetKeyCode();
{
consumer->PerformAction(action, -1, str);
- return TRUE;
+ return true;
}
return wxStdInputHandler::HandleKey(consumer, event, pressed);
}
// never refresh entirely
- return FALSE;
+ return false;
}
#endif // wxUSE_TEXTCTRL
if ( ms_theme )
{
// we already have a theme
- return TRUE;
+ return true;
}
wxString nameDefTheme;
{
wxLogError(_("Failed to initialize GUI: no built-in themes found."));
- return FALSE;
+ return false;
}
// Set the theme as current.
wxTheme::Set(theme);
- return TRUE;
+ return true;
}
/* static */ wxTheme *wxTheme::Set(wxTheme *theme)
wxStdScrollBarInputHandler::Press(scrollbar, doIt);
}
- virtual bool IsAllowedButton(int WXUNUSED(button)) { return TRUE; }
+ virtual bool IsAllowedButton(int WXUNUSED(button)) { return true; }
bool IsArrow() const
{
bool wxGTKRenderer::AreScrollbarsInsideBorder() const
{
// no, the scrollbars are outside the border in GTK+
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
DrawUpZag(dc, x, xRight, yMid, y);
DrawUpZag(dc, x + 1, xRight - 1, yMid, y + 1);
- bool drawIt = TRUE;
+ bool drawIt = true;
if ( flags & wxCONTROL_CHECKED )
dc.SetPen(m_penBlack);
else if ( flags & wxCONTROL_PRESSED )
dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
else // unchecked and unpressed
- drawIt = FALSE;
+ drawIt = false;
if ( drawIt )
DrawUpZag(dc, x + 2, xRight - 2, yMid, y + 2);
DrawDownZag(dc, x + 1, xRight - 1, yMid, yBottom - 1);
if ( !(flags & wxCONTROL_CHECKED) )
- drawIt = TRUE; // with the same pen
+ drawIt = true; // with the same pen
else if ( flags & wxCONTROL_PRESSED )
{
dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
- drawIt = TRUE;
+ drawIt = true;
}
else // checked and unpressed
- drawIt = FALSE;
+ drawIt = false;
if ( drawIt )
DrawDownZag(dc, x + 2, xRight - 2, yMid, yBottom - 2);
// normal unchecked
dc.SelectObject(m_bitmapsCheckbox[0][1]);
- DrawUncheckBitmap(dc, rect, FALSE);
+ DrawUncheckBitmap(dc, rect, false);
// pressed checked
m_bitmapsCheckbox[1][0] = m_bitmapsCheckbox[0][0];
// pressed unchecked
dc.SelectObject(m_bitmapsCheckbox[1][1]);
- DrawUncheckBitmap(dc, rect, TRUE);
+ DrawUncheckBitmap(dc, rect, true);
}
int row = flags & wxCONTROL_PRESSED ? 1 : 0;
rectLabel.SetRight(rect.GetRight());
}
- dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
+ dc.DrawBitmap(bitmap, xBmp, yBmp, true /* use mask */);
DrawLabel(dc, label, rectLabel, flags,
wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
wxSize wxGTKRenderer::GetFrameIconSize() const
{
- return wxSize(-1, -1);
+ return wxSize(wxDefaultCoord, wxDefaultCoord);
}
int
const wxKeyEvent& WXUNUSED(event),
bool WXUNUSED(pressed))
{
- return FALSE;
+ return false;
}
bool wxGTKInputHandler::HandleMouse(wxInputConsumer *control,
{
control->GetInputWindow()->SetFocus();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxGTKInputHandler::HandleMouseMove(wxInputConsumer *control,
{
if ( event.Entering() )
{
- control->GetInputWindow()->SetCurrent(TRUE);
+ control->GetInputWindow()->SetCurrent(true);
}
else if ( event.Leaving() )
{
- control->GetInputWindow()->SetCurrent(FALSE);
+ control->GetInputWindow()->SetCurrent(false);
}
else
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
control->PerformAction(wxACTION_CHECKBOX_TOGGLE);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
{
control->PerformAction(action);
- return TRUE;
+ return true;
}
}
void DrawShadedRect(wxDC& dc, wxRect *rect,
const wxPen& pen1, const wxPen& pen2);
- void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = FALSE);
+ void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = false);
void DrawArrow(wxDC& dc, const wxRect& rect,
wxArrowDirection arrowDir, wxArrowStyle arrowStyle);
x--;
// draw it
- dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
+ dc.DrawBitmap(bmp, x, y, true /* use mask */);
}
// ----------------------------------------------------------------------------
void DrawSunkenBorder(wxDC& dc, wxRect *rect);
// draw the border used for scrollbar arrows
- void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = FALSE);
+ void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = false);
// public DrawArrow()s helper
void DrawArrow(wxDC& dc, const wxRect& rect,
void DrawLine(wxDC& dc,
wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
- bool transpose = FALSE)
+ bool transpose = false)
{
if ( transpose )
dc.DrawLine(y1, x1, y2, x2);
bool wxWin32Renderer::AreScrollbarsInsideBorder() const
{
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
}
dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2 - 1,
- TRUE /* use mask */);
+ true /* use mask */);
wxRect rectLabel = rect;
int bmpWidth = bmp.GetWidth();
rectLabel.SetRight(rect.GetRight());
}
- dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
+ dc.DrawBitmap(bitmap, xBmp, yBmp, true /* use mask */);
DoDrawLabel(
dc, label, rectLabel,
x--;
// draw it
- dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
+ dc.DrawBitmap(bmp, x, y, true /* use mask */);
}
void wxWin32Renderer::DrawArrowButton(wxDC& dc,
DrawShadedRect(dc, &r, m_penBlack, m_penHighlight);
DrawShadedRect(dc, &r, m_penDarkGrey, m_penLightGrey);
DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), r);
- dc.DrawBitmap(m_bmpFrameButtons[idx], r.x+1, r.y+1, TRUE);
+ dc.DrawBitmap(m_bmpFrameButtons[idx], r.x+1, r.y+1, true);
}
else
{
DrawShadedRect(dc, &r, m_penHighlight, m_penBlack);
DrawShadedRect(dc, &r, m_penLightGrey, m_penDarkGrey);
DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), r);
- dc.DrawBitmap(m_bmpFrameButtons[idx], r.x, r.y, TRUE);
+ dc.DrawBitmap(m_bmpFrameButtons[idx], r.x, r.y, true);
}
}
// less than the standard one, but not when display not PDAs.
if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA)
{
- if ( !(window->GetWindowStyle() & wxBU_EXACTFIT) )
+ if ( !(window->GetWindowStyle() & wxBU_EXACTFIT) )
{
- wxSize szDef = wxButton::GetDefaultSize();
+ wxSize szDef = wxButton::GetDefaultSize();
if ( size->x < szDef.x )
size->x = szDef.x;
}
const wxKeyEvent& WXUNUSED(event),
bool WXUNUSED(pressed))
{
- return FALSE;
+ return false;
}
bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control,
{
win->SetFocus();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
wxInputHandler *handler)
: wxStdScrollBarInputHandler(renderer, handler)
{
- m_scrollPaused = FALSE;
+ m_scrollPaused = false;
m_interval = 0;
}
{
// stop if went beyond the position of the original click (this can only
// happen when we scroll by pages)
- bool stop = FALSE;
+ bool stop = false;
if ( action == wxACTION_SCROLL_PAGE_DOWN )
{
stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
scrollbar->Refresh();
- return FALSE;
+ return false;
}
return wxStdScrollBarInputHandler::OnScrollTimer(scrollbar, action);
// mouse move events normally - only do it while mouse is captured (i.e.
// when we're dragging the thumb or pressing on something)
if ( !m_winCapture )
- return FALSE;
+ return false;
if ( event.Entering() )
{
// we're not interested in this at all
- return FALSE;
+ return false;
}
wxScrollBar *scrollbar = wxStaticCast(control->GetInputWindow(), wxScrollBar);
if ( event.Leaving() )
{
// it surely didn't
- return FALSE;
+ return false;
}
ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
if ( ht == m_htLast )
{
// yes it did, resume scrolling
- m_scrollPaused = FALSE;
+ m_scrollPaused = false;
if ( m_timerScroll )
{
// we were scrolling by line/page, restart timer
m_timerScroll->Start(m_interval);
- Press(scrollbar, TRUE);
+ Press(scrollbar, true);
}
else // we were dragging the thumb
{
HandleThumbMove(scrollbar, m_eventLastDrag);
}
- return TRUE;
+ return true;
}
}
else // normal case, scrolling hasn't been paused
// pause scrolling
m_interval = m_timerScroll->GetInterval();
m_timerScroll->Stop();
- m_scrollPaused = TRUE;
+ m_scrollPaused = true;
// unpress the arrow
- Press(scrollbar, FALSE);
+ Press(scrollbar, false);
}
else // we were dragging the thumb
{
HandleThumbMove(scrollbar, m_eventStartDrag);
}
- return TRUE;
+ return true;
}
}
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
control->PerformAction(action);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
// ----------------------------------------------------------------------------
{
control->PerformAction(action);
- return TRUE;
+ return true;
}
}
wxWin32StatusBarInputHandler(wxInputHandler *handler)
: wxStdInputHandler(handler)
{
- m_isOnGrip = FALSE;
+ m_isOnGrip = false;
}
bool wxWin32StatusBarInputHandler::IsOnGrip(wxWindow *statbar,
wxTopLevelWindow *
parentTLW = wxDynamicCast(statbar->GetParent(), wxTopLevelWindow);
- wxCHECK_MSG( parentTLW, FALSE,
+ wxCHECK_MSG( parentTLW, false,
_T("the status bar should be a child of a TLW") );
// a maximized window can't be resized anyhow
}
}
- return FALSE;
+ return false;
}
bool wxWin32StatusBarInputHandler::HandleMouse(wxInputConsumer *consumer,
statbar->SetCursor(m_cursorOld);
- return TRUE;
+ return true;
}
}
}
tlw->PerformAction(wxACTION_TOPLEVEL_BUTTON_CLICK,
tlw->IsMaximized() ? wxTOPLEVEL_BUTTON_RESTORE
: wxTOPLEVEL_BUTTON_MAXIMIZE);
- return TRUE;
+ return true;
}
else if ( tlw->GetWindowStyle() & wxSYSTEM_MENU )
{
hit == wxHT_TOPLEVEL_ICON)) )
{
PopupSystemMenu(tlw, event.GetPosition());
- return TRUE;
+ return true;
}
}
}
{
if ( window->IsMaximized() )
{
- menu->Enable(wxID_MAXIMIZE_FRAME, FALSE);
- menu->Enable(wxID_MOVE_FRAME, FALSE);
+ menu->Enable(wxID_MAXIMIZE_FRAME, false);
+ menu->Enable(wxID_MOVE_FRAME, false);
if ( window->GetWindowStyle() & wxRESIZE_BORDER )
- menu->Enable(wxID_RESIZE_FRAME, FALSE);
+ menu->Enable(wxID_RESIZE_FRAME, false);
}
else
- menu->Enable(wxID_RESTORE_FRAME, FALSE);
+ menu->Enable(wxID_RESTORE_FRAME, false);
}
window->PopupMenu(menu, pos);
// ----------------------------------------------------------------------------
// value meaning that m_widthSeparator is not initialized
-static const wxCoord INVALID_WIDTH = -1;
+static const wxCoord INVALID_WIDTH = wxDefaultCoord;
// ----------------------------------------------------------------------------
// wxToolBarTool: our implementation of wxToolBarToolBase
{
// no position yet
m_x =
- m_y = -1;
+ m_y = wxDefaultCoord;
m_width =
m_height = 0;
// not pressed yet
- m_isInverted = FALSE;
+ m_isInverted = false;
// mouse not here yet
- m_underMouse = FALSE;
+ m_underMouse = false;
}
wxToolBarTool(wxToolBar *tbar, wxControl *control)
{
// no position yet
m_x =
- m_y = -1;
+ m_y = wxDefaultCoord;
m_width =
m_height = 0;
// not pressed yet
- m_isInverted = FALSE;
+ m_isInverted = false;
// mouse not here yet
- m_underMouse = FALSE;
+ m_underMouse = false;
}
// is this tool pressed, even temporarily? (this is different from being
void Invert() { m_isInverted = !m_isInverted; }
// Set underMouse
- void SetUnderMouse( bool under = TRUE ) { m_underMouse = under; }
+ void SetUnderMouse( bool under = true ) { m_underMouse = under; }
bool IsUnderMouse() { return m_underMouse; }
public:
wxCoord m_height;
private:
- // TRUE if the tool is pressed
+ // true if the tool is pressed
bool m_isInverted;
- // TRUE if the tool is under the mouse
+ // true if the tool is under the mouse
bool m_underMouse;
};
void wxToolBar::Init()
{
// no tools yet
- m_needsLayout = FALSE;
+ m_needsLayout = false;
// unknown widths for the tools and separators
m_widthSeparator = INVALID_WIDTH;
if ( !wxToolBarBase::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
{
- return FALSE;
+ return false;
}
CreateInputHandler(wxINP_HANDLER_TOOLBAR);
SetBestSize(size);
- return TRUE;
+ return true;
}
wxToolBar::~wxToolBar()
wxToolBarToolBase * WXUNUSED(tool))
{
// recalculate the toolbar geometry before redrawing it the next time
- m_needsLayout = TRUE;
+ m_needsLayout = true;
// and ensure that we indeed are going to redraw
Refresh();
- return TRUE;
+ return true;
}
bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos),
wxToolBarToolBase * WXUNUSED(tool))
{
// as above
- m_needsLayout = TRUE;
+ m_needsLayout = true;
Refresh();
- return TRUE;
+ return true;
}
void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable)
if ( IsVertical() )
{
- if (tool->IsButton())
+ if (tool->IsButton())
{
rect.width = m_defaultWidth;
rect.height = m_defaultHeight;
bool wxToolBar::Realize()
{
if ( !wxToolBarBase::Realize() )
- return FALSE;
+ return false;
- m_needsLayout = TRUE;
+ m_needsLayout = true;
DoLayout();
SetBestSize(wxDefaultSize);
- return TRUE;
+ return true;
}
void wxToolBar::DoLayout()
{
wxASSERT_MSG( m_needsLayout, _T("why are we called?") );
- m_needsLayout = FALSE;
+ m_needsLayout = false;
wxCoord x = m_xMargin,
y = m_yMargin;
wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
// Correct width and height if needed.
- if ( width == -1 || height == -1 )
+ if ( width == wxDefaultCoord || height == wxDefaultCoord )
{
int tmp_width, tmp_height;
GetSize(&tmp_width, &tmp_height);
- if ( width == -1 )
+ if ( width == wxDefaultCoord )
width = tmp_width;
- if ( height == -1 )
+ if ( height == wxDefaultCoord )
height = tmp_height;
}
}
else // simple non-checkable tool
{
- isToggled = FALSE;
+ isToggled = false;
}
OnLeftClick( tool->GetId(), isToggled );
}
else if ( action == wxACTION_TOOLBAR_ENTER )
{
- wxCHECK_MSG( tool, FALSE, _T("no tool to enter?") );
+ wxCHECK_MSG( tool, false, _T("no tool to enter?") );
if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
{
- tool->SetUnderMouse( TRUE );
+ tool->SetUnderMouse( true );
if ( !tool->IsToggled() )
RefreshTool( tool );
}
else if ( action == wxACTION_TOOLBAR_LEAVE )
{
- wxCHECK_MSG( tool, FALSE, _T("no tool to leave?") );
+ wxCHECK_MSG( tool, false, _T("no tool to leave?") );
if ( HasFlag(wxTB_FLAT) && tool->IsEnabled() )
{
- tool->SetUnderMouse( FALSE );
+ tool->SetUnderMouse( false );
if ( !tool->IsToggled() )
RefreshTool( tool );
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ============================================================================
if ( event.LeftDown() || event.LeftDClick() )
{
if ( !tool || !tool->IsEnabled() )
- return TRUE;
+ return true;
m_winCapture = tbar;
m_winCapture->CaptureMouse();
consumer->PerformAction( wxACTION_BUTTON_PRESS, tool->GetId() );
- return TRUE;
+ return true;
}
else if ( event.LeftUp() )
{
m_toolCapture = NULL;
- return TRUE;
+ return true;
}
//else: don't do anything special about the double click
}
tool = NULL;
if (tool == m_toolLast)
- return TRUE;
+ return true;
if (tool)
consumer->PerformAction( wxACTION_BUTTON_PRESS, m_toolCapture->GetId() );
else
{
if (tool == m_toolLast)
- return TRUE;
+ return true;
if (m_toolLast)
{
m_toolLast = tool;
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool wxStdToolbarInputHandler::HandleFocus(wxInputConsumer *consumer,
consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
}
- return TRUE;
+ return true;
}
bool wxStdToolbarInputHandler::HandleActivation(wxInputConsumer *consumer,
consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() );
}
- return TRUE;
+ return true;
}
#endif // wxUSE_TOOLBAR
void wxTopLevelWindow::Init()
{
- m_isActive = FALSE;
+ m_isActive = false;
m_windowStyle = 0;
m_pressedButton = 0;
}
if ( !wxTopLevelWindowNative::Create(parent, id, title, pos,
size, style, name) )
- return FALSE;
+ return false;
if ( ms_drawDecorations )
{
m_exStyle = exstyleOrig;
}
- return TRUE;
+ return true;
}
bool wxTopLevelWindow::ShowFullScreen(bool show, long style)
{
- if ( show == IsFullScreen() ) return FALSE;
+ if ( show == IsFullScreen() ) return false;
if ( ms_drawDecorations )
{
wxSize size = m_renderer->GetFrameIconSize();
const wxIcon& icon = icons.GetIcon( size );
- if ( !icon.Ok() || size.x == -1 )
+ if ( !icon.Ok() || size.x == wxDefaultCoord )
m_titlebarIcon = icon;
else
{
cursor = wxCursor(wxCURSOR_SIZENWSE);
break;
default:
- return FALSE;
+ return false;
#if 0
// not rachable due to earlier return
break;
#endif
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#define wxINTERACTIVE_RESIZE_DIR \
data.m_rect.height += diff.y;
}
- if ( data.m_minSize.x != -1 && data.m_rect.width < data.m_minSize.x )
+ if ( data.m_minSize.x != wxDefaultCoord && data.m_rect.width < data.m_minSize.x )
{
if ( data.m_flags & wxINTERACTIVE_RESIZE_W )
data.m_rect.x -= data.m_minSize.x - data.m_rect.width;
data.m_rect.width = data.m_minSize.x;
}
- if ( data.m_maxSize.x != -1 && data.m_rect.width > data.m_maxSize.x )
+ if ( data.m_maxSize.x != wxDefaultCoord && data.m_rect.width > data.m_maxSize.x )
{
if ( data.m_flags & wxINTERACTIVE_RESIZE_W )
data.m_rect.x -= data.m_minSize.x - data.m_rect.width;
data.m_rect.width = data.m_maxSize.x;
}
- if ( data.m_minSize.y != -1 && data.m_rect.height < data.m_minSize.y )
+ if ( data.m_minSize.y != wxDefaultCoord && data.m_rect.height < data.m_minSize.y )
{
if ( data.m_flags & wxINTERACTIVE_RESIZE_N )
data.m_rect.y -= data.m_minSize.y - data.m_rect.height;
data.m_rect.height = data.m_minSize.y;
}
- if ( data.m_maxSize.y != -1 && data.m_rect.height > data.m_maxSize.y )
+ if ( data.m_maxSize.y != wxDefaultCoord && data.m_rect.height > data.m_maxSize.y )
{
if ( data.m_flags & wxINTERACTIVE_RESIZE_N )
data.m_rect.y -= data.m_minSize.y - data.m_rect.height;
void wxInteractiveMoveHandler::OnKeyDown(wxKeyEvent& event)
{
- wxPoint diff(-1,-1);
+ wxPoint diff(wxDefaultCoord,wxDefaultCoord);
switch ( event.GetKeyCode() )
{
return;
}
- if ( diff.x != -1 )
+ if ( diff.x != wxDefaultCoord )
{
if ( m_data.m_flags & wxINTERACTIVE_WAIT_FOR_INPUT )
{
if ( m_data.m_sizingCursor )
{
wxEndBusyCursor();
- m_data.m_sizingCursor = FALSE;
+ m_data.m_sizingCursor = false;
}
if ( m_data.m_flags & wxINTERACTIVE_MOVE )
}
wxPoint warp;
- bool changeCur = FALSE;
+ bool changeCur = false;
if ( m_data.m_flags & wxINTERACTIVE_MOVE )
{
{
m_data.m_flags |= wxINTERACTIVE_RESIZE_N;
m_data.m_pos.y = m_data.m_window->GetPosition().y;
- changeCur = TRUE;
+ changeCur = true;
}
else if ( diff.y > 0 )
{
m_data.m_flags |= wxINTERACTIVE_RESIZE_S;
m_data.m_pos.y = m_data.m_window->GetPosition().y +
m_data.m_window->GetSize().y;
- changeCur = TRUE;
+ changeCur = true;
}
}
if ( !(m_data.m_flags &
{
m_data.m_flags |= wxINTERACTIVE_RESIZE_W;
m_data.m_pos.x = m_data.m_window->GetPosition().x;
- changeCur = TRUE;
+ changeCur = true;
}
else if ( diff.x > 0 )
{
m_data.m_flags |= wxINTERACTIVE_RESIZE_E;
m_data.m_pos.x = m_data.m_window->GetPosition().x +
m_data.m_window->GetSize().x;
- changeCur = TRUE;
+ changeCur = true;
}
}
if ( m_data.m_sizingCursor )
wxEndBusyCursor();
wxBeginBusyCursor(&cur);
- m_data.m_sizingCursor = TRUE;
+ m_data.m_sizingCursor = true;
}
}
}
{
wxCursor sizingCursor(wxCURSOR_SIZING);
wxBeginBusyCursor(&sizingCursor);
- data.m_sizingCursor = TRUE;
+ data.m_sizingCursor = true;
}
else
#endif
- data.m_sizingCursor = FALSE;
+ data.m_sizingCursor = false;
data.m_window = this;
data.m_evtLoop = &loop;
m_isActive = isActive;
RefreshTitleBar();
}
- return TRUE;
+ return true;
}
else if ( action == wxACTION_TOPLEVEL_BUTTON_PRESS )
{
m_pressedButton = numArg;
RefreshTitleBar();
- return TRUE;
+ return true;
}
else if ( action == wxACTION_TOPLEVEL_BUTTON_RELEASE )
{
m_pressedButton = 0;
RefreshTitleBar();
- return TRUE;
+ return true;
}
else if ( action == wxACTION_TOPLEVEL_BUTTON_CLICK )
m_pressedButton = 0;
RefreshTitleBar();
ClickTitleBarButton(numArg);
- return TRUE;
+ return true;
}
else if ( action == wxACTION_TOPLEVEL_MOVE )
{
InteractiveMove(wxINTERACTIVE_MOVE);
- return TRUE;
+ return true;
}
else if ( action == wxACTION_TOPLEVEL_RESIZE )
if ( numArg & wxHT_TOPLEVEL_BORDER_E )
flags |= wxINTERACTIVE_RESIZE_E;
InteractiveMove(flags);
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
void wxTopLevelWindow::OnSystemMenu(wxCommandEvent& event)
{
- bool ret = TRUE;
+ bool ret = true;
switch (event.GetId())
{
break;
default:
- ret = FALSE;
+ ret = false;
}
if ( !ret )
m_winCapture = NULL;
m_winHitTest = 0;
m_winPressed = 0;
- m_borderCursorOn = FALSE;
+ m_borderCursorOn = false;
}
bool wxStdFrameInputHandler::HandleMouse(wxInputConsumer *consumer,
m_winHitTest = hit;
m_winPressed = hit;
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_PRESS, m_winPressed);
- return TRUE;
+ return true;
}
else if ( (hit & wxHT_TOPLEVEL_TITLEBAR) && !w->IsMaximized() )
{
consumer->PerformAction(wxACTION_TOPLEVEL_MOVE);
- return TRUE;
+ return true;
}
else if ( (consumer->GetInputWindow()->GetWindowStyle() & wxRESIZE_BORDER)
&& (hit & wxHT_TOPLEVEL_ANY_BORDER) )
{
consumer->PerformAction(wxACTION_TOPLEVEL_RESIZE, hit);
- return TRUE;
+ return true;
}
}
if ( m_winHitTest == m_winPressed )
{
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_CLICK, m_winPressed);
- return TRUE;
+ return true;
}
}
//else: the mouse was released outside the window, this doesn't
consumer->PerformAction(wxACTION_TOPLEVEL_BUTTON_PRESS, m_winPressed);
m_winHitTest = hit;
- return TRUE;
+ return true;
}
}
else if ( consumer->GetInputWindow()->GetWindowStyle() & wxRESIZE_BORDER )
if ( m_borderCursorOn )
{
- m_borderCursorOn = FALSE;
+ m_borderCursorOn = false;
win->SetCursor(m_origCursor);
}
if ( m_borderCursorOn )
{
consumer->GetInputWindow()->SetCursor(m_origCursor);
- m_borderCursorOn = FALSE;
+ m_borderCursorOn = false;
}
consumer->PerformAction(wxACTION_TOPLEVEL_ACTIVATE, activated);
- return FALSE;
+ return false;
}
m_scrollbarVert =
m_scrollbarHorz = (wxScrollBar *)NULL;
- m_isCurrent = FALSE;
+ m_isCurrent = false;
m_renderer = wxTheme::Get()->GetRenderer();
- m_oldSize.x = -1;
- m_oldSize.y = -1;
+ m_oldSize.x = wxDefaultCoord;
+ m_oldSize.y = wxDefaultCoord;
}
bool wxWindow::Create(wxWindow *parent,
actualStyle | wxCLIP_CHILDREN,
name) )
{
- return FALSE;
+ return false;
}
// Set full style again, including those we didn't want present
if ( style & wxALWAYS_SHOW_SB )
{
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( TRUE );
+ SetInsertIntoMain( true );
#endif
- m_scrollbarVert = new wxScrollBar(this, -1,
+ m_scrollbarVert = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_VERTICAL);
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( FALSE );
+ SetInsertIntoMain( false );
#endif
}
if ( style & wxHSCROLL )
{
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( TRUE );
+ SetInsertIntoMain( true );
#endif
- m_scrollbarHorz = new wxScrollBar(this, -1,
+ m_scrollbarHorz = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_HORIZONTAL);
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( FALSE );
+ SetInsertIntoMain( false );
#endif
}
PositionScrollbars();
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
EraseBackground( dc, rect );
}
- return TRUE;
+ return true;
}
void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect)
// debugging helper
#ifdef WXDEBUG_REFRESH
- static bool s_refreshDebug = FALSE;
+ static bool s_refreshDebug = false;
if ( s_refreshDebug )
{
wxWindowDC dc(this);
bool wxWindow::Enable(bool enable)
{
if ( !wxWindowNative::Enable(enable) )
- return FALSE;
+ return false;
// disabled window can't keep focus
if ( FindFocus() == this && GetParent() != NULL )
Refresh();
}
- return TRUE;
+ return true;
}
bool wxWindow::IsFocused() const
bool wxWindow::IsPressed() const
{
- return FALSE;
+ return false;
}
bool wxWindow::IsDefault() const
{
- return FALSE;
+ return false;
}
bool wxWindow::IsCurrent() const
bool wxWindow::SetCurrent(bool doit)
{
if ( doit == m_isCurrent )
- return FALSE;
+ return false;
m_isCurrent = doit;
if ( CanBeHighlighted() )
Refresh();
- return TRUE;
+ return true;
}
int wxWindow::GetStateFlags() const
// area.
wxSize newSize = event.GetSize();
- if (m_oldSize.x == -1 && m_oldSize.y == -1)
+ if (m_oldSize.x == wxDefaultCoord && m_oldSize.y == wxDefaultCoord)
{
m_oldSize = newSize;
return;
rect.width = m_oldSize.x;
rect.y = m_oldSize.y-2;
rect.height = 1;
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
else if (newSize.y < m_oldSize.y)
{
rect.x = 0;
rect.height = 1;
rect.width = newSize.x;
- wxWindowNative::Refresh( TRUE, &rect );
+ wxWindowNative::Refresh( true, &rect );
}
if (newSize.x > m_oldSize.x)
rect.height = m_oldSize.y;
rect.x = m_oldSize.x-2;
rect.width = 1;
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
else if (newSize.x < m_oldSize.x)
{
rect.y = 0;
rect.width = 1;
rect.height = newSize.y;
- wxWindowNative::Refresh( TRUE, &rect );
+ wxWindowNative::Refresh( true, &rect );
}
}
else
rect.width = m_oldSize.x;
rect.y = m_oldSize.y-4;
rect.height = 2;
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
else if (newSize.y < m_oldSize.y)
{
rect.x = 0;
rect.height = 2;
rect.width = newSize.x;
- wxWindowNative::Refresh( TRUE, &rect );
+ wxWindowNative::Refresh( true, &rect );
}
if (newSize.x > m_oldSize.x)
rect.height = m_oldSize.y;
rect.x = m_oldSize.x-4;
rect.width = 2;
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
else if (newSize.x < m_oldSize.x)
{
rect.y = 0;
rect.width = 2;
rect.height = newSize.y;
- wxWindowNative::Refresh( TRUE, &rect );
+ wxWindowNative::Refresh( true, &rect );
}
}
wxASSERT_MSG( pageSize <= range,
_T("page size can't be greater than range") );
- bool hasClientSizeChanged = FALSE;
+ bool hasClientSizeChanged = false;
wxScrollBar *scrollbar = GetScrollbar(orient);
if ( range && (pageSize < range) )
{
{
// create it
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( TRUE );
+ SetInsertIntoMain( true );
#endif
- scrollbar = new wxScrollBar(this, -1,
+ scrollbar = new wxScrollBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
orient & wxVERTICAL ? wxSB_VERTICAL
: wxSB_HORIZONTAL);
#if wxUSE_TWO_WINDOWS
- SetInsertIntoMain( FALSE );
+ SetInsertIntoMain( false );
#endif
if ( orient & wxVERTICAL )
m_scrollbarVert = scrollbar;
m_scrollbarHorz = scrollbar;
// the client area diminished as we created a scrollbar
- hasClientSizeChanged = TRUE;
+ hasClientSizeChanged = true;
PositionScrollbars();
}
m_scrollbarHorz = NULL;
// the client area increased as we removed a scrollbar
- hasClientSizeChanged = TRUE;
+ hasClientSizeChanged = true;
// the size of the remaining scrollbar must be adjusted
if ( m_scrollbarHorz || m_scrollbarVert )
if ( dx )
{
r = ScrollNoRefresh(dx, 0, rect);
- Refresh(TRUE /* erase bkgnd */, &r);
+ Refresh(true /* erase bkgnd */, &r);
}
if ( dy )
{
r = ScrollNoRefresh(0, dy, rect);
- Refresh(TRUE /* erase bkgnd */, &r);
+ Refresh(true /* erase bkgnd */, &r);
}
// scroll children accordingly: