Fixes and source cleaning for WinCE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-09-08 06:41:06 +00:00
parent c845a1975a
commit 39fc096d5a
11 changed files with 82 additions and 84 deletions

View File

@@ -6,7 +6,7 @@
// Created: 2003-07-12 // Created: 2003-07-12
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPWCE_H_ #ifndef _WX_HELPWCE_H_

View File

@@ -193,10 +193,10 @@ protected:
// replace the contents of the selection or of the entire control with the // replace the contents of the selection or of the entire control with the
// given text // given text
void DoWriteText(const wxString& text, bool selectionOnly = TRUE); void DoWriteText(const wxString& text, bool selectionOnly = true);
// set the selection possibly without scrolling the caret into view // set the selection possibly without scrolling the caret into view
void DoSetSelection(long from, long to, bool scrollCaret = TRUE); void DoSetSelection(long from, long to, bool scrollCaret = true);
// return true if there is a non empty selection in the control // return true if there is a non empty selection in the control
bool HasSelection() const; bool HasSelection() const;
@@ -205,7 +205,7 @@ protected:
// position // position
long GetLengthOfLineContainingPos(long pos) const; long GetLengthOfLineContainingPos(long pos) const;
// send TEXT_UPDATED event, return TRUE if it was handled, FALSE otherwise // send TEXT_UPDATED event, return true if it was handled, false otherwise
bool SendUpdateEvent(); bool SendUpdateEvent();
// override some base class virtuals // override some base class virtuals
@@ -214,7 +214,7 @@ protected:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// if TRUE, SendUpdateEvent() will eat the next event (see comments in the // if true, SendUpdateEvent() will eat the next event (see comments in the
// code as to why this is needed) // code as to why this is needed)
bool m_suppressNextUpdate; bool m_suppressNextUpdate;

View File

@@ -151,8 +151,6 @@ bool wxChoice::CreateAndInit(wxWindow *parent,
wxSize sizeText(size), sizeBtn(size); wxSize sizeText(size), sizeBtn(size);
sizeBtn.x = GetBestSpinerSize(IsVertical(style)).x; sizeBtn.x = GetBestSpinerSize(IsVertical(style)).x;
sizeBtn.x;
if ( sizeText.x == wxDefaultCoord ) if ( sizeText.x == wxDefaultCoord )
{ {
// DEFAULT_ITEM_WIDTH is the default width for the text control // DEFAULT_ITEM_WIDTH is the default width for the text control
@@ -300,7 +298,7 @@ wxChoice::~wxChoice()
int wxChoice::DoAppend(const wxString& item) int wxChoice::DoAppend(const wxString& item)
{ {
int n = (int)SendMessage(GetBuddyHwnd(), LB_ADDSTRING, 0, (LPARAM)item.c_str()); int n = (int)::SendMessage(GetBuddyHwnd(), LB_ADDSTRING, 0, (LPARAM)item.c_str());
if ( n == LB_ERR ) if ( n == LB_ERR )
{ {
@@ -315,7 +313,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice")); wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into choice"));
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index")); wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
int n = (int)SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str()); int n = (int)::SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, pos, (LPARAM)item.c_str());
if ( n == LB_ERR ) if ( n == LB_ERR )
{ {
wxLogLastError(wxT("SendMessage(LB_INSERTSTRING)")); wxLogLastError(wxT("SendMessage(LB_INSERTSTRING)"));
@@ -333,14 +331,14 @@ void wxChoice::Delete(int n)
delete GetClientObject(n); delete GetClientObject(n);
} }
SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0); ::SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0);
} }
void wxChoice::Clear() void wxChoice::Clear()
{ {
Free(); Free();
SendMessage(GetBuddyHwnd(), LB_RESETCONTENT, 0, 0); ::SendMessage(GetBuddyHwnd(), LB_RESETCONTENT, 0, 0);
} }
void wxChoice::Free() void wxChoice::Free()
@@ -361,12 +359,12 @@ void wxChoice::Free()
int wxChoice::GetSelection() const int wxChoice::GetSelection() const
{ {
return (int)SendMessage(GetBuddyHwnd(), LB_GETCURSEL, 0, 0); return (int)::SendMessage(GetBuddyHwnd(), LB_GETCURSEL, 0, 0);
} }
void wxChoice::SetSelection(int n) void wxChoice::SetSelection(int n)
{ {
SendMessage(GetBuddyHwnd(), LB_SETCURSEL, n, 0); ::SendMessage(GetBuddyHwnd(), LB_SETCURSEL, n, 0);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -375,12 +373,12 @@ void wxChoice::SetSelection(int n)
int wxChoice::GetCount() const int wxChoice::GetCount() const
{ {
return (int)SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); return (int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0);
} }
int wxChoice::FindString(const wxString& s) const int wxChoice::FindString(const wxString& s) const
{ {
int pos = (int)SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT, int pos = (int)::SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT,
(WPARAM)-1, (LPARAM)s.c_str()); (WPARAM)-1, (LPARAM)s.c_str());
return pos == LB_ERR ? wxNOT_FOUND : pos; return pos == LB_ERR ? wxNOT_FOUND : pos;
@@ -452,7 +450,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
void* wxChoice::DoGetItemClientData( int n ) const void* wxChoice::DoGetItemClientData( int n ) const
{ {
LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); LPARAM rc = ::SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
if ( rc == LB_ERR ) if ( rc == LB_ERR )
{ {
wxLogLastError(wxT("LB_GETITEMDATA")); wxLogLastError(wxT("LB_GETITEMDATA"));

View File

@@ -6,7 +6,7 @@
// Created: 2003-07-12 // Created: 2003-07-12
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
@@ -87,7 +87,7 @@ bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k),
bool wxWinceHelpController::Quit() bool wxWinceHelpController::Quit()
{ {
return TRUE; return true;
} }
// Append extension if necessary. // Append extension if necessary.
@@ -109,7 +109,7 @@ wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
// View URL // View URL
bool wxWinceHelpController::ViewURL(const wxString& topic) bool wxWinceHelpController::ViewURL(const wxString& topic)
{ {
if (m_helpFile.IsEmpty()) return FALSE; if (m_helpFile.IsEmpty()) return false;
wxString url( wxT("file:") + GetValidFilename(m_helpFile) ); wxString url( wxT("file:") + GetValidFilename(m_helpFile) );
if (!topic.IsEmpty()) if (!topic.IsEmpty())

View File

@@ -87,41 +87,41 @@ void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, w
wxMenu *wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(wxMenu *menu) wxMenu *wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(wxMenu *menu)
{ {
// This is required in case of converting wxMenuBar to wxMenu in wxFrame::SetMenuBar. // This is required in case of converting wxMenuBar to wxMenu in wxFrame::SetMenuBar.
// All submenus has to be recreated because of new owner. // All submenus has to be recreated because of new owner.
wxMenu *duplication = new wxMenu; wxMenu *duplication = new wxMenu;
if (menu) if (menu)
{ {
wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); wxMenuItem *item = node->GetData();
if (item) if (item)
{ {
wxMenu *submenu = NULL; wxMenu *submenu = NULL;
if(item->IsSubMenu()) if(item->IsSubMenu())
submenu = DuplicateMenu( item->GetSubMenu() ); submenu = DuplicateMenu( item->GetSubMenu() );
else else
submenu = NULL; submenu = NULL;
wxMenuItem *new_item = wxMenuItem::New(duplication, item->GetId(), item->GetLabel(), item->GetHelp(), item->GetKind(), submenu); wxMenuItem *new_item = wxMenuItem::New(duplication, item->GetId(), item->GetLabel(), item->GetHelp(), item->GetKind(), submenu);
if( item->IsCheckable() ) if( item->IsCheckable() )
new_item->Check(item->IsChecked()); new_item->Check(item->IsChecked());
new_item->Enable( item->IsEnabled() ); new_item->Enable( item->IsEnabled() );
duplication->Append(new_item); duplication->Append(new_item);
} }
node = node->GetNext(); node = node->GetNext();
} }
} }
return duplication; return duplication;
} }
void wxMenuToHMenu(wxMenu* in, HMENU hMenu) void wxMenuToHMenu(wxMenu* in, HMENU hMenu)
@@ -189,11 +189,11 @@ void wxTopLevelWindowMSW::ReloadButton(ButtonMenu& button, UINT menuID)
button_info.fsState = TBSTATE_ENABLED; button_info.fsState = TBSTATE_ENABLED;
wxStrcpy(buf, button.GetLabel().c_str()); wxStrcpy(buf, button.GetLabel().c_str());
button_info.pszText = buf; button_info.pszText = buf;
SendMessage(m_MenuBarHWND, TB_SETBUTTONINFO, menuID, (LPARAM) &button_info); ::SendMessage(m_MenuBarHWND, TB_SETBUTTONINFO, menuID, (LPARAM) &button_info);
if(button.IsMenu()) if(button.IsMenu())
{ {
HMENU hPopupMenu = (HMENU) SendMessage(m_MenuBarHWND, SHCMBM_GETSUBMENU, 0, menuID); HMENU hPopupMenu = (HMENU) ::SendMessage(m_MenuBarHWND, SHCMBM_GETSUBMENU, 0, menuID);
RemoveMenu(hPopupMenu, 0, MF_BYPOSITION); RemoveMenu(hPopupMenu, 0, MF_BYPOSITION);
wxMenuToHMenu(button.GetMenu(), hPopupMenu); wxMenuToHMenu(button.GetMenu(), hPopupMenu);
} }

View File

@@ -236,7 +236,7 @@ bool wxToolBar::Create(wxWindow *parent,
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
return TRUE; return true;
} }
#ifndef TBSTYLE_NO_DROPDOWN_ARROW #ifndef TBSTYLE_NO_DROPDOWN_ARROW
@@ -284,7 +284,7 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXU
if (menuBar) if (menuBar)
menuBar->Create(); menuBar->Create();
return TRUE; return true;
} }
void wxToolBar::Recreate() void wxToolBar::Recreate()
@@ -437,7 +437,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
// Realize() later // Realize() later
tool->Attach(this); tool->Attach(this);
return TRUE; return true;
} }
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
@@ -510,11 +510,11 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
int x; int x;
wxControl *control = tool2->GetControl(); wxControl *control = tool2->GetControl();
control->GetPosition(&x, NULL); control->GetPosition(&x, NULL);
control->Move(x - width, -1); control->Move(x - width, wxDefaultCoord);
} }
} }
return TRUE; return true;
} }
struct wxToolBarIdMapping struct wxToolBarIdMapping
@@ -554,7 +554,7 @@ static wxToolBarIdMapping sm_ToolBarIdMappingArray[] =
static int wxFindIdForwxWinId(int id) static int wxFindIdForwxWinId(int id)
{ {
int i = 0; int i = 0;
while (TRUE) while (true)
{ {
if (sm_ToolBarIdMappingArray[i].m_wxwinId == 0) if (sm_ToolBarIdMappingArray[i].m_wxwinId == 0)
return -1; return -1;
@@ -572,7 +572,7 @@ bool wxToolBar::Realize()
if ( nTools == 0 ) if ( nTools == 0 )
{ {
// nothing to do // nothing to do
return TRUE; return true;
} }
#if 0 #if 0
@@ -605,7 +605,7 @@ bool wxToolBar::Realize()
{ {
wxToolBarToolBase *tool = node->GetData(); wxToolBarToolBase *tool = node->GetData();
bool processedThis = TRUE; bool processedThis = true;
TBBUTTON& button = buttons[i]; TBBUTTON& button = buttons[i];
@@ -663,10 +663,10 @@ bool wxToolBar::Realize()
// radio items // radio items
button.fsState |= TBSTATE_CHECKED; button.fsState |= TBSTATE_CHECKED;
tool->Toggle(TRUE); tool->Toggle(true);
} }
isRadio = TRUE; isRadio = true;
break; break;
case wxITEM_CHECK: case wxITEM_CHECK:
@@ -723,8 +723,8 @@ bool wxToolBar::Realize()
// note that we use TB_GETITEMRECT and not TB_GETRECT because the // note that we use TB_GETITEMRECT and not TB_GETRECT because the
// latter only appeared in v4.70 of comctl32.dll // latter only appeared in v4.70 of comctl32.dll
RECT r; RECT r;
if ( !SendMessage(GetHwnd(), TB_GETITEMRECT, if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT,
index, (LPARAM)(LPRECT)&r) ) index, (LPARAM)(LPRECT)&r) )
{ {
wxLogLastError(wxT("TB_GETITEMRECT")); wxLogLastError(wxT("TB_GETITEMRECT"));
} }
@@ -756,8 +756,8 @@ bool wxToolBar::Realize()
tbbi.cbSize = sizeof(tbbi); tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_SIZE; tbbi.dwMask = TBIF_SIZE;
tbbi.cx = size.x; tbbi.cx = size.x;
if ( !SendMessage(GetHwnd(), TB_SETBUTTONINFO, if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO,
tool->GetId(), (LPARAM)&tbbi) ) tool->GetId(), (LPARAM)&tbbi) )
{ {
// the id is probably invalid? // the id is probably invalid?
wxLogLastError(wxT("TB_SETBUTTONINFO")); wxLogLastError(wxT("TB_SETBUTTONINFO"));
@@ -780,8 +780,8 @@ bool wxToolBar::Realize()
size_t nSeparators = size.x / widthSep; size_t nSeparators = size.x / widthSep;
for ( size_t nSep = 0; nSep < nSeparators; nSep++ ) for ( size_t nSep = 0; nSep < nSeparators; nSep++ )
{ {
if ( !SendMessage(GetHwnd(), TB_INSERTBUTTON, if ( !::SendMessage(GetHwnd(), TB_INSERTBUTTON,
index, (LPARAM)&tbb) ) index, (LPARAM)&tbb) )
{ {
wxLogLastError(wxT("TB_INSERTBUTTON")); wxLogLastError(wxT("TB_INSERTBUTTON"));
} }
@@ -794,7 +794,7 @@ bool wxToolBar::Realize()
((wxToolBarTool *)tool)->SetSeparatorsCount(nSeparators); ((wxToolBarTool *)tool)->SetSeparatorsCount(nSeparators);
// adjust the controls width to exactly cover the separators // adjust the controls width to exactly cover the separators
control->SetSize((nSeparators + 1)*widthSep, -1); control->SetSize((nSeparators + 1)*widthSep, wxDefaultCoord);
} }
// position the control itself correctly vertically // position the control itself correctly vertically
@@ -803,7 +803,7 @@ bool wxToolBar::Realize()
if ( diff < 0 ) if ( diff < 0 )
{ {
// the control is too high, resize to fit // the control is too high, resize to fit
control->SetSize(-1, height - 2); control->SetSize(wxDefaultCoord, height - 2);
diff = 2; diff = 2;
} }
@@ -893,7 +893,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
} }
} }
return TRUE; return true;
} }
bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl),
@@ -908,11 +908,11 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl),
// in an ANSI application - this seems to be a bug in comctl32.dll v5 // in an ANSI application - this seems to be a bug in comctl32.dll v5
UINT code = hdr->code; UINT code = hdr->code;
if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) ) if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) )
return FALSE; return false;
HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0); HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
if ( toolTipWnd != hdr->hwndFrom ) if ( toolTipWnd != hdr->hwndFrom )
return FALSE; return false;
LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam; LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam;
int id = (int)ttText->hdr.idFrom; int id = (int)ttText->hdr.idFrom;
@@ -1032,7 +1032,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
void wxToolBar::UpdateSize() void wxToolBar::UpdateSize()
{ {
// the toolbar size changed // the toolbar size changed
SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
// we must also refresh the frame after the toolbar size (possibly) changed // we must also refresh the frame after the toolbar size (possibly) changed
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);

View File

@@ -232,7 +232,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
WXDWORD spiner_style = WS_VISIBLE | WXDWORD spiner_style = WS_VISIBLE |
UDS_ALIGNRIGHT | UDS_ALIGNRIGHT |
UDS_EXPANDABLE | UDS_EXPANDABLE |
UDS_NOSCROLL; UDS_NOSCROLL;
if ( !IsVertical(style) ) if ( !IsVertical(style) )
spiner_style |= UDS_HORZ; spiner_style |= UDS_HORZ;
@@ -546,7 +546,7 @@ bool wxTextCtrl::CanPaste() const
void wxTextCtrl::SetEditable(bool editable) void wxTextCtrl::SetEditable(bool editable)
{ {
SendMessage(GetBuddyHwnd(), EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); ::SendMessage(GetBuddyHwnd(), EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
} }
void wxTextCtrl::SetInsertionPoint(long pos) void wxTextCtrl::SetInsertionPoint(long pos)
@@ -740,9 +740,9 @@ wxTextCtrl::HitTest(const wxPoint& pt, long *posOut) const
// double check that we really are where it pretends // double check that we really are where it pretends
POINTL ptReal; POINTL ptReal;
LRESULT lRc = SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0); LRESULT lRc = ::SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0);
if ( lRc == -1 ) if ( lRc == -1 )
{ {
// this is apparently returned when pos corresponds to the last // this is apparently returned when pos corresponds to the last
// position // position
@@ -779,7 +779,7 @@ void wxTextCtrl::ShowPosition(long pos)
int linesToScroll = specifiedLineLineNo - currentLineLineNo; int linesToScroll = specifiedLineLineNo - currentLineLineNo;
if (linesToScroll != 0) if (linesToScroll != 0)
(void)::SendMessage(GetBuddyHwnd(), EM_LINESCROLL, 0, (LPARAM)linesToScroll); (void)::SendMessage(GetBuddyHwnd(), EM_LINESCROLL, 0, (LPARAM)linesToScroll);
} }
long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const