compilation fixes for PalmOS and implementations of missing standard functions (pflib.diff part of patch 1894861)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-03-02 00:53:32 +00:00
parent 9b4da62701
commit 6afc1b4665
37 changed files with 1162 additions and 337 deletions

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/apptrait.h
// Purpose: class implementing wxAppTraits for Palm OS
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -12,6 +12,10 @@
#ifndef _WX_PALM_APPTRAIT_H_
#define _WX_PALM_APPTRAIT_H_
#if wxUSE_TIMER
#include "wx/palmos/private/timer.h" // wxPalmOSTimerImpl
#endif // wxUSE_TIMER
// ----------------------------------------------------------------------------
// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase
// ----------------------------------------------------------------------------

View File

@ -55,6 +55,8 @@ protected:
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox)
// current state of the checkbox
wxCheckBoxState m_state;
};
#endif

View File

@ -2,7 +2,7 @@
* Name: wx/palmos/chkconf.h
* Purpose: Compiler-specific configuration checking
* Author: William Osborne - minimal working wxPalmOS port
* Modified by:
* Modified by: Yunhui Fu
* Created: 10/13/04
* RCS-ID: $Id$
* Copyright: (c) William Osborne
@ -55,7 +55,7 @@
#define wxUSE_DATAOBJ 0
#undef wxUSE_DIRDLG
#define wxUSE_DIRDLG 0
#define wxUSE_DIRDLG 1
#undef wxUSE_DISPLAY
#define wxUSE_DISPLAY 0
@ -82,13 +82,13 @@
#define wxUSE_FFILE 0
#undef wxUSE_FILE
#define wxUSE_FILE 0
#define wxUSE_FILE 1
#undef wxUSE_FILECONFIG
#define wxUSE_FILECONFIG 0
#undef wxUSE_FILEDLG
#define wxUSE_FILEDLG 0
#define wxUSE_FILEDLG 1
#undef wxUSE_FILESYSTEM
#define wxUSE_FILESYSTEM 0
@ -333,5 +333,8 @@
#undef wxUSE_TOOLBOOK
#define wxUSE_TOOLBOOK 0
#undef wxUSE_SELECT_DISPATCHER
#define wxUSE_SELECT_DISPATCHER 1
#endif
/* _WX_PALMOS_CHKCONF_H_ */

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/choice.h
// Purpose: wxChoice class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -77,10 +77,6 @@ public:
virtual wxString GetString(unsigned int n) const;
virtual void SetString(unsigned int n, const wxString& s);
// MSW only
virtual bool MSWCommand(WXUINT param, WXWORD id);
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected:
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual void DoSetItemClientData(unsigned int n, void* clientData);
@ -93,9 +89,6 @@ protected:
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// update the height of the drop down list to fit the number of items we
// have (without changing the visible height)

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/font.h
// Purpose: wxFont class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/14/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -82,6 +82,10 @@ public:
virtual ~wxFont();
// wxFontBase overridden functions
virtual wxString GetNativeFontInfoDesc() const;
virtual wxString GetNativeFontInfoUserDesc() const;
// implement base class pure virtuals
virtual int GetPointSize() const;
virtual wxSize GetPixelSize() const;
@ -127,7 +131,9 @@ protected:
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
void Unshare();
// implement wxObject virtuals which are used by AllocExclusive()
virtual wxGDIRefData *CreateGDIRefData() const;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
DECLARE_DYNAMIC_CLASS(wxFont)

View File

@ -3,7 +3,7 @@
// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor
// under Palm OS
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -170,6 +170,14 @@ protected:
// create the data for the derived class here
virtual wxGDIImageRefData *CreateData() const = 0;
virtual wxGDIRefData *CreateGDIRefData() const { return CreateData(); }
// we can't [efficiently] clone objects of this class
virtual wxGDIRefData *
CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const
{
wxFAIL_MSG( _T("must be implemented if used") );
return NULL;
}
static wxGDIImageHandlerList ms_handlers;
};

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/imaglist.h
// Purpose: wxImageList class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -28,19 +28,6 @@
* used.
*/
// Flags for Draw
#define wxIMAGELIST_DRAW_NORMAL 0x0001
#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
#define wxIMAGELIST_DRAW_SELECTED 0x0004
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
// Flag values for Set/GetImageList
enum {
wxIMAGE_LIST_NORMAL, // Normal icons
wxIMAGE_LIST_SMALL, // Small icons
wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
};
// Eventually we'll make this a reference-counted wxGDIObject. For
// now, the app must take care of ownership issues. That is, the
// image lists must be explicitly deleted after the control(s) that uses them

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/listctrl.h
// Purpose: wxListCtrl class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -376,9 +376,6 @@ protected:
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
// return the icon for the given item. In report view, OnGetItemImage will
// only be called for the first column. See OnGetItemColumnImage for
// details.

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/pen.h
// Purpose: wxPen class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -120,7 +120,12 @@ public:
bool FreeResource(bool force = false);
WXHANDLE GetResourceHandle() const;
bool IsFree() const;
void Unshare();
protected:
virtual wxGDIRefData* CreateGDIRefData() const;
virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
// same as FreeResource() + RealizeResource()
bool Recreate();
private:
DECLARE_DYNAMIC_CLASS(wxPen)

View File

@ -12,7 +12,7 @@
#ifndef _WX_TIMER_H_
#define _WX_TIMER_H_
#include "wx/private/timerimpl.h"
#include "wx/private/timer.h"
class WXDLLEXPORT wxPalmOSTimerImpl : public wxTimerImpl
{

View File

@ -2,7 +2,7 @@
// Name: wx/palmos/textctrl.h
// Purpose: wxTextCtrl class
// Author: William Osborne - minimal working wxPalmOS port
// Modified by:
// Modified by: Yunhui Fu
// Created: 10/13/04
// RCS-ID: $Id$
// Copyright: (c) William Osborne
@ -41,41 +41,73 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
// implement base class pure virtuals
// ----------------------------------
// overridden wxTextEntry methods
// ------------------------------
virtual wxString GetValue() const;
virtual wxString GetRange(long from, long to) const;
virtual bool IsEmpty() const;
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual bool IsModified() const;
virtual bool IsEditable() const;
virtual void GetSelection(long* from, long* to) const;
// operations
// ----------
// editing
virtual void Clear();
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
// load the control's contents from the file
virtual bool DoLoadFile(const wxString& file, int fileType);
// clears the dirty flag
virtual void MarkDirty();
virtual void DiscardEdits();
virtual void SetMaxLength(unsigned long len);
// writing text inserts it at the current position, appending always
// inserts it at the end
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
virtual void GetSelection(long *from, long *to) const;
//
// Operations
// ----------
//
virtual void Clear(void);
virtual void Replace( long lFrom
,long lTo
,const wxString& rsValue
);
virtual void Remove( long lFrom
,long lTo
);
//virtual bool DoLoadFile(const wxString& rsFile, int fileType);
virtual void MarkDirty();
virtual void DiscardEdits(void);
virtual void WriteText(const wxString& rsText);
virtual void AppendText(const wxString& rsText);
virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
virtual void Copy(void);
virtual void Cut(void);
virtual void Paste(void);
virtual bool CanCopy(void) const;
virtual bool CanCut(void) const;
virtual bool CanPaste(void) const;
virtual void Undo(void);
virtual void Redo();
virtual bool CanUndo(void) const;
virtual bool CanRedo(void) const;
virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const;
virtual wxTextPos GetLastPosition(void) const;
virtual void SetSelection( long lFrom
,long lTo
);
virtual void SetEditable(bool bEditable);
virtual void SetWindowStyleFlag(long lStyle);
// implement base class pure virtuals
// ----------------------------------
virtual bool IsModified() const;
virtual bool IsEditable(void) const;
#if wxUSE_RICHEDIT
// apply text attribute to the range of text (only works with richedit
@ -92,48 +124,28 @@ public:
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const;
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
// Undo/redo
virtual void Undo();
virtual void Redo();
virtual bool CanUndo() const;
virtual bool CanRedo() const;
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
wxTextCoord *row) const
{
return wxTextCtrlBase::HitTest(pt, col, row);
}
// Caret handling (Windows only)
bool ShowNativeCaret(bool show = true);
bool HideNativeCaret() { return ShowNativeCaret(false); }
// Implementation from now on
// --------------------------
#if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT
virtual void SetDropTarget(wxDropTarget *dropTarget);
#endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT
virtual void Command(wxCommandEvent& event);
virtual bool MSWCommand(WXUINT param, WXWORD id);
#if wxUSE_RICHEDIT
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
int GetRichVersion() const { return m_verRichEdit; }
bool IsRich() const { return m_verRichEdit != 0; }
@ -142,9 +154,22 @@ public:
// the colours for them otherwise
virtual bool SetBackgroundColour(const wxColour& colour);
virtual bool SetForegroundColour(const wxColour& colour);
#else
bool IsRich() const { return false; }
#endif // wxUSE_RICHEDIT
virtual bool AcceptsFocus() const;
#if wxUSE_INKEDIT && wxUSE_RICHEDIT
bool IsInkEdit() const { return m_isInkEdit != 0; }
#else
bool IsInkEdit() const { return false; }
#endif
virtual void AdoptAttributesFromHWND();
virtual bool AcceptsFocusFromKeyboard() const;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const;
// callbacks
void OnDropFiles(wxDropFilesEvent& event);
@ -168,21 +193,34 @@ public:
// Show a context menu for Rich Edit controls (the standard
// EDIT control has one already)
void OnRightClick(wxMouseEvent& event);
void OnContextMenu(wxContextMenuEvent& event);
// be sure the caret remains invisible if the user
// called HideNativeCaret() before
void OnSetFocus(wxFocusEvent& event);
virtual wxVisualAttributes GetDefaultAttributes() const;
protected:
// common part of all ctors
void Init();
virtual void DoSetValue(const wxString& value, int flags = 0);
virtual bool DoLoadFile(const wxString& file, int fileType);
// creates the control of appropriate class (plain or rich edit) with the
// styles corresponding to m_windowStyle
//
// this is used by ctor/Create() and when we need to recreate the control
// later
bool MSWCreateText(const wxString& value,
const wxPoint& pos,
const wxSize& size);
// intercept WM_GETDLGCODE
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual void DoSetValue(const wxString &value, int flags = 0);
// return true if this control has a user-set limit on amount of text (i.e.
// the limit is due to a previous call to SetMaxLength() and not built in)
bool HasSpaceLimit(unsigned int *len) const;
// call this to increase the size limit (will do nothing if the current
// limit is big enough)
@ -202,13 +240,11 @@ protected:
// replace the contents of the selection or of the entire control with the
// given text
void DoWriteText(const wxString& text, bool selectionOnly = true);
void DoWriteText(const wxString& text,
int flags = SetValue_SendEvent | SetValue_SelectionOnly);
// set the selection possibly without scrolling the caret into view
void DoSetSelection(long from, long to, bool scrollCaret = true);
// return true if there is a non empty selection in the control
bool HasSelection() const;
// set the selection (possibly without scrolling the caret into view)
void DoSetSelection(long from, long to, int flags);
// get the length of the line containing the character at the given
// position
@ -217,12 +253,8 @@ protected:
// send TEXT_UPDATED event, return true if it was handled, false otherwise
bool SendUpdateEvent();
// override some base class virtuals
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
#if wxUSE_RICHEDIT
// we're using RICHEDIT (and not simple EDIT) control if this field is not
// 0, it also gives the version of the RICHEDIT control being used (1, 2 or
@ -230,17 +262,31 @@ protected:
int m_verRichEdit;
#endif // wxUSE_RICHEDIT
// if true, SendUpdateEvent() will eat the next event (see comments in the
// code as to why this is needed)
bool m_suppressNextUpdate;
// number of EN_UPDATE events sent by Windows when we change the controls
// text ourselves: we want this to be exactly 1
int m_updatesCount;
private:
virtual void EnableTextChangedEvents(bool enable)
{
m_updatesCount = enable ? -1 : -2;
}
// implement wxTextEntry pure virtual: it implements all the operations for
// the simple EDIT controls
virtual WXHWND GetEditHWND() const { return m_hWnd; }
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl)
wxMenu* m_privateContextMenu;
bool m_isNativeCaretShown;
#if wxUSE_INKEDIT && wxUSE_RICHEDIT
int m_isInkEdit;
#endif
};
#endif

View File

@ -25,8 +25,6 @@
#include "wx/dcmemory.h"
#endif
#include "wx/palmos/private.h"
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------

View File

@ -201,7 +201,9 @@ wxWindow *wxButton::SetDefault()
FormType* form = (FormType* )GetParentForm();
if(form==NULL)
return NULL;
#ifdef __WXPALMOS6__
FrmSetDefaultButtonID(form,GetId());
#endif // __WXPALMOS6__
return wxButtonBase::SetDefault();
}

View File

@ -108,6 +108,7 @@ bool wxCheckBox::Create(wxWindow *parent,
if(!wxControl::Create(parent, id, pos, size, style, validator, name))
return false;
m_state = wxCHK_UNCHECKED;
return wxControl::PalmCreateControl(checkboxCtl, label, pos, size);
}
@ -136,15 +137,41 @@ bool wxCheckBox::SendClickEvent()
void wxCheckBox::Command(wxCommandEvent& event)
{
int state = event.GetInt();
wxCHECK_RET( (state == wxCHK_UNCHECKED) || (state == wxCHK_CHECKED)
|| (state == wxCHK_UNDETERMINED),
wxT("event.GetInt() returned an invalid checkbox state") );
Set3StateValue((wxCheckBoxState) state);
ProcessCommand(event);
}
void wxCheckBox::DoSet3StateValue(wxCheckBoxState state)
{
Int16 newValue;
ControlType *control = (ControlType *)GetObjectPtr();
if(NULL == control) {
return;
}
m_state = state;
switch (state) {
case wxCHK_UNCHECKED:
newValue = 0;
break;
case wxCHK_CHECKED:
newValue = 1;
break;
case wxCHK_UNDETERMINED:
default:
return;
break;
}
CtlSetValue (control, newValue);
}
wxCheckBoxState wxCheckBox::DoGet3StateValue() const
{
return (wxCheckBoxState) 0;
return m_state;
}
#endif // wxUSE_CHECKBOX

View File

@ -34,8 +34,6 @@
#include "wx/settings.h"
#endif
#include "wx/palmos/private.h"
#if wxUSE_EXTENDED_RTTI
WX_DEFINE_FLAGS( wxChoiceStyle )
@ -132,16 +130,6 @@ bool wxChoice::Create(wxWindow *parent,
return false;
}
bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg)
{
return false;
}
WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const
{
return 0;
}
wxChoice::~wxChoice()
{
}
@ -241,14 +229,4 @@ wxSize wxChoice::DoGetBestSize() const
return wxSize(0,0);
}
WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
return 0;
}
bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
return false;
}
#endif // wxUSE_CHOICE

View File

@ -45,7 +45,11 @@
#include <Control.h>
#include <Form.h>
#include <StatusBar.h>
#ifdef __WXPALMOS6__
#include <StatusBar.h>
#else
#include <PenInputMgr.h>
#endif // __WXPALMOS6__
// ----------------------------------------------------------------------------
// wxWin macros

View File

@ -181,8 +181,7 @@ void wxDialog::Raise()
// show dialog modally
int wxDialog::ShowModal()
{
if (show && CanDoLayoutAdaptation())
DoLayoutAdaptation();
Show (true);
if (errNone == FrmDoDialog ((FormType *)wxTopLevelWindow::GetForm())) {
return 0;

View File

@ -32,6 +32,8 @@
#include "wx/dir.h"
#include "wx/filefn.h" // for wxDirExists()
#include "pfall.h"
// ----------------------------------------------------------------------------
// define the types and functions used for file searching
// ----------------------------------------------------------------------------
@ -54,10 +56,148 @@
// private classes
// ----------------------------------------------------------------------------
// this class stores everything we need to enumerate the files
class wxDirData
{
public:
wxDirData(const wxString& dirname);
~wxDirData();
bool IsOk() const { return m_dir != NULL; }
void SetFileSpec(const wxString& filespec) { m_filespec = filespec; }
void SetFlags(int flags) { m_flags = flags; }
void Close();
bool Read(wxString *filename);
const wxString& GetName() const { return m_dirname; }
private:
void *m_dir;
wxString m_dirname;
wxString m_filespec;
int m_flags;
};
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxDirData
// ----------------------------------------------------------------------------
wxDirData::wxDirData(const wxString& dirname)
: m_dirname(dirname)
{
m_dir = NULL;
// throw away the trailing slashes
size_t n = m_dirname.length();
wxCHECK_RET( n, _T("empty dir name in wxDir") );
while ( n > 0 && m_dirname[--n] == '/' )
;
m_dirname.Truncate(n + 1);
// do open the dir
//m_dir = opendir(m_dirname.fn_str());
}
wxDirData::~wxDirData()
{
Close ();
}
void wxDirData::Close()
{
if ( m_dir )
{
if ( svfs_dir_endfind (m_dir) != 0 )
{
wxLogLastError(_T("svfs_dir_endfind"));
}
m_dir = NULL;
}
}
bool wxDirData::Read(wxString *filename)
{
//dirent *de = (dirent *)NULL; // just to silence compiler warnings
int ret;
char tmpbuf[300];
bool matches = false;
size_t flags_search;
// speed up string concatenation in the loop a bit
wxString path = m_dirname;
path += _T('/');
path.reserve(path.length() + 255);
wxString de_d_name;
de_d_name.reserve(500);
flags_search = 0;
if (wxDIR_DIRS & m_flags) {
flags_search |= SDIR_DIRS;
}
if (wxDIR_FILES & m_flags) {
flags_search |= SDIR_FILES;
}
if (NULL == m_dir) {
#ifdef _PACC_VER
// walk around the PalmOS pacc compiler bug
ret = svfs_dir_findfirst (m_dirname.fn_str().data(), &m_dir, tmpbuf, sizeof (tmpbuf), flags_search);
#else
ret = svfs_dir_findfirst (m_dirname.fn_str(), &m_dir, tmpbuf, sizeof (tmpbuf), flags_search);
#endif
} else {
ret = svfs_dir_findnext (m_dir, tmpbuf, sizeof (tmpbuf));
}
for (; ret > 0; ) {
#if wxUSE_UNICODE
de_d_name = wxString(tmpbuf, *wxConvFileName);
#else
de_d_name = tmpbuf;
#endif
// don't return "." and ".." unless asked for
if ( tmpbuf[0] == '.' &&
((tmpbuf[1] == '.' && tmpbuf[2] == '\0') ||
(tmpbuf[1] == '\0')) )
{
if ( !(m_flags & wxDIR_DOTDOT) )
continue;
// we found a valid match
break;
}
// check the name
if ( m_filespec.empty() )
{
matches = m_flags & wxDIR_HIDDEN ? true : tmpbuf[0] != '.';
}
else
{
// test against the pattern
matches = wxMatchWild(m_filespec, de_d_name,
!(m_flags & wxDIR_HIDDEN));
}
if (matches)
break;
ret = svfs_dir_findnext (m_dir, tmpbuf, sizeof (tmpbuf));
}
*filename = de_d_name;
return true;
}
// ----------------------------------------------------------------------------
// wxDir helpers
// ----------------------------------------------------------------------------
@ -65,7 +205,7 @@
/* static */
bool wxDir::Exists(const wxString& dir)
{
return false;
return wxDirExists(dir);
}
// ----------------------------------------------------------------------------
@ -74,27 +214,42 @@ bool wxDir::Exists(const wxString& dir)
wxDir::wxDir(const wxString& dirname)
{
m_data = NULL;
(void)Open(dirname);
}
bool wxDir::Open(const wxString& dirname)
{
return false;
delete M_DIR;
m_data = new wxDirData(dirname);
return true;
}
bool wxDir::IsOpened() const
{
return false;
return m_data != NULL;
}
wxString wxDir::GetName() const
{
wxString name;
if ( m_data )
{
name = M_DIR->GetName();
if ( !name.empty() && (name.Last() == _T('/')) )
{
// chop off the last (back)slash
name.Truncate(name.length() - 1);
}
}
return name;
}
wxDir::~wxDir()
{
delete M_DIR;
}
// ----------------------------------------------------------------------------
@ -105,11 +260,17 @@ bool wxDir::GetFirst(wxString *filename,
const wxString& filespec,
int flags) const
{
return false;
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
M_DIR->Close();
M_DIR->SetFileSpec(filespec);
M_DIR->SetFlags(flags);
return GetNext(filename);
}
bool wxDir::GetNext(wxString *filename) const
{
return false;
wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") );
wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") );
return M_DIR->Read(filename);
}

View File

@ -38,8 +38,6 @@
#include "wx/math.h"
#endif
#include "wx/palmos/private.h"
#include <stdlib.h>
#include <string.h>

View File

@ -398,6 +398,15 @@ wxFont::~wxFont()
// ----------------------------------------------------------------------------
// real implementation
// ----------------------------------------------------------------------------
wxGDIRefData *wxFont::CreateGDIRefData() const
{
return new wxFontRefData();
}
wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxFontRefData(*wx_static_cast(const wxFontRefData *, data));
}
bool wxFont::RealizeResource()
{
@ -419,10 +428,6 @@ bool wxFont::IsFree() const
return false;
}
void wxFont::Unshare()
{
}
// ----------------------------------------------------------------------------
// change font attribute: we recreate font when doing it
// ----------------------------------------------------------------------------
@ -518,6 +523,24 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
return NULL;
}
wxString wxFont::GetNativeFontInfoDesc() const
{
wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
// be sure we have an HFONT associated...
wxConstCast(this, wxFont)->RealizeResource();
return wxFontBase::GetNativeFontInfoDesc();
}
wxString wxFont::GetNativeFontInfoUserDesc() const
{
wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
// be sure we have an HFONT associated...
wxConstCast(this, wxFont)->RealizeResource();
return wxFontBase::GetNativeFontInfoUserDesc();
}
bool wxFont::IsFixedWidth() const
{
return false;

View File

@ -23,12 +23,6 @@
#include "wx/filefn.h"
#include <time.h>
#include "wx/palmos/private.h"
#include <string.h>
IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase)

View File

@ -34,9 +34,7 @@
#include "wx/log.h"
#endif
#include "wx/palmos/imaglist.h"
#include "wx/palmos/private.h"
#include "wx/imaglist.h"
// ----------------------------------------------------------------------------
// wxWin macros
@ -91,7 +89,7 @@ bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const
// ----------------------------------------------------------------------------
int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask)
{
return 0;
}

View File

@ -43,18 +43,11 @@
int wxEntry()
{
/* There is no command line in PalmOS. For now generate a fake arument
/* There is no command line in PalmOS. For now generate a fake argument
* list. Later this may be changed to reflect the application launch code
*/
wxArrayString args;
int argc = args.GetCount();
// +1 here for the terminating NULL
static const int argc = 0;
wxChar **argv = new wxChar *[argc + 1];
for ( int i = 0; i < argc; i++ )
{
//argv[i] = wxStrdup(args[i]);
argv[i] = wxStrdup(wxConvLibc.cMB2WX(args[i]));
}
// argv[] must be NULL-terminated
argv[argc] = NULL;

View File

@ -39,7 +39,12 @@
#include "wx/ownerdrw.h"
#endif
#ifdef __WXPALMOS6__
#include <Loader.h>
#else // __WXPALMOS5__
#include <UIResources.h> // MenuRscType
#endif
#include <Form.h>
#include <Menu.h>
@ -537,12 +542,13 @@ void wxMenuBar::LoadMenu()
{
int i=0;
int j=0;
#ifdef __WXPALMOS6__
// Handle to the currently running application database
DmOpenRef AppDB;
// Get app database reference - needed for some Palm OS Menu API calls.
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
#endif // __WXPALMOS6__
// Get the number of menus
int NumMenus=GetMenuCount();
@ -554,24 +560,24 @@ void wxMenuBar::LoadMenu()
// Load the menu template and set up the menu pointers
if(NumMenus==1)
{
PalmOSMenuBar=DmGetResource(AppDB,'MBAR',1000);
PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 1000);
PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
PalmOSMenuBarPtr+=74;
PalmOSMenuBarPtr += 74;
}
else if(NumMenus==2)
{
PalmOSMenuBar=DmGetResource(AppDB,'MBAR',2000);
PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 2000);
PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
PalmOSMenuBarPtr+=116;
PalmOSMenuBarPtr += 116;
}
else if(NumMenus==3)
{
PalmOSMenuBar=DmGetResource(AppDB,'MBAR',3000);
PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 3000);
PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
PalmOSMenuBarPtr+=158;
PalmOSMenuBarPtr += 158;
}
else
{
@ -579,10 +585,10 @@ void wxMenuBar::LoadMenu()
// more than we can handle.
NumMenus=4;
PalmOSMenuBar=DmGetResource(AppDB,'MBAR',4000);
PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 4000);
PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
PalmOSMenuBarPtr+=200;
PalmOSMenuBarPtr += 200;
}
// Set the proper names for the drop-down triggers.
@ -595,11 +601,11 @@ void wxMenuBar::LoadMenu()
wxString MenuTitle=m_titles.Item(i);
// Make sure we don't copy more than 8 bytes for the label
int LengthToCopy=MenuTitle.length();
if(LengthToCopy>8)
LengthToCopy=8;
int LengthToCopy = MenuTitle.length();
if(LengthToCopy > 8)
LengthToCopy = 8;
MemMove(PalmOSMenuBarPtr,MenuTitle,LengthToCopy);
MemMove(PalmOSMenuBarPtr,(char*)(&MenuTitle),LengthToCopy);
PalmOSMenuBarPtr+=11;
}
@ -609,7 +615,7 @@ void wxMenuBar::LoadMenu()
// We must make the menu active before we can add items to the drop-down
// triggers.
FrmSetMenu(FrmGetActiveForm(),AppDB,NumMenus*1000);
POS_FrmSetMenu (FrmGetActiveForm(), AppDB, NumMenus * 1000);
/* Add the menu items to the drop-down triggers. This must be done after
* setting the triggers, because setting the names of drop-down triggers
@ -637,9 +643,9 @@ void wxMenuBar::LoadMenu()
else
{
if(j==0)
MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,ItemLabel);
MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,(char *)(&ItemLabel));
else
MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,ItemLabel);
MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,(char *)(&ItemLabel));
}
}

View File

@ -23,7 +23,12 @@
#include "wx/msgdlg.h"
#endif
#ifdef __WXPALMOS6__
#include <Loader.h>
#else // __WXPALMOS5__
#include <UIResources.h> // alertRscType
#endif
#include <Form.h>
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
@ -35,9 +40,11 @@ int wxMessageDialog::ShowModal()
int wxResult=wxID_OK;
const long style = GetMessageDialogStyle();
#ifdef __WXPALMOS6__
// Handle to the currently running application database
DmOpenRef AppDB;
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
#endif // __WXPALMOS6__
// Translate wx styles into Palm OS styles
if (style & wxYES_NO)
@ -71,7 +78,7 @@ int wxMessageDialog::ShowModal()
// Get the alert resource
char *AlertPtr;
MemHandle AlertHandle;
AlertHandle=DmGetResource(AppDB,'Talt',AlertID);
AlertHandle = POS_DmGetResource (AppDB, alertRscType, AlertID);
AlertPtr=(char *)MemHandleLock(AlertHandle);
AlertPtr+=8;
@ -99,7 +106,7 @@ int wxMessageDialog::ShowModal()
DmReleaseResource(AlertHandle);
// Display the dialog
Result=FrmCustomAlert(AppDB,AlertID,GetFullMessage().c_str(),"","");
Result = POS_FrmCustomAlert (AppDB, AlertID, m_message.c_str(), "", "");
// Convert the Palm OS result to wxResult
if(AlertID<1100)

View File

@ -80,10 +80,6 @@ bool wxPen::IsFree() const
return false;
}
void wxPen::Unshare()
{
}
void wxPen::SetColour(const wxColour& col)
{
}
@ -115,3 +111,14 @@ void wxPen::SetJoin(int Join)
void wxPen::SetCap(int Cap)
{
}
wxGDIRefData *wxPen::CreateGDIRefData() const
{
return new wxPenRefData();
}
wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxPenRefData(*wx_static_cast(const wxPenRefData *, data));
}

View File

@ -111,7 +111,9 @@ Boolean wxProgressDialog::Callback(void *data)
PrgCallbackData *palmData = (PrgCallbackData *)data;
strncpy( palmData->textP, m_msg.ToAscii() , palmData->textLen - 1 );
palmData->textChanged = true;
#ifdef __WXPALMOS6__
palmData->displaySkipBtn = m_canSkip;
#endif // __WXPALMOS6__
palmData->barMaxValue = (uint32_t)m_max;
palmData->barCurValue = (uint32_t)m_cur;
palmData->delay = (m_max == m_cur);

View File

@ -135,6 +135,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
AdjustForParentClientOrigin(x, y);
#ifdef __WXPALMOS6__
SliderControlType *slider = CtlNewSliderControl (
(void **)&form,
GetId(),
@ -151,6 +152,17 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
1,
value
);
#else // __WXPALMOS5__
//SliderControlType *CtlNewSliderControl (void **formPP, UInt16 ID, ControlStyleType style, DmResID thumbID,
// DmResID backgroundID, Coord x, Coord y, Coord width, Coord height, UInt16 minValue, UInt16 maxValue,
// UInt16 pageSize, UInt16 value);
SliderControlType *slider = CtlNewSliderControl ((void **)&form,
GetId(),
feedbackSliderCtl,//style
0,//thumbID
0,//backgroundid
x, y, w, h, minValue, maxValue, 1, value);
#endif // __WXPALMOS6__/__WXPALMOS5__
if(slider==NULL)
return false;

View File

@ -28,7 +28,11 @@
#include "wx/log.h"
#endif
#include <StatusBar.h>
#ifdef __WXPALMOS6__
#include <StatusBar.h>
#else
#include <PenInputMgr.h>
#endif // __WXPALMOS6__
// ----------------------------------------------------------------------------
// macros

View File

@ -1,15 +1,31 @@
/******************************************************************************
* Name: src/palmos/stdall.c
* Purpose: the missing functions of Palm OS for wxPalm
* Author: Yunhui Fu
* Created: 2007-10-18
* Modified by:
* RCS-ID: $Id$
* Copyright: (c) 2007 Yunhui Fu
* Licence: wxWindows licence
******************************************************************************/
#include <Preferences.h> // Core/System/
#include <DateTime.h> //Core/System/, DateToAscii() etc.
#include <TimeMgr.h> //Core/System/, TimGetTicks()
#include "wx/defs.h"
#define PALMOS_TRACE(msg) ErrFatalErrorInContext(__FILE__, __LINE__, msg)
#if __WXPALMOS6__
#ifdef TARGET_PLATFORM
#if TARGET_PLATFORM != TARGET_PLATFORM_PALMSIM_WIN32
void
exit (int exitno)
{
}
#endif
#endif
#else
@ -150,7 +166,7 @@ strftime (char *buf, size_t sz_buf, const char *fmt, const struct tm *ptm)
if (*p == '\0') {
break;
}
// FIXME: Åжϻº³åÊÇ·ñÒç³ö
// FIXME: test the overflow of the buffer
switch (*p) {
case 'a':
strcpy (pret, g_strftime_wdayconv[ptm->tm_wday % 7][SFCONV_ABBR]);
@ -336,25 +352,516 @@ wint_t towlower(wint_t C) {return 0;}
wint_t towupper(wint_t C) {return 0;}
size_t wcsftime(wchar_t *strDest, size_t maxsize, const wchar_t *format, const struct tm *timeptr) {return 0;}
size_t wcslen (const wchar_t * str) {return 0;}
wchar_t * wcscpy (wchar_t * dst, const wchar_t * src) {return NULL;}
wchar_t * wcsncpy (wchar_t * dst, const wchar_t * src, size_t n) {return NULL;}
wchar_t * wcscat (wchar_t * dst, const wchar_t * src) {return NULL;}
wchar_t * wcsncat (wchar_t * dst, const wchar_t * src, size_t n) {return NULL;}
int wcscmp (const wchar_t * str1, const wchar_t * str2) {return 0;}
int wcsncmp (const wchar_t * str1, const wchar_t * str2, size_t n) {return 0;}
wchar_t * wcschr (const wchar_t * str, const wchar_t chr) {return NULL;}
int wcscoll (const wchar_t *str1, const wchar_t * str2) {return 0;}
size_t wcsxfrm (wchar_t * str1, const wchar_t * str2, size_t n) {return 0;}
wchar_t * wcsrchr (const wchar_t * str, wchar_t chr) {return NULL;}
wchar_t * wcspbrk (const wchar_t * str, const wchar_t * set) {return NULL;}
size_t wcsspn (const wchar_t * str, const wchar_t * set) {return 0;}
size_t wcscspn (const wchar_t * str, const wchar_t * set) {return 0;}
wchar_t * wcsstr (const wchar_t * str, const wchar_t * pat) {return NULL;}
wchar_t * wcstok (wchar_t * str, const wchar_t * set, wchar_t ** a) {return NULL;}
size_t
wcslen (const wchar_t * str)
{
size_t i;
for (i = 0; str[i] != 0; i ++);
return i;
}
unsigned long wcstoul (const wchar_t * a, wchar_t ** b, int c) {return 0;}
double wcstod (const wchar_t * a, wchar_t ** b) {return 0.0;}
wchar_t *
wcscpy (wchar_t * dst, const wchar_t * src)
{
size_t len;
len = wcslen (src);
if (len < 1) {
return NULL;
}
memmove (dst, src, len * sizeof (wchar_t));
dst[len] = 0;
return dst;
}
wchar_t *
wcsncpy (wchar_t * dst, const wchar_t * src, size_t len_max)
{
size_t len;
len = wcslen (src);
if (len < 1) {
return NULL;
}
if (len_max < len + 1) {
len = len_max - 1;
}
if (len > 0) {
memmove (dst, src, len * sizeof (wchar_t));
}
dst[len] = 0;
return dst;
}
wchar_t *
wcscat (wchar_t * dst, const wchar_t * src)
{
size_t len_dst;
len_dst = wcslen (dst);
return wcscpy (dst + len_dst, src);
}
wchar_t *
wcsncat (wchar_t * dst, const wchar_t * src, size_t n)
{
size_t len_dst;
len_dst = wcslen (dst);
return wcsncpy (dst + len_dst, src, n);
}
#define SYS_IS_BIGENDIAN 0
#if SYS_IS_BIGENDIAN
#define _wcmcmp(a,b,len) memcmp((a),(b),(len) * sizeof (wchar_t))
#else // SYS_IS_BIGENDIAN
int
_wcmcmp (const wchar_t * str1, const wchar_t * str2, size_t len)
{
size_t i;
for (i = 0; i < len; i ++) {
if (str1[i] == str2[i]) {
continue;
} else if (str1[i] < str2[i]) {
return -1;
}
return 1;
}
return 0;
}
#endif // SYS_IS_BIGENDIAN
int
wcscmp (const wchar_t * str1, const wchar_t * str2)
{
int ret;
size_t len;
size_t len1;
size_t len2;
len1 = wcslen (str1);
len2 = wcslen (str2);
len = len1;
if (len > len2) {
len = len2;
}
ret = _wcmcmp (str1, str2, len);
if (0 == ret) {
if (len1 > len2) {
return -1;
} else if (len1 == len2) {
return 0;
}
return 1;
}
return ret;
}
int
wcsncmp (const wchar_t * str1, const wchar_t * str2, size_t n)
{
int ret;
size_t len;
size_t len1;
size_t len2;
len1 = wcslen (str1);
len2 = wcslen (str2);
len = len1;
if (len > len2) {
len = len2;
}
if (len > n) {
len = n;
}
ret = _wcmcmp (str1, str2, len);
if (0 == ret) {
if (len >= n) {
return 0;
}
if (len1 > len2) {
return -1;
} else if (len1 == len2) {
return 0;
}
return 1;
}
return ret;
}
wchar_t *
wcschr (const wchar_t * str, const wchar_t chr)
{
wchar_t * str2 = (wchar_t *)str;
size_t i;
size_t len;
len = wcslen (str2);
for (i = 0; i < len; i ++) {
if (str2[i] == chr) {
str2 += i;
return str2;
}
}
return NULL;
}
int wcscoll (const wchar_t *str1, const wchar_t * str2) {return wcscmp(str1, str2);}
//wcsxfrm: ¸ù¾Ýָ֨µĵØÓòÉèÖã̰Ñ×ַûԮstrSourceÖÐָ֨ÊýÁߵĿí×ַûתۻΪ
// ×ַûԮstrDest ,Èô³ɹ¦Ô򷵻ر»תۻ×ַûµijĶȣ̷ñÔ򷵻Ø-1
// ºÍstrxfrmگÊýÀàËÆ
size_t
wcsxfrm (wchar_t * str1, const wchar_t * str2, size_t n)
{
wcsncpy (str1, str2, n);
return wcslen (str1);
}
wchar_t *
wcsrchr (const wchar_t * str, wchar_t chr)
{
wchar_t * str2 = (wchar_t *)str;
ssize_t i;
i = wcslen (str2);
for (; i >= 0; i ++) {
if (str2[i] == chr) {
str2 += i;
return str2;
}
}
return NULL;
}
wchar_t *
wcspbrk (const wchar_t * str, const wchar_t * set)
{
wchar_t * str2 = (wchar_t *)str;
size_t i;
size_t j;
size_t len;
size_t len_set;
len = wcslen (str2);
len_set = wcslen (set);
for (i = 0; i < len; i ++) {
for (j = 0; j < len_set; j ++) {
if (str2[i] == set[j]) {
str2 += i;
return str2;
}
}
}
return NULL;
}
// ²éÕÒÔڼϺÏsetËùָ֨µÄÄÇЩ×ַûÔÚstrµĿªʼԦ³öÏֵÄ×î´ó¸öÊý
// Èçstr="13134abcde", set="1234567890", wcsspn(str,set)==5
// Èçstr="abcde", set="1234567890", wcsspn(str,set)==0
size_t
wcsspn (const wchar_t * str, const wchar_t * set)
{
size_t i;
size_t j;
size_t len;
size_t len_set;
len = wcslen (str);
len_set = wcslen (set);
for (i = 0; i < len; i ++) {
for (j = 0; j < len_set; j ++) {
if (str[i] == set[j]) {
break;
}
}
if (j >= len_set) {
return i;
}
}
return i;
}
// ²éÕÒÔڼϺÏsetËùָ֨µÄÄÇЩ×ַûÔÚstrµĿªʼԦһ³öÏֵÄ×î´ó¸öÊý
// Èçstr="13134abcde", set="1234567890", wcsspn(str,set)==0
// Èçstr="abcde123", set="1234567890", wcsspn(str,set)==5
size_t
wcscspn (const wchar_t * str, const wchar_t * set)
{
size_t i;
size_t j;
size_t len;
size_t len_set;
len = wcslen (str);
len_set = wcslen (set);
for (i = 0; i < len; i ++) {
for (j = 0; j < len_set; j ++) {
if (str[i] == set[j]) {
break;
}
}
if (j < len_set) {
return i;
}
}
return i;
}
wchar_t *
wcsstr (const wchar_t * str, const wchar_t * pat)
{
// TODO: improvement the alg for search
wchar_t *p;
p = wcschr (str, pat[0]);
for (; NULL != p;) {
if (0 == wcscmp (p, pat)) {
return p;
}
p = wcschr (p, pat[0]);
}
return NULL;
}
wchar_t *
wcstok (wchar_t * str, const wchar_t * set, wchar_t ** a)
{
wchar_t * p;
if (NULL == str) {
if (NULL == a) {
return NULL;
}
str = *a;
}
if (NULL == str) {
return NULL;
}
p = wcspbrk (str, set);
if (NULL == p) {
return NULL;
}
*p = 0;
*a = p;
return str;
}
#define iswblank iswspace
//#define ULONG_MAX INT_MAX
unsigned long
wcstoul (const wchar_t *nptr, wchar_t **endptr, int base)
{
int flg_overflow;
//int val_remain;
unsigned long val_ch;
unsigned long val_old;
unsigned long val;
/* check the base */
if ((1 == base) || (base > 36) || (base < 0)) {
// error
return 0;
}
// skip blank
while (iswblank (*nptr)) {nptr ++;}
if (0 == *nptr) {
return 0;
}
if (0 == base) {
// auto detect
switch (*nptr) {
case '0':
if (('x' == *(nptr + 1)) || ('X' == *(nptr + 1))) {
base = 16;
nptr += 2;
} else {
nptr += 1;
base = 8;
}
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
base = 10;
break;
}
} else {
if (16 == base) {
// detect if it has '0x' or '0X'
if (('0' == *nptr) && (('x' == *(nptr + 1)) || ('x' == *(nptr + 1)))) {
nptr += 2;
}
}
}
if (0 == base) {
// error
return 0;
}
val = 0;
val_old = 0;
flg_overflow = 0;
//val_remain = ULONG_MAX % base;
for (; '\0' != *nptr; nptr ++) {
val_ch = *nptr;
if (('0' <= val_ch) && (val_ch <= '9')) {
val_ch -= '0';
} else if (('a' <= val_ch) && (val_ch <= 'z')) {
val_ch = val_ch - 'a' + 10;
} else if (('A' <= val_ch) && (val_ch <= 'Z')) {
val_ch = val_ch - 'A' + 10;
} else {
// val_ch = base + 1;
break;
}
if (val_ch >= base) {
break;
}
if (flg_overflow) continue;
val_old = val;
val *= base;
val += val_ch;
if (val_old > val) {
flg_overflow = 1;
}
}
if (flg_overflow) {
val = ULONG_MAX;
}
if (0L != endptr) {
*endptr = (wchar_t *)nptr;
}
return val;
}
long
wcstol (const wchar_t * str, wchar_t ** end, int base)
{
int sign = 0;
unsigned long val0;
long val;
wchar_t ch;
// skip blank
for (; iswblank (*str); str ++) {
}
for (ch = *str; (ch == '-') || (ch == '+'); str ++) {
}
// the sign
if ('-' == ch) {
sign = 1;
str ++;
}
val0 = wcstoul (str, end, base);
if (val0 >= LONG_MAX) {
// overflow
val = LONG_MAX;
if (sign) {
val = LONG_MIN;
}
} else {
val = val0;
if (sign) {
val = -val0;
}
}
return val;
}
double
wcstod (const wchar_t * str, wchar_t ** end)
{
double val;
double mantissa;
unsigned long divisor;
unsigned long power;
int sign;
int sign_power;
wchar_t *pend;
wchar_t ch;
// skip blank
for (; iswblank (*str); str ++) {
}
for (ch = *str; (ch == '-') || (ch == '+'); str ++) {
}
// the sign
sign = 0;
if ('-' == ch) {
sign = 1;
str ++;
}
// skip leading zero
for (; '0' == (*str); str ++) {
}
val = 0.0;
mantissa = 0.0;
divisor = 0;
power = 0.0;
// integer part
for (ch = *str; ('0' <= ch) && (ch <= '9'); str ++) {
ch -= '0';
val *= 10;
val += ch;
}
// floating point & mantissa
if ('.' == *str) {
str ++;
for (ch = *str; ('0' <= ch) && (ch <= '9'); str ++) {
ch -= '0';
mantissa *= 10.0;
mantissa += ch;
divisor ++;
}
}
for (; divisor > 0; divisor --) {
mantissa /= 10.0;
}
val += mantissa;
sign_power = 0;
if (('e' == *str) || ('E' == *str)) {
str ++;
if ('-' == ch) {
sign_power = 1;
str ++;
}
pend = NULL;
power = wcstoul (str, &pend, 10);
if (NULL != pend) {
str = pend;
}
}
if (power > 0) {
if (sign_power) {
for (; power > 0; power --) {
val /= 10.0;
}
} else {
for (; power > 0; power --) {
val *= 10.0;
}
}
}
if (sign) {
val = - val;
}
if (end) {
*end = (wchar_t *)str;
}
return val;
}
long wcstol (const wchar_t * str, wchar_t ** end, int base) {return 0;}
char * setlocale (int category, const char *locale) {return NULL;}
int
eof (int fd)
{
return 0;
}
int
remove (const char *fn)
{
return svfs_filedelete (fn);
}
// access(): check access permissions of a file or pathname
// R_OK: read permission
// W_OK: write permission
// X_OK: execute/search permission
// F_OK: existence test
//All components of the pathname path are checked for access permissions (including F_OK)
int access(const char *path, int amode) {return amode;}
off_t lseek(int fildes, off_t offset, int whence) {return 0;}

View File

@ -45,9 +45,6 @@
#include "wx/textfile.h"
#include "wx/palmos/private.h"
#include "wx/palmos/winundef.h"
#include <string.h>
#if wxUSE_RICHEDIT
@ -213,11 +210,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
return false;
}
WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
{
return 0;
}
// ----------------------------------------------------------------------------
// set/get the controls text
// ----------------------------------------------------------------------------
@ -225,7 +217,12 @@ WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
wxString wxTextCtrl::GetValue() const
{
wxString res;
return res;
}
wxString wxTextCtrl::GetRange(long from, long to) const
{
wxString res;
return res;
}
@ -237,7 +234,7 @@ void wxTextCtrl::WriteText(const wxString& value)
{
}
void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly)
void wxTextCtrl::DoWriteText(const wxString& text, int flags)
{
}
@ -265,11 +262,6 @@ void wxTextCtrl::Paste()
{
}
bool wxTextCtrl::HasSelection() const
{
return false;
}
bool wxTextCtrl::CanCopy() const
{
return false;
@ -330,7 +322,7 @@ void wxTextCtrl::SetSelection(long from, long to)
{
}
void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret)
void wxTextCtrl::DoSetSelection(long from, long to, int flags)
{
}
@ -388,7 +380,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
}
wxTextCtrlHitTestResult
wxTextCtrl::HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const
wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
{
return wxTE_HT_UNKNOWN;
}
@ -436,10 +428,12 @@ void wxTextCtrl::Redo()
bool wxTextCtrl::CanUndo() const
{
return false;
}
bool wxTextCtrl::CanRedo() const
{
return false;
}
// ----------------------------------------------------------------------------
@ -467,20 +461,10 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
// kbd input processing
// ----------------------------------------------------------------------------
bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* pMsg)
{
return false;
}
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
}
WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
return 0;
}
// ----------------------------------------------------------------------------
// text control event processing
// ----------------------------------------------------------------------------
@ -490,21 +474,11 @@ bool wxTextCtrl::SendUpdateEvent()
return false;
}
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
return false;
}
bool wxTextCtrl::AdjustSpaceLimit()
{
return false;
}
bool wxTextCtrl::AcceptsFocus() const
{
return false;
}
wxSize wxTextCtrl::DoGetBestSize() const
{
return wxSize(0,0);
@ -570,11 +544,39 @@ void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
{
}
void wxTextCtrl::OnRightClick(wxMouseEvent& event)
void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
{
}
void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
{
wxVisualAttributes attrs;
attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); //white
return attrs;
}
bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& rEvent)
{
return false;
}
bool wxTextCtrl::CanApplyThemeBorder() const
{
return false;
}
bool wxTextCtrl::IsEmpty() const
{
return false;
}
bool wxTextCtrl::AcceptsFocusFromKeyboard() const
{
return false;
}
void wxTextCtrl::AdoptAttributesFromHWND()
{
}
void wxTextCtrl::SetWindowStyleFlag(long lStyle)
{
}
@ -604,29 +606,6 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
return false;
}
// ----------------------------------------------------------------------------
// styling support for rich edit controls
// ----------------------------------------------------------------------------
#if wxUSE_RICHEDIT
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
return false;
}
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{
return false;
}
bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
{
return false;
}
#endif
// ----------------------------------------------------------------------------
// wxRichEditModule
// ----------------------------------------------------------------------------
@ -648,4 +627,27 @@ bool wxRichEditModule::Load(int version)
#endif // wxUSE_RICHEDIT
// ----------------------------------------------------------------------------
// styling support for rich edit controls
// ----------------------------------------------------------------------------
#if wxUSE_RICHEDIT
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
return false;
}
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{
return false;
}
bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
{
return false;
}
#endif // wxUSE_RICHEDIT
#endif // wxUSE_TEXTCTRL

View File

@ -30,12 +30,6 @@
#include "wx/hashmap.h"
#endif
#include "wx/palmos/private.h"
// from utils.cpp
extern "C" WXDLLIMPEXP_BASE HWND
wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc);
// ----------------------------------------------------------------------------
// private globals
// ----------------------------------------------------------------------------
@ -51,8 +45,6 @@ static wxTimerMap g_timerMap;
// private functions
// ----------------------------------------------------------------------------
void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
// ============================================================================
// implementation
// ============================================================================
@ -86,8 +78,4 @@ void wxProcessTimer(wxPalmOSTimerImpl& timer)
{
}
void WINAPI wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD)
{
}
#endif // wxUSE_TIMER

View File

@ -92,18 +92,21 @@ bool wxTopLevelWindowPalm::Create(wxWindow *parent,
const wxString& name)
{
// this is a check for limitation mentioned before FrameFormHandleEvent() code
if(wxTopLevelWindows.GetCount()>0)
if(wxTopLevelWindows.GetCount() > 0) {
return false;
}
ActiveParentFrame=NULL;
wxTopLevelWindows.Append(this);
if ( parent )
if ( parent ) {
parent->AddChild(this);
}
SetId( id == wxID_ANY ? NewControlId() : id );
#ifdef __WXPALMOS6__
WinConstraintsType constraints;
memset(&constraints, 0, sizeof(WinConstraintsType));
// position
@ -116,7 +119,6 @@ bool wxTopLevelWindowPalm::Create(wxWindow *parent,
constraints.y_min = winUndefConstraint;
constraints.y_max = winMaxConstraint;
constraints.y_pref = ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y;
FrameForm = FrmNewFormWithConstraints(
GetId(),
title.c_str(),
@ -128,11 +130,22 @@ bool wxTopLevelWindowPalm::Create(wxWindow *parent,
NULL,
0
);
if(FrameForm==NULL)
#else // __WXPALMOS5__
#define winUndefConstraint 0xFFFF
#define winMaxConstraint 288
// FormType *FrmNewForm (UInt16 formID, const Char *titleStrP, Coord x, Coord y, Coord width, Coord height,
// Boolean modal, UInt16 defaultButton, UInt16 helpRscID, UInt16 menuRscID);
FrameForm = FrmNewForm (GetId(), title.c_str(),
(( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x),
(( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y),
winMaxConstraint, winMaxConstraint,
false, 0, 0, 0);
#endif
if(NULL == FrameForm) {
return false;
}
FrmSetEventHandler((FormType *)FrameForm,FrameFormHandleEvent);
FrmSetEventHandler((FormType *)FrameForm, FrameFormHandleEvent);
FrmSetActiveForm((FormType *)FrameForm);
@ -168,7 +181,7 @@ void wxTopLevelWindowPalm::DoShowWindow(int nShowCmd)
bool wxTopLevelWindowPalm::Show(bool show)
{
if (true != show) {
return true;
return true;
}
FrmDrawForm((FormType *)FrameForm);
@ -328,12 +341,17 @@ bool wxTopLevelWindowPalm::HandleControlRepeat(WXEVENTPTR event)
bool wxTopLevelWindowPalm::HandleSize(WXEVENTPTR event)
{
#ifdef __WXPALMOS6__
const EventType *palmEvent = (EventType *)event;
wxSize newSize(palmEvent->data.winResized.newBounds.extent.x,
palmEvent->data.winResized.newBounds.extent.y);
wxSizeEvent eventWx(newSize,GetId());
eventWx.SetEventObject(this);
return HandleWindowEvent(eventWx);
#else // __WXPALMOS5__
return false;
#endif
}
void wxTopLevelWindowPalm::OnActivate(wxActivateEvent& event)
@ -369,9 +387,11 @@ static Boolean FrameFormHandleEvent(EventType *event)
case ctlRepeatEvent:
handled = tlw->HandleControlRepeat(event);
break;
#ifdef __WXPALMOS6__
case winResizedEvent:
handled = tlw->HandleSize(event);
break;
#endif // __WXPALMOS6__
#if wxUSE_MENUS_NATIVE
case menuOpenEvent:
handled = frame->HandleMenuOpen();

View File

@ -35,8 +35,6 @@
#include "wx/settings.h"
#endif
#include "wx/palmos/private.h"
#include "wx/imaglist.h"
// macros to hide the cast ugliness
@ -286,7 +284,7 @@ bool wxTreeCtrl::SetForegroundColour(const wxColour &colour)
wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const
{
return wxString;
return wxString(wxT(""));
}
void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
@ -421,11 +419,7 @@ bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const
wxTreeItemId wxTreeCtrl::GetRootItem() const
{
// Root may be real (visible) or virtual (hidden).
if ( GET_VIRTUAL_ROOT() )
return TVI_ROOT;
return wxTreeItemId(TreeView_GetRoot(GetHwnd()));
return wxTreeItemId();
}
wxTreeItemId wxTreeCtrl::GetSelection() const
@ -554,7 +548,6 @@ wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent,
void wxTreeCtrl::Delete(const wxTreeItemId& item)
{
return 0;
}
// delete all children (but don't delete the item itself)
@ -650,6 +643,7 @@ bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
// sorting stuff
// ----------------------------------------------------------------------------
/*
// this is just a tiny namespace which is friend to wxTreeCtrl and so can use
// functions such as IsDataIndirect()
class wxTreeSortHelper
@ -658,15 +652,9 @@ public:
static int CALLBACK Compare(LPARAM data1, LPARAM data2, LPARAM tree);
private:
static wxTreeItemId GetIdFromData(wxTreeCtrl *tree, LPARAM item)
static wxTreeItemId GetIdFromData(LPARAM lParam)
{
wxTreeItemData *data = (wxTreeItemData *)item;
if ( tree->IsDataIndirect(data) )
{
data = ((wxTreeItemIndirectData *)data)->GetData();
}
return data->GetId();
return ((wxTreeItemParam*)lParam)->GetItem();
}
};
@ -682,7 +670,7 @@ int CALLBACK wxTreeSortHelper::Compare(LPARAM pItem1,
return tree->OnCompareItems(GetIdFromData(tree, pItem1),
GetIdFromData(tree, pItem2));
}
*/
int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2)
{
@ -693,21 +681,6 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
{
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
// rely on the fact that TreeView_SortChildren does the same thing as our
// default behaviour, i.e. sorts items alphabetically and so call it
// directly if we're not in derived class (much more efficient!)
if ( GetClassInfo() == CLASSINFO(wxTreeCtrl) )
{
TreeView_SortChildren(GetHwnd(), HITEM(item), 0);
}
else
{
TV_SORTCB tvSort;
tvSort.hParent = HITEM(item);
tvSort.lpfnCompare = wxTreeSortHelper::Compare;
tvSort.lParam = (LPARAM)this;
TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */);
}
}
// ----------------------------------------------------------------------------

View File

@ -37,11 +37,18 @@
#include "wx/confbase.h"
#include "wx/power.h"
#include <PalmTypes.h>
#include <MemoryMgr.h>
#include <DLServer.h>
#include <SoundMgr.h>
#include <SystemMgr.h> // SysDoze()...
#include <SysUtils.h>
#ifdef defined (__WXPALMOS6__)
extern void SysReset (void);
extern UInt32 SysTaskID (void);
#endif
// ============================================================================
// implementation
// ============================================================================
@ -100,12 +107,15 @@ bool wxGetUserName(wxChar *buf, int maxSize)
const wxChar* wxGetHomeDir(wxString *pstr)
{
return NULL;
if (NULL != pstr) {
*pstr = "/palmos";
}
return wxT("/palmos");
}
wxString wxGetUserHome(const wxString& WXUNUSED(user))
{
return wxString();
return wxString("/palmos");
}
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
@ -152,6 +162,24 @@ bool wxShell(const wxString& command)
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
{
switch (wFlags) {
case wxSHUTDOWN_POWEROFF:
// TODO: turn off lamps
#ifdef defined (__WXPALMOS6__)
//extern void SysReset (void);
//extern UInt32 SysTaskID (void);
#define SysReset()
#define SysTaskID() (0)
SysSleep ();
#else
//SysSleep (false, false);// undocument API
SysDoze (true);
#endif
break;
case wxSHUTDOWN_REBOOT:
SysReset ();
break;
}
return false;
}
@ -161,13 +189,25 @@ bool wxShutdown(wxShutdownFlags wFlags)
wxPowerType wxGetPowerType()
{
//SysBatteryKind kind;
//POS_SysBatteryInfo (false, NULL, NULL, NULL, NULL, NULL, &kind, NULL);
//return wxPOWER_SOCKET;
return wxPOWER_BATTERY;
}
wxBatteryState wxGetBatteryState()
{
// TODO
return wxBATTERY_UNKNOWN_STATE;
//#include "SystemMgr.h"
UInt8 percent;
POS_SysBatteryInfo (false, NULL, NULL, NULL, NULL, NULL, NULL, &percent);
if (percent < 3)
return wxBATTERY_SHUTDOWN_STATE;
else if (percent < 5)
return wxBATTERY_CRITICAL_STATE;
else if (percent < 15)
return wxBATTERY_LOW_STATE;
//return wxBATTERY_UNKNOWN_STATE;
return wxBATTERY_NORMAL_STATE;
}
// ----------------------------------------------------------------------------
@ -182,7 +222,7 @@ wxMemorySize wxGetFreeMemory()
uint32_t freeChunk;
// executed twice: for the dynamic heap, and for the non-secure RAM storage heap
for ( uint16_t i=0; i<MemNumRAMHeaps(); i++)
for ( uint16_t i = 0; i < POS_MemNumRAMHeaps(); i ++)
{
status_t err = MemHeapFreeBytes(i, &freeHeap, &freeChunk);
if( err != errNone )
@ -195,7 +235,7 @@ wxMemorySize wxGetFreeMemory()
unsigned long wxGetProcessId()
{
return 0;
return SysTaskID ();
}
// Emit a beeeeeep
@ -213,6 +253,8 @@ wxString wxGetOsDescription()
{
wxString strOS = _T("PalmOS");
//err = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
//if (romVersion >= 0x02000000) v20 = true;
char *version = SysGetOSVersionString();
if(version)
{
@ -230,8 +272,7 @@ wxString wxGetOsDescription()
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
{
// TODO
return wxOS_UNKNOWN;
return wxOS_PALM_OS;
}
// ----------------------------------------------------------------------------
@ -240,14 +281,35 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
void wxMilliSleep(unsigned long milliseconds)
{
UInt16 ticks_sec;
Int32 delay;
ticks_sec = SysTicksPerSecond ();
delay = milliseconds * ticks_sec / 1000;
if (delay > 0) {
SysTaskDelay (delay);
}
}
void wxMicroSleep(unsigned long microseconds)
{
UInt16 ticks_sec;
Int32 delay;
ticks_sec = SysTicksPerSecond ();
delay = microseconds * ticks_sec / 1000000;
if (delay > 0) {
SysTaskDelay (delay);
}
}
void wxSleep(int nSecs)
{
UInt16 ticks_sec;
Int32 delay;
ticks_sec = SysTicksPerSecond ();
delay = nSecs * ticks_sec;
if (delay > 0) {
SysTaskDelay (delay);
}
}
// ----------------------------------------------------------------------------

View File

@ -37,7 +37,11 @@
#endif // WX_PRECOMP
#include <VFSMgr.h>
#ifdef __WXPALMOS6__
#include <PalmTypesCompatibility.h>
#else
#include <PalmCompatibility.h>
#endif
#if wxUSE_BASE

View File

@ -437,6 +437,7 @@ void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect)
WinHandle handle = (WinHandle)GetHWND();
if(handle)
{
#ifdef __WXPALMOS6__
if(rect)
{
RectangleType dirtyRect;
@ -450,6 +451,10 @@ void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect)
{
WinInvalidateWindow(handle);
}
#else // __WXPALMOS5__
WinSetActiveWindow (handle);
#endif
}
}