{
wxCaretBase::Init();
- m_hasCaret = FALSE;
+ m_hasCaret = false;
}
// override base class virtuals
// items may be checked
virtual bool IsChecked(size_t uiIndex) const;
- virtual void Check(size_t uiIndex, bool bCheck = TRUE);
+ virtual void Check(size_t uiIndex, bool bCheck = true);
// return the index of the item at this position or wxNOT_FOUND
int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); }
virtual bool Flush();
// X11 has two clipboards which get selected by this call. Empty on MSW.
- void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
+ void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
private:
bool m_clearOnExit;
CALL_CARET_API(CreateCaret, (GetWinHwnd(GetWindow()), 0,
m_width, m_height));
- m_hasCaret = TRUE;
+ m_hasCaret = true;
}
return m_hasCaret;
{
if ( m_hasCaret )
{
- m_hasCaret = FALSE;
+ m_hasCaret = false;
CALL_CARET_API(DestroyCaret, ());
}
{
if ( m_hasCaret )
{
- m_hasCaret = FALSE;
+ m_hasCaret = false;
CALL_CARET_API(DestroyCaret, ());
MSWCreateCaret();
OnSetFocus();
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
wxBEGIN_HANDLERS_TABLE(wxCheckBox)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
+wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
#else
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
#endif
event.SetEventObject(this);
ProcessCommand(event);
- return TRUE;
+ return true;
}
bool wxCheckBox::Create(wxWindow *parent,
const wxString& name)
{
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
long msStyle = WS_TABSTOP;
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h")
wxBEGIN_PROPERTIES_TABLE(wxCheckListBox)
- wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent )
+ wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent )
wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , wxLB_OWNERDRAW /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxCheckListBox)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
+wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
#else
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
};
wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex)
- : wxOwnerDrawn(wxEmptyString, TRUE) // checkable
+ : wxOwnerDrawn(wxEmptyString, true) // checkable
{
- m_bChecked = FALSE;
+ m_bChecked = false;
m_pParent = pParent;
m_nIndex = nIndex;
}
*/
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
// change the state of the item and redraw it
HWND hwndListbox = (HWND)m_pParent->GetHWND();
- RECT rcUpdate;
+ RECT rcUpdate;
- if ( ::SendMessage(hwndListbox, LB_GETITEMRECT,
- m_nIndex, (LPARAM)&rcUpdate) == LB_ERR )
- {
- wxLogDebug(wxT("LB_GETITEMRECT failed"));
- }
+ if ( ::SendMessage(hwndListbox, LB_GETITEMRECT,
+ m_nIndex, (LPARAM)&rcUpdate) == LB_ERR )
+ {
+ wxLogDebug(wxT("LB_GETITEMRECT failed"));
+ }
- InvalidateRect(hwndListbox, &rcUpdate, FALSE);
+ ::InvalidateRect(hwndListbox, &rcUpdate, FALSE);
}
// send an "item checked" event
wxListBox::SetFont(font);
- return TRUE;
+ return true;
}
// create/retrieve item
// add place for the check mark
pStruct->itemWidth += wxOwnerDrawn::GetDefaultMarginWidth();
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
// check items
bool wxCheckListBox::IsChecked(size_t uiIndex) const
{
- wxCHECK_MSG( uiIndex < (size_t)GetCount(), FALSE, _T("bad wxCheckListBox index") );
+ wxCHECK_MSG( uiIndex < (size_t)GetCount(), false, _T("bad wxCheckListBox index") );
return GetItem(uiIndex)->IsChecked();
}
{
// initialize wxControl
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
// now create the real HWND
if ( !MSWCreateControl(wxT("COMBOBOX"), _T(""), pos, size) )
- return FALSE;
+ return false;
// choice/combobox normally has "white" (depends on colour scheme, of
// and now we may finally size the control properly (if needed)
SetBestSize(size);
- return TRUE;
+ return true;
}
bool wxChoice::Create(wxWindow *parent,
for ( int i = 0; i < count; i++ )
{
// as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too
- if ( GetString(i).IsSameAs(s, FALSE) )
+ if ( GetString(i).IsSameAs(s, false) )
return i;
}
void wxChoice::UpdateVisibleHeight()
{
// be careful to not change the width here
- DoSetSize(-1, -1, -1, GetSize().y, wxSIZE_USE_EXISTING);
+ DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, GetSize().y, wxSIZE_USE_EXISTING);
}
void wxChoice::DoMoveWindow(int x, int y, int width, int height)
// total height of the control including the drop down list -- but only
// sometimes, and normally it isn't... I have no idea about what to do with
// this
- wxControl::DoGetSize(w, h);
+ wxControl::DoGetSize(w, h);
}
void wxChoice::DoSetSize(int x, int y,
// the height which we must pass to Windows should be the total height of
// the control including the drop down list while the height given to us
// is, of course, just the height of the permanently visible part of it
- if ( height != -1 )
+ if ( height != wxDefaultCoord )
{
// don't make the drop down list too tall, arbitrarily limit it to 40
// items max and also don't leave it empty
// if the height specified for the visible part of the control is
// different from the current one, we need to change it separately
// as it is not affected by normal WM_SETSIZE
- if ( height != -1 )
+ if ( height != wxDefaultCoord )
{
const int delta = heightOrig - GetSize().y;
if ( delta )
if ( param != CBN_SELCHANGE)
{
// "selection changed" is the only event we're after
- return FALSE;
+ return false;
}
int n = GetSelection();
ProcessCommand(event);
}
- return TRUE;
+ return true;
}
WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
// old-style clipboard functions using Windows API
// ---------------------------------------------------------------------------
-static bool gs_wxClipboardIsOpen = FALSE;
+static bool gs_wxClipboardIsOpen = false;
bool wxOpenClipboard()
{
- wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, wxT("clipboard already opened.") );
+ wxCHECK_MSG( !gs_wxClipboardIsOpen, true, wxT("clipboard already opened.") );
wxWindow *win = wxTheApp->GetTopWindow();
if ( win )
{
wxLogDebug(wxT("Can not open clipboard without a main window."));
- return FALSE;
+ return false;
}
}
bool wxCloseClipboard()
{
- wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, wxT("clipboard is not opened") );
+ wxCHECK_MSG( gs_wxClipboardIsOpen, false, wxT("clipboard is not opened") );
- gs_wxClipboardIsOpen = FALSE;
+ gs_wxClipboardIsOpen = false;
if ( ::CloseClipboard() == 0 )
{
wxLogSysError(_("Failed to close the clipboard."));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxEmptyClipboard()
{
wxLogSysError(_("Failed to empty the clipboard."));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxIsClipboardOpened()
if ( ::IsClipboardFormatAvailable(cf) )
{
// ok from the first try
- return TRUE;
+ return true;
}
// for several standard formats, we can convert from some other ones too
#endif // wxUSE_ENH_METAFILE
default:
- return FALSE;
+ return false;
}
}
SelectObject(hdcSrc, old);
DeleteDC(hdcMem);
DeleteDC(hdcSrc);
- return FALSE;
+ return false;
}
HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap);
default:
{
wxLogError(_("Unsupported clipboard format."));
- return FALSE;
+ return false;
}
case wxDF_OEMTEXT:
case wxDF_HTML:
{
char* html = (char *)data;
-
+
// Create temporary buffer for HTML header...
char *buf = new char [400 + strlen(html)];
- if(!buf) return FALSE;
-
+ if(!buf) return false;
+
// Get clipboard id for HTML format...
static int cfid = 0;
if(!cfid) cfid = RegisterClipboardFormat(wxT("HTML Format"));
-
+
// Create a template string for the HTML header...
strcpy(buf,
"Version:0.9\r\n"
"EndFragment:00000000\r\n"
"<html><body>\r\n"
"<!--StartFragment -->\r\n");
-
+
// Append the HTML...
strcat(buf, html);
strcat(buf, "\r\n");
"<!--EndFragment-->\r\n"
"</body>\r\n"
"</html>");
-
+
// Now go back, calculate all the lengths, and write out the
// necessary header information. Note, wsprintf() truncates the
// string when you overwrite it so you follow up with code to replace
char *ptr = strstr(buf, "StartHTML");
wsprintf(ptr+10, "%08u", strstr(buf, "<html>") - buf);
*(ptr+10+8) = '\r';
-
+
ptr = strstr(buf, "EndHTML");
wsprintf(ptr+8, "%08u", strlen(buf));
*(ptr+8+8) = '\r';
-
+
ptr = strstr(buf, "StartFragment");
wsprintf(ptr+14, "%08u", strstr(buf, "<!--StartFrag") - buf);
*(ptr+14+8) = '\r';
-
+
ptr = strstr(buf, "EndFragment");
wsprintf(ptr+12, "%08u", strstr(buf, "<!--EndFrag") - buf);
*(ptr+12+8) = '\r';
-
+
// Now you have everything in place ready to put on the
// clipboard.
-
+
// Allocate global memory for transfer...
HGLOBAL hText = GlobalAlloc(GMEM_MOVEABLE |GMEM_DDESHARE, strlen(buf)+4);
-
+
// Put your string in the global memory...
ptr = (char *)GlobalLock(hText);
strcpy(ptr, buf);
GlobalUnlock(hText);
-
+
handle = ::SetClipboardData(cfid, hText);
-
+
// Free memory...
GlobalFree(hText);
-
+
// Clean up...
delete [] buf;
break;
{
wxLogSysError(_("Failed to set clipboard data."));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
wxClipboard::wxClipboard()
{
- m_clearOnExit = FALSE;
- m_isOpened = FALSE;
+ m_clearOnExit = false;
+ m_isOpened = false;
}
wxClipboard::~wxClipboard()
{
wxLogLastError(wxT("OleFlushClipboard"));
- return FALSE;
+ return false;
}
else
{
- m_clearOnExit = FALSE;
+ m_clearOnExit = false;
- return TRUE;
+ return true;
}
#else // !wxUSE_OLE_CLIPBOARD
- return FALSE;
+ return false;
#endif // wxUSE_OLE_CLIPBOARD/!wxUSE_OLE_CLIPBOARD
}
bool wxClipboard::Open()
{
// OLE opens clipboard for us
- m_isOpened = TRUE;
+ m_isOpened = true;
#if wxUSE_OLE_CLIPBOARD
- return TRUE;
+ return true;
#else
return wxOpenClipboard();
#endif
if ( data )
return AddData(data);
else
- return TRUE;
+ return true;
}
bool wxClipboard::AddData( wxDataObject *data )
{
- wxCHECK_MSG( data, FALSE, wxT("data is invalid") );
+ wxCHECK_MSG( data, false, wxT("data is invalid") );
#if wxUSE_OLE_CLIPBOARD
HRESULT hr = OleSetClipboard(data->GetInterface());
// don't free anything in this case
- return FALSE;
+ return false;
}
// we have a problem here because we should delete wxDataObject, but we
// using OLE clipboard when the app terminates - by default, we call
// OleSetClipboard(NULL) which won't waste RAM, but the app can call
// wxClipboard::Flush() to chaneg this
- m_clearOnExit = TRUE;
+ m_clearOnExit = true;
- return TRUE;
+ return true;
#elif wxUSE_DATAOBJ
- wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
+ wxCHECK_MSG( wxIsClipboardOpened(), false, wxT("clipboard not open") );
wxDataFormat format = data->GetPreferredFormat();
#if 1
// TODO
wxLogError(wxT("Not implemented because wxMetafileDataObject does not contain width and height values."));
- return FALSE;
+ return false;
#else
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
// return wxSetClipboardData(data);
// TODO
wxLogError(wxT("Not implemented."));
- return FALSE;
+ return false;
}
}
#else // !wxUSE_DATAOBJ
- return FALSE;
+ return false;
#endif // wxUSE_DATAOBJ/!wxUSE_DATAOBJ
}
void wxClipboard::Close()
{
- m_isOpened = FALSE;
+ m_isOpened = false;
// OLE closes clipboard for us
#if !wxUSE_OLE_CLIPBOARD
wxCloseClipboard();
{
wxLogSysError(hr, _("Failed to get data from the clipboard"));
- return FALSE;
+ return false;
}
// build the list of supported formats
// get the data for the given formats
FORMATETC formatEtc;
CLIPFORMAT cf;
- bool result = FALSE;
+ bool result = false;
// enumerate all explicit formats on the clipboard.
// note that this does not include implicit / synthetic (automatically
{
// convert to NativeFormat Id
cf = formats[n].GetFormatId();
-
+
// if the format is not available, try the next one
// this test includes implicit / sythetic formats
if ( !::IsClipboardFormatAvailable(cf) )
continue;
-
+
formatEtc.cfFormat = cf;
formatEtc.ptd = NULL;
formatEtc.dwAspect = DVASPECT_CONTENT;
if ( SUCCEEDED(hr) )
{
// pass the data to the data object
- hr = data.GetInterface()->SetData(&formatEtc, &medium, TRUE);
+ hr = data.GetInterface()->SetData(&formatEtc, &medium, true);
if ( FAILED(hr) )
{
wxLogDebug(wxT("Failed to set data in wxIDataObject"));
}
else
{
- result = TRUE;
+ result = true;
}
}
//else: unsupported tymed?
return result;
#elif wxUSE_DATAOBJ
- wxCHECK_MSG( wxIsClipboardOpened(), FALSE, wxT("clipboard not open") );
+ wxCHECK_MSG( wxIsClipboardOpened(), false, wxT("clipboard not open") );
wxDataFormat format = data.GetPreferredFormat();
switch ( format )
wxTextDataObject& textDataObject = (wxTextDataObject &)data;
char* s = (char*)wxGetClipboardData(format);
if ( !s )
- return FALSE;
+ return false;
textDataObject.SetText(wxString::FromAscii(s));
delete [] s;
- return TRUE;
+ return true;
}
case wxDF_BITMAP:
wxBitmapDataObject& bitmapDataObject = (wxBitmapDataObject &)data;
wxBitmap* bitmap = (wxBitmap *)wxGetClipboardData(data.GetPreferredFormat());
if ( !bitmap )
- return FALSE;
+ return false;
bitmapDataObject.SetBitmap(*bitmap);
delete bitmap;
- return TRUE;
+ return true;
}
#if wxUSE_METAFILE
case wxDF_METAFILE:
wxMetafileDataObject& metaFileDataObject = (wxMetafileDataObject &)data;
wxMetafile* metaFile = (wxMetafile *)wxGetClipboardData(wxDF_METAFILE);
if ( !metaFile )
- return FALSE;
+ return false;
metaFileDataObject.SetMetafile(*metaFile);
delete metaFile;
- return TRUE;
+ return true;
}
#endif // wxUSE_METAFILE
}
- return FALSE;
+ return false;
#else // !wxUSE_DATAOBJ
wxFAIL_MSG( wxT("no clipboard implementation") );
- return FALSE;
+ return false;
#endif // wxUSE_OLE_CLIPBOARD/wxUSE_DATAOBJ
}
if (data)
m_colourData = *data;
- return TRUE;
+ return true;
}
int wxColourDialog::ShowModal()
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags))
{
- if ( x != -1 )
+ if ( x != wxDefaultCoord )
m_pos.x = x;
- if ( y != -1 )
+ if ( y != wxDefaultCoord )
m_pos.y = y;
// ignore the size params - we can't change the size of a standard dialog
wxTO_STRING_IMP( wxColour )
wxFROM_STRING_IMP( wxColour )
-
+
IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour ))
wxBEGIN_PROPERTIES_TABLE(wxColour)
wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl,"wx/combobox.h")
wxBEGIN_PROPERTIES_TABLE(wxComboBox)
- wxEVENT_PROPERTY( Select , wxEVT_COMMAND_COMBOBOX_SELECTED , wxCommandEvent )
+ wxEVENT_PROPERTY( Select , wxEVT_COMMAND_COMBOBOX_SELECTED , wxCommandEvent )
wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent )
// TODO DELEGATES
- wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Value ,wxString, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Value ,wxString, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_FLAGS( WindowStyle , wxComboBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
ProcessCommand(event);
}
- return HandleChar(wParam, lParam, TRUE /* isASCII */);
+ return HandleChar(wParam, lParam, true /* isASCII */);
case WM_KEYDOWN:
return HandleKeyDown(wParam, lParam);
return HandleKillFocus((WXHWND)wParam);
}
- return FALSE;
+ return false;
}
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
}
// there is no return value for the CBN_ notifications, so always return
- // FALSE from here to pass the message to DefWindowProc()
- return FALSE;
+ // false from here to pass the message to DefWindowProc()
+ return false;
}
WXHWND wxComboBox::GetEditHWND() const
// pretend that wxComboBox is hidden while it is positioned and resized and
// show it only right before leaving this method because otherwise there is
// some noticeable flicker while the control rearranges itself
- m_isShown = FALSE;
+ m_isShown = false;
if ( !CreateAndInit(parent, id, pos, size, n, choices, style,
validator, name) )
- return FALSE;
+ return false;
// we shouldn't call SetValue() for an empty string because this would
// (correctly) result in an assert with a read only combobox and is useless
}
// and finally, show the control
- Show(TRUE);
+ Show(true);
- return TRUE;
+ return true;
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME);
// Initialize DbgHelp
- if ( SymInitialize(GetCurrentProcess(), NULL, TRUE /* invade */) )
+ if ( ::SymInitialize(GetCurrentProcess(), NULL, TRUE /* invade */) )
{
OutputStack(pCtx, flags);
{
gs_globalCursor = new wxCursor;
- return TRUE;
+ return true;
}
virtual void OnExit()