From 324eeecb3cdc9522e136af6670443148772b412a Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Mon, 14 Feb 2005 10:49:02 +0000 Subject: [PATCH] Inversed slider and wrapper for datepicker control on PalmOS. WinHandle instead of HWND as WXWidget type. Cleaning from wxMSW specific API. Moving controls support. Non deprecated API in new port. Refreshing of whole and portions of windows. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/palmos/makefile | 1 + docs/latex/wx/window.tex | 80 +++--- include/wx/chkconf.h | 11 + include/wx/datectrl.h | 6 +- include/wx/defs.h | 32 ++- include/wx/palmos/choice.h | 2 - include/wx/palmos/combobox.h | 3 - include/wx/palmos/control.h | 5 +- include/wx/palmos/datectrl.h | 62 ++++ include/wx/palmos/dialog.h | 24 +- include/wx/palmos/frame.h | 3 - include/wx/palmos/listctrl.h | 7 - include/wx/palmos/mdi.h | 16 +- include/wx/palmos/scrolbar.h | 4 +- include/wx/palmos/slider.h | 3 + include/wx/palmos/tabctrl.h | 3 - include/wx/palmos/textctrl.h | 6 - include/wx/palmos/toolbar.h | 3 - include/wx/palmos/toplevel.h | 5 +- include/wx/palmos/window.h | 191 +------------ src/palmos/choice.cpp | 11 +- src/palmos/combobox.cpp | 21 -- src/palmos/control.cpp | 36 ++- src/palmos/datectrl.cpp | 109 +++++++ src/palmos/dcclient.cpp | 12 +- src/palmos/dialog.cpp | 37 --- src/palmos/frame.cpp | 24 -- src/palmos/listctrl.cpp | 5 - src/palmos/mdi.cpp | 27 -- src/palmos/nativdlg.cpp | 6 +- src/palmos/scrolbar.cpp | 6 - src/palmos/slider.cpp | 15 +- src/palmos/statbrpalm.cpp | 3 - src/palmos/tabctrl.cpp | 6 - src/palmos/textctrl.cpp | 18 -- src/palmos/toolbar.cpp | 14 - src/palmos/toplevel.cpp | 21 +- src/palmos/utilsgui.cpp | 25 -- src/palmos/window.cpp | 539 ++++++----------------------------- 39 files changed, 435 insertions(+), 967 deletions(-) create mode 100644 include/wx/palmos/datectrl.h create mode 100644 src/palmos/datectrl.cpp diff --git a/build/palmos/makefile b/build/palmos/makefile index 15b2192563..2bbb2f3ff8 100644 --- a/build/palmos/makefile +++ b/build/palmos/makefile @@ -200,6 +200,7 @@ SOURCES = ../../samples/minimal/minimal.cpp \ ../../src/palmos/control.cpp \ ../../src/palmos/cursor.cpp \ ../../src/palmos/data.cpp \ +../../src/palmos/datectrl.cpp \ ../../src/palmos/dc.cpp \ ../../src/palmos/dcclient.cpp \ ../../src/palmos/dcmemory.cpp \ diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index 06a559d0e7..b3bb29d079 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -9,9 +9,9 @@ the destructor before the window itself is deleted which means that you don't have to worry about deleting them manually. Please see the \helpref{window deletion overview}{windowdeletionoverview} for more information. -Also note that in this, and many others, wxWidgets classes some -\texttt{GetXXX()} methods may be overloaded (as, for example, -\helpref{GetSize}{wxwindowgetsize} or +Also note that in this, and many others, wxWidgets classes some +\texttt{GetXXX()} methods may be overloaded (as, for example, +\helpref{GetSize}{wxwindowgetsize} or \helpref{GetClientSize}{wxwindowgetclientsize}). In this case, the overloads are non-virtual because having multiple virtual functions with the same name results in a virtual function name hiding at the derived class level (in @@ -353,7 +353,7 @@ implementation of wxDialog::OnCloseWindow does not necessarily delete the dialog, since it will simply simulate an wxID\_CANCEL event which is handled by the appropriate button event handler and may do anything at all. -To guarantee that the window will be destroyed, call +To guarantee that the window will be destroyed, call \helpref{wxWindow::Destroy}{wxwindowdestroy} instead \wxheading{See also} @@ -491,7 +491,7 @@ same size as it would have after a call to \helpref{Fit()}{wxwindowfit}. \func{virtual void}{DoUpdateWindowUI}{\param{wxUpdateUIEvent\&}{ event}} Does the window-specific updating after processing the update event. -This function is called by \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} +This function is called by \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} in order to check return values in the \helpref{wxUpdateUIEvent}{wxupdateuievent} and act appropriately. For example, to allow frame and dialog title updating, wxWidgets implements this function as follows: @@ -502,7 +502,7 @@ void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event) { if ( event.GetSetEnabled() ) Enable(event.GetEnabled()); - + if ( event.GetSetText() ) { if ( event.GetText() != GetTitle() ) @@ -611,7 +611,7 @@ If {\it parent} is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases. -If no window with such name is found, +If no window with such name is found, \helpref{FindWindowByLabel}{wxwindowfindwindowbylabel} is called. \wxheading{See also} @@ -774,9 +774,9 @@ Returns the currently captured window. \wxheading{See also} -\helpref{wxWindow::HasCapture}{wxwindowhascapture}, -\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, -\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, +\helpref{wxWindow::HasCapture}{wxwindowhascapture}, +\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, +\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, \helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent} @@ -813,7 +813,7 @@ system, especially if it uses themes. The \arg{variant} parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the -returned font. See \helpref{wxWindow::SetWindowVariant}{wxwindowsetwindowvariant} +returned font. See \helpref{wxWindow::SetWindowVariant}{wxwindowsetwindowvariant} for more about this. This static method is ``overridden'' in many derived classes and so calling, @@ -821,7 +821,7 @@ for example, \helpref{wxButton}{wxbutton}::GetClassDefaultAttributes() will typi return the values appropriate for a button which will be normally different from those returned by, say, \helpref{wxListCtrl}{wxlistctrl}::GetClassDefaultAttributes(). -The \texttt{wxVisualAttributes} structure has at least the fields +The \texttt{wxVisualAttributes} structure has at least the fields \texttt{font}, \texttt{colFg} and \texttt{colBg}. All of them may be invalid if it was not possible to determine the default control appearance or, especially for the background colour, if the field doesn't make sense as is @@ -896,7 +896,7 @@ Return the cursor associated with this window. \constfunc{virtual wxVisualAttributes}{GetDefaultAttributes}{\void} -Currently this is the same as calling +Currently this is the same as calling \helpref{GetClassDefaultAttributes}{wxwindowgetclassdefaultattributes}(\helpref{GetWindowVariant}{wxwindowgetwindowvariant}()). One advantage of using this function compared to the static version is that @@ -988,7 +988,7 @@ Returns the grandparent of a window, or NULL if there isn't one. \constfunc{void*}{GetHandle}{\void} Returns the platform-specific handle of the physical window. Cast it to an appropriate -handle, such as {\bf HWND} for Windows, {\bf Widget} for Motif or {\bf GtkWidget} for GTK. +handle, such as {\bf HWND} for Windows, {\bf Widget} for Motif, {\bf GtkWidget} for GTK or {\bf WinHandle} for PalmOS. \pythonnote{This method will return an integer in wxPython.} @@ -1308,7 +1308,7 @@ method. {\bf GetWindowStyle()} is another name for the same function. \constfunc{wxWindowVariant}{GetWindowVariant}{\void} -Returns the value previous passed to +Returns the value previous passed to \helpref{wxWindow::SetWindowVariant}{wxwindowsetwindowvariant}. @@ -1320,8 +1320,8 @@ Returns {\tt true} if this window has the current mouse capture. \wxheading{See also} -\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, -\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, +\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, +\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, \helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent} @@ -1365,12 +1365,12 @@ the font and the foreground and background colours. By ``intelligently'' the following is meant: by default, all windows use their own \helpref{default}{wxwindowgetclassdefaultattributes} attributes. However -if some of the parents attributes are explicitly (that is, using -\helpref{SetFont}{wxwindowsetfont} and not +if some of the parents attributes are explicitly (that is, using +\helpref{SetFont}{wxwindowsetfont} and not \helpref{SetOwnFont}{wxwindowsetownfont}) changed \emph{and} if the corresponding attribute hadn't been explicitly set for this window itself, then this window takes the same value as used by the parent. In addition, if -the window overrides \helpref{ShouldInheritColours}{wxwindowshouldinheritcolours} +the window overrides \helpref{ShouldInheritColours}{wxwindowshouldinheritcolours} to return \false, the colours will not be changed no matter what and only the font might. @@ -1549,7 +1549,7 @@ Moves this window in the tab navigation order after the specified \arg{win}. This means that when the user presses \texttt{TAB} key on that other window, the focus switches to this window. -Default tab order is the same as creation order, this function and +Default tab order is the same as creation order, this function and \helpref{MoveBeforeInTabOrder()}{wxwindowmovebeforeintaborder} allow to change it after creating all the windows. @@ -2089,7 +2089,7 @@ that should not be disabled by an application defining an OnIdle handler in a derived class. This function may be used to do delayed painting, for example, -and most implementations call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} +and most implementations call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} in order to send update events to the window in idle time. @@ -2237,7 +2237,7 @@ Redraws the contents of the given rectangle: only the area inside it will be repainted. This is the same as \helpref{Refresh}{wxwindowrefresh} but has a nicer syntax -as it can be called with a temporary wxRect object as argument like this +as it can be called with a temporary wxRect object as argument like this \texttt{RefreshRect(wxRect(x, y, w, h))}. @@ -2283,9 +2283,9 @@ Releases mouse input captured with \helpref{wxWindow::CaptureMouse}{wxwindowcapt \wxheading{See also} -\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, -\helpref{wxWindow::HasCapture}{wxwindowhascapture}, -\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, +\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}, +\helpref{wxWindow::HasCapture}{wxwindowhascapture}, +\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}, \helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent} @@ -2456,8 +2456,8 @@ See also \helpref{wxAccessible}{wxaccessible}. \func{void}{SetAutoLayout}{\param{bool}{ autoLayout}} Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will -be called automatically when the window is resized. It is called implicitly by -\helpref{wxWindow::SetSizer}{wxwindowsetsizer} but if you use +be called automatically when the window is resized. It is called implicitly by +\helpref{wxWindow::SetSizer}{wxwindowsetsizer} but if you use \helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} you should call it manually or otherwise the window layout won't be correctly updated when its size changes. @@ -2479,7 +2479,7 @@ from within wxWindow::OnSize functions.} Sets the background colour of the window. Please see \helpref{InheritAttributes}{wxwindowinheritattributes} for -explanation of the difference between this method and +explanation of the difference between this method and \helpref{SetOwnBackgroundColour}{wxwindowsetownbackgroundcolour}. \wxheading{Parameters} @@ -2832,7 +2832,7 @@ explanations. Sets the foreground colour of the window. Please see \helpref{InheritAttributes}{wxwindowinheritattributes} for -explanation of the difference between this method and +explanation of the difference between this method and \helpref{SetOwnForegroundColour}{wxwindowsetownforegroundcolour}. \wxheading{Parameters} @@ -3201,7 +3201,7 @@ will then own the object, and will take care of its deletion. If an existing layout constraints object is already owned by the window, it will be deleted if the deleteOld parameter is true. -Note that this function will also call +Note that this function will also call \helpref{SetAutoLayout}{wxwindowsetautolayout} implicitly with {\tt true} parameter if the {\it sizer}\/ is non-NULL and {\tt false} otherwise. @@ -3295,7 +3295,7 @@ Sets the virtual size of the window in pixels. \func{virtual void}{SetVirtualSizeHints}{\param{int}{ minW},\param{int}{ minH}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1}} -\func{void}{SetVirtualSizeHints}{\param{const wxSize\&}{ minSize=wxDefaultSize}, +\func{void}{SetVirtualSizeHints}{\param{const wxSize\&}{ minSize=wxDefaultSize}, \param{const wxSize\&}{ maxSize=wxDefaultSize}} @@ -3371,11 +3371,11 @@ be used to change this. \func{virtual bool}{ShouldInheritColours}{\void} -Return \true from here to allow the colours of this window to be changed by +Return \true from here to allow the colours of this window to be changed by \helpref{InheritAttributes}{wxwindowinheritattributes}, returning \false forbids inheriting them from the parent window. -The base class version returns \false, but this method is overridden in +The base class version returns \false, but this method is overridden in \helpref{wxControl}{wxcontrol} where it returns \true. @@ -3406,7 +3406,7 @@ done because it already was in the requested state. \func{virtual void}{Thaw}{\void} -Reenables window updating after a previous call to +Reenables window updating after a previous call to \helpref{Freeze}{wxwindowfreeze}. To really thaw the control, it must be called exactly the same number of times as \helpref{Freeze}{wxwindowfreeze}. @@ -3476,7 +3476,7 @@ This function is currently only implemented under MSW. Calling this method immediately repaints the invalidated area of the window while this would usually only happen when the flow of control returns to the event loop. Notice that this function doesn't refresh the window and does -nothing if the window hadn't been already repainted. Use +nothing if the window hadn't been already repainted. Use \helpref{Refresh}{wxwindowrefresh} first if you want to immediately redraw the window unconditionally. @@ -3491,8 +3491,8 @@ example a wxToolBar will send an update UI event for each toolbar button, and a wxFrame will send an update UI event for each menubar menu item. You can call this function from your application to ensure that your UI is up-to-date at this point (as far as your wxUpdateUIEvent handlers -are concerned). This may be necessary if you have called -\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} or +are concerned). This may be necessary if you have called +\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} or \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} to limit the overhead that wxWidgets incurs by sending update UI events in idle time. @@ -3525,8 +3525,8 @@ void MyWindow::OnInternalIdle() \wxheading{See also} -\helpref{wxUpdateUIEvent}{wxupdateuievent}, -\helpref{wxWindow::DoUpdateWindowUI}{wxwindowdoupdatewindowui}, +\helpref{wxUpdateUIEvent}{wxupdateuievent}, +\helpref{wxWindow::DoUpdateWindowUI}{wxwindowdoupdatewindowui}, \helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle} diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index e77530826d..b6db50e9f5 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -1262,6 +1262,17 @@ # endif #endif /* wxUSE_CALENDARCTRL */ +#if wxUSE_DATEPICKCTRL +# if !wxUSE_DATETIME +# ifdef wxABORT_ON_CONFIG_ERROR +# error wxDatePickerCtrl requires wxUSE_DATETIME" +# else +# undef wxUSE_DATETIME +# define wxUSE_DATETIME 1 +# endif +# endif +#endif /* wxUSE_DATEPICKCTRL */ + #if wxUSE_CHECKLISTBOX # if !wxUSE_LISTBOX # ifdef wxABORT_ON_CONFIG_ERROR diff --git a/include/wx/datectrl.h b/include/wx/datectrl.h index 5a0e6f0e4d..397806bdd9 100644 --- a/include/wx/datectrl.h +++ b/include/wx/datectrl.h @@ -74,7 +74,11 @@ public: virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const = 0; }; -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) +#if defined(__WXPALMOS__) + #include "wx/palmos/datectrl.h" + + #define wxHAS_NATIVE_DATEPICKCTRL +#elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/datectrl.h" #define wxHAS_NATIVE_DATEPICKCTRL diff --git a/include/wx/defs.h b/include/wx/defs.h index 91314e7f08..71ec108a53 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2346,7 +2346,37 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSView); typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ #endif /* __WXCOCOA__ */ -#if defined(__WXMSW__) || defined(__WXPALMOS__) +#if defined(__WXPALMOS__) + +typedef void * WXHANDLE; +typedef void * WXHICON; +typedef void * WXHFONT; +typedef void * WXHMENU; +typedef void * WXHPEN; +typedef void * WXHBRUSH; +typedef void * WXHPALETTE; +typedef void * WXHCURSOR; +typedef void * WXHRGN; +typedef void * WXHACCEL; +typedef void * WXHINSTANCE; +typedef void * WXHBITMAP; +typedef void * WXHIMAGELIST; +typedef void * WXHGLOBAL; +typedef void * WXHDC; +typedef unsigned int WXUINT; +typedef unsigned long WXDWORD; +typedef unsigned short WXWORD; + +typedef unsigned long WXCOLORREF; +typedef struct tagMSG WXMSG; + +typedef WinHandle WXWINHANDLE; +typedef WXWINHANDLE WXWidget; + +#endif /* __WXPALMOS__ */ + + +#if defined(__WXMSW__) /* the keywords needed for WinMain() declaration */ #ifndef WXFAR diff --git a/include/wx/palmos/choice.h b/include/wx/palmos/choice.h index f2e001a4ca..e15a50e988 100644 --- a/include/wx/palmos/choice.h +++ b/include/wx/palmos/choice.h @@ -84,8 +84,6 @@ public: // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); protected: virtual void DoMoveWindow(int x, int y, int width, int height); diff --git a/include/wx/palmos/combobox.h b/include/wx/palmos/combobox.h index 405376ceb6..8b98c3f3a8 100644 --- a/include/wx/palmos/combobox.h +++ b/include/wx/palmos/combobox.h @@ -108,9 +108,6 @@ public: bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - WXHWND GetEditHWND() const; protected: diff --git a/include/wx/palmos/control.h b/include/wx/palmos/control.h index edc21f7626..18bd43e88b 100644 --- a/include/wx/palmos/control.h +++ b/include/wx/palmos/control.h @@ -72,9 +72,6 @@ public: void OnEraseBackground(wxEraseEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - protected: // regardless how deeply we are in wxWidgets hierarchy always get correct form FormType* GetParentForm() const; @@ -101,6 +98,7 @@ protected: // getting and setting sizes virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetSize( int *width, int *height ) const; + virtual void DoMoveWindow(int x, int y, int width, int height); // create the control of the given ControlStyleType: this is typically called // from Create() method of the derived class passing its label, pos and @@ -143,6 +141,7 @@ private: void Init(); virtual void DoGetBounds( RectangleType &rect ) const; + virtual void DoSetBounds( RectangleType &rect ); // m_label stores label in case of wxButton, wxCheckBox, wxToggleButton etc. // We must ensure that it persists for as long as it is being displayed diff --git a/include/wx/palmos/datectrl.h b/include/wx/palmos/datectrl.h new file mode 100644 index 0000000000..e5c1921412 --- /dev/null +++ b/include/wx/palmos/datectrl.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/datectrl.h +// Purpose: wxDatePickerCtrl for PalmOS +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 02/15/05 +// RCS-ID: $Id$ +// Copyright: (c) Wlodzimierz Skiba +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_DATECTRL_H_ +#define _WX_PALMOS_DATECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase +{ +public: + // ctors + wxDatePickerCtrl() { } + + wxDatePickerCtrl(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr) + { + Create(parent, id, dt, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt = wxDefaultDateTime, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDP_DEFAULT | wxDP_SHOWCENTURY, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDatePickerCtrlNameStr); + + // set/get the date + virtual void SetValue(const wxDateTime& dt); + virtual wxDateTime GetValue() const; + + // set/get the allowed valid range for the dates, if either/both of them + // are invalid, there is no corresponding limit and if neither is set + // GetRange() returns false + virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2); + virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; + +protected: + virtual wxSize DoGetBestSize() const; + + DECLARE_NO_COPY_CLASS(wxDatePickerCtrl) +}; + +#endif // _WX_PALMOS_DATECTRL_H_ diff --git a/include/wx/palmos/dialog.h b/include/wx/palmos/dialog.h index 209fc4a448..2809a24c44 100644 --- a/include/wx/palmos/dialog.h +++ b/include/wx/palmos/dialog.h @@ -63,7 +63,7 @@ public: // ------------------------------- // override some base class virtuals - virtual bool Show(bool show = TRUE); + virtual bool Show(bool show = true); virtual void Raise(); @@ -76,28 +76,6 @@ public: void OnApply(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Windows callbacks - WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - // obsolete methods - // ---------------- - - // use the other ctor - wxDEPRECATED( wxDialog(wxWindow *parent, - const wxString& title, bool modal, - int x = -1, int y= -1, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) ); - - // just call Show() or ShowModal() - wxDEPRECATED( void SetModal(bool flag) ); - - // use IsModal() - wxDEPRECATED( bool IsModalShowing() const ); - protected: // find the window to use as parent for this dialog if none has been // specified explicitly by the user diff --git a/include/wx/palmos/frame.h b/include/wx/palmos/frame.h index 76f5bd804f..f21d348438 100644 --- a/include/wx/palmos/frame.h +++ b/include/wx/palmos/frame.h @@ -52,7 +52,6 @@ public: // ------------------------------- // event handlers - void OnSysColourChanged(wxSysColourChangedEvent& event); void OnPaint(wxPaintEvent& event); // Toolbar @@ -65,8 +64,6 @@ public: #endif // wxUSE_TOOLBAR // event handlers - bool HandlePaint(); - bool HandleSize(int x, int y, WXUINT flag); bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); virtual wxPoint GetClientAreaOrigin() const; diff --git a/include/wx/palmos/listctrl.h b/include/wx/palmos/listctrl.h index 421a027cba..7f4271c3f4 100644 --- a/include/wx/palmos/listctrl.h +++ b/include/wx/palmos/listctrl.h @@ -213,9 +213,6 @@ public: // Add or remove a single window style void SetSingleStyle(long style, bool add = true) ; - // Set the whole window style - void SetWindowStyleFlag(long style) ; - // Searches for an item, starting from 'item'. // item can be -1 to find the first item that matches the // specified flags. @@ -348,10 +345,6 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - // obsolete stuff, for compatibility only -- don't use - wxDEPRECATED( int GetItemSpacing(bool isSmall) const); - protected: // common part of all ctors void Init(); diff --git a/include/wx/palmos/mdi.h b/include/wx/palmos/mdi.h index 4379118821..5713ef4444 100644 --- a/include/wx/palmos/mdi.h +++ b/include/wx/palmos/mdi.h @@ -81,14 +81,8 @@ public: // handlers // -------- - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - void OnSize(wxSizeEvent& event); - bool HandleActivate(int state, bool minimized, WXHWND activate); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - // override window proc for MDI-specific message processing virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); @@ -106,7 +100,7 @@ protected: wxMDIChildFrame * m_currentChild; wxMenu* m_windowMenu; - // TRUE if MDI Frame is intercepting commands, not child + // true if MDI Frame is intercepting commands, not child bool m_parentFrameActive; private: @@ -148,10 +142,10 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - virtual bool IsTopLevel() const { return FALSE; } + virtual bool IsTopLevel() const { return false; } // MDI operations - virtual void Maximize(bool maximize = TRUE); + virtual void Maximize(bool maximize = true); virtual void Restore(); virtual void Activate(); @@ -161,8 +155,6 @@ public: // Handlers bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); bool HandleWindowPosChanging(void *lpPos); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleGetMinMaxInfo(void *mmInfo); virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); @@ -178,7 +170,7 @@ protected: virtual void DoGetPosition(int *x, int *y) const; virtual void DoSetClientSize(int width, int height); virtual void InternalSetMenuBar(); - virtual bool IsMDIChild() const { return TRUE; } + virtual bool IsMDIChild() const { return true; } virtual WXHICON GetDefaultIcon() const; diff --git a/include/wx/palmos/scrolbar.h b/include/wx/palmos/scrolbar.h index 93f0c83a0a..8c989c302a 100644 --- a/include/wx/palmos/scrolbar.h +++ b/include/wx/palmos/scrolbar.h @@ -46,7 +46,7 @@ public: virtual void SetThumbPosition(int viewStart); virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, - bool refresh = TRUE); + bool refresh = true); // needed for RTTI void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } @@ -54,8 +54,6 @@ public: void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWOnScroll(int orientation, WXWORD wParam, WXWORD pos, WXHWND control); diff --git a/include/wx/palmos/slider.h b/include/wx/palmos/slider.h index b96e40ce15..d21ce89da6 100644 --- a/include/wx/palmos/slider.h +++ b/include/wx/palmos/slider.h @@ -85,6 +85,9 @@ protected: private: void Init(); + + int PalmInvertOrNot(int value) const; + int m_oldPos; // needed for tracing thumb position during scrolling int m_oldValue; // needed for comparing thumb position before and after scrolling int m_lineSize; // imitate line size diff --git a/include/wx/palmos/tabctrl.h b/include/wx/palmos/tabctrl.h index dd9cfa8539..72ecc77bb6 100644 --- a/include/wx/palmos/tabctrl.h +++ b/include/wx/palmos/tabctrl.h @@ -117,9 +117,6 @@ class WXDLLEXPORT wxTabCtrl: public wxControl virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - protected: wxImageList* m_imageList; diff --git a/include/wx/palmos/textctrl.h b/include/wx/palmos/textctrl.h index 35782d81bb..95b50e33c7 100644 --- a/include/wx/palmos/textctrl.h +++ b/include/wx/palmos/textctrl.h @@ -136,12 +136,8 @@ public: // Implementation from now on // -------------------------- - virtual void SetWindowStyleFlag(long style); - virtual void Command(wxCommandEvent& event); virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); #if wxUSE_RICHEDIT virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); @@ -155,8 +151,6 @@ public: virtual bool SetForegroundColour(const wxColour& colour); #endif // wxUSE_RICHEDIT - virtual void AdoptAttributesFromHWND(); - virtual bool AcceptsFocus() const; // callbacks diff --git a/include/wx/palmos/toolbar.h b/include/wx/palmos/toolbar.h index 4188d1b2cb..d31ac94067 100644 --- a/include/wx/palmos/toolbar.h +++ b/include/wx/palmos/toolbar.h @@ -60,10 +60,7 @@ public: // implementation only from now on // ------------------------------- - virtual void SetWindowStyleFlag(long style); - void OnMouseEvent(wxMouseEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); void SetFocus() {} diff --git a/include/wx/palmos/toplevel.h b/include/wx/palmos/toplevel.h index 85630b6943..9d2faa7655 100644 --- a/include/wx/palmos/toplevel.h +++ b/include/wx/palmos/toplevel.h @@ -89,6 +89,8 @@ public: bool HandleControlRepeat(EventType* event); bool HandleSize(EventType* event); + virtual WXWINHANDLE GetWinHandle() const; + protected: // common part of all ctors void Init(); @@ -102,9 +104,6 @@ protected: // translate wxWidgets flags to Windows ones virtual WXDWORD PalmGetStyle(long flags, WXDWORD *exstyle) const; - // choose the right parent to use with CreateWindow() - virtual WXHWND PalmGetParent() const; - // is the window currently iconized? bool m_iconized; diff --git a/include/wx/palmos/window.h b/include/wx/palmos/window.h index 460e2242e8..40749393fe 100644 --- a/include/wx/palmos/window.h +++ b/include/wx/palmos/window.h @@ -74,12 +74,11 @@ public: virtual void WarpPointer(int x, int y); virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); + const wxRect *rect = NULL ); virtual void Update(); virtual void Freeze(); virtual void Thaw(); - virtual void SetWindowStyleFlag( long style ); virtual bool SetCursor( const wxCursor &cursor ); virtual bool SetFont( const wxFont &font ); @@ -136,9 +135,8 @@ public: // simple accessors // ---------------- - WXHWND GetHWND() const { return m_hWnd; } - void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } - virtual WXWidget GetHandle() const { return GetHWND(); } + virtual WXWINHANDLE GetWinHandle() const { return m_handle; } + virtual WXWidget GetHandle() const { return GetWinHandle(); } // event handlers // -------------- @@ -147,23 +145,11 @@ public: void OnPaint(wxPaintEvent& event); public: - // Windows subclassing - void SubclassWin(WXHWND hWnd); - void UnsubclassWin(); - - WXFARPROC PalmGetOldWndProc() const { return m_oldWndProc; } - void PalmSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - - // return true if the window is of a standard (i.e. not wxWidgets') class - // - // to understand why does it work, look at SubclassWin() code and comments - bool IsOfStandardClass() const { return m_oldWndProc != NULL; } - wxWindow *FindItem(long id) const; - wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; + wxWindow *FindItemByWinHandle(WXWINHANDLE handle, bool controlOnly = false) const; // Palm only: true if this control is part of the main control - virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; }; + virtual bool ContainsWinHandle(WXWINHANDLE WXUNUSED(handle)) const { return false; }; // translate wxWidgets style flags for this control into the Windows style // and optional extended style for the corresponding native control @@ -188,9 +174,6 @@ public: int& x, int& y, int& w, int& h) const; - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND PalmGetParent() const; - // creates the window of specified Windows class with given style, extended // style, title and geometry (default values // @@ -202,150 +185,25 @@ public: WXDWORD style = 0, WXDWORD exendedStyle = 0); - virtual bool PalmCommand(WXUINT param, WXWORD id); - #ifndef __WXUNIVERSAL__ - // Create an appropriate wxWindow from a HWND - virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); + // Create an appropriate wxWindow from a WinHandle + virtual wxWindow* CreateWindowFromWinHandle(wxWindow* parent, WXWINHANDLE handle); - // Make sure the window style reflects the HWND style (roughly) - virtual void AdoptAttributesFromHWND(); + // Make sure the window style reflects the WinHandle style (roughly) + virtual void AdoptAttributesFromWinHandle(); #endif // __WXUNIVERSAL__ // Setup background and foreground colours correctly virtual void SetupColours(); - // ------------------------------------------------------------------------ - // helpers for message handlers: these perform the same function as the - // message crackers from - they unpack WPARAM and LPARAM into - // the correct parameters - // ------------------------------------------------------------------------ - - void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *id, WXHWND *hwnd, WXWORD *cmd); - void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *state, WXWORD *minimized, WXHWND *hwnd); - void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *code, WXWORD *pos, WXHWND *hwnd); - void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd); - void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *item, WXWORD *flags, WXHMENU *hmenu); - // ------------------------------------------------------------------------ // internal handlers for Palm messages: all handlers return a boolean value: // true means that the handler processed the event and false that it didn't // ------------------------------------------------------------------------ - // there are several cases where we have virtual functions for Windows - // message processing: this is because these messages often require to be - // processed in a different manner in the derived classes. For all other - // messages, however, we do *not* have corresponding PalmOnXXX() function - // and if the derived class wants to process them, it should override - // PalmWindowProc() directly. - // scroll event (both horizontal and vertical) virtual bool PalmOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - - // owner-drawn controls need to process these messages - virtual bool PalmOnDrawItem(int id, WXDRAWITEMSTRUCT *item); - virtual bool PalmOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); - - // the rest are not virtual - bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); - bool HandleInitDialog(WXHWND hWndFocus); - bool HandleDestroy(); - - bool HandlePaint(); - bool HandleEraseBkgnd(WXHDC pDC); - - bool HandleMinimize(); - bool HandleMaximize(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleSizing(wxRect& rect); - bool HandleGetMinMaxInfo(void *mmInfo); - - bool HandleShow(bool show, int status); - bool HandleActivate(int flag, bool minimized, WXHWND activate); - - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - - bool HandleCtlColor(WXHBRUSH *hBrush, - WXHDC hdc, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - - bool HandlePaletteChanged(WXHWND hWndPalChange); - bool HandleQueryNewPalette(); - bool HandleSysColorChange(); - bool HandleDisplayChange(); - bool HandleCaptureChanged(WXHWND gainedCapture); - - bool HandleQueryEndSession(long logOff, bool *mayEnd); - bool HandleEndSession(bool endSession, long logOff); - - bool HandleSetFocus(WXHWND wnd); - bool HandleKillFocus(WXHWND wnd); - - bool HandleDropFiles(WXWPARAM wParam); - - bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleMouseMove(int x, int y, WXUINT flags); - bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false); - bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); - bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); -#if wxUSE_ACCEL - bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); -#endif - - bool HandleQueryDragIcon(WXHICON *hIcon); - - bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); - - // Window procedure - virtual WXLRESULT PalmWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // Calls an appropriate default window procedure - virtual WXLRESULT PalmDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // message processing helpers - - // return false if the message shouldn't be translated/preprocessed but - // dispatched normally - virtual bool PalmShouldPreProcessMessage(WXMSG* pMsg); - - // return true if the message was preprocessed and shouldn't be dispatched - virtual bool PalmProcessMessage(WXMSG* pMsg); - - // return true if the message was translated and shouldn't be dispatched - virtual bool PalmTranslateMessage(WXMSG* pMsg); - - // called when the window is about to be destroyed - virtual void PalmDestroyWindow(); - - // this function should return the brush to paint the window background - // with or 0 for the default brush - virtual WXHBRUSH OnCtlColor(WXHDC hDC, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // initialize various fields of wxMouseEvent (common part of PalmOnMouseXXX) - void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); - - // check if mouse is in the window - bool IsMouseInWindow() const; + WXWORD pos, WXWINHANDLE control); // virtual function for implementing internal idle // behaviour @@ -353,15 +211,12 @@ public: protected: // the window handle - WXHWND m_hWnd; + WinHandle m_handle; FormType *FrameForm; FormType *GetFormPtr(); void SetFormPtr(FormType *FormPtr); - // the old window proc (we subclass all windows) - WXFARPROC m_oldWndProc; - // additional (Palm specific) flags bool m_mouseInWindow:1; bool m_lastKeydownProcessed:1; @@ -409,10 +264,6 @@ protected: const wxString& ttip); #endif // wxUSE_TOOLTIPS - // the helper functions used by HandleChar/KeyXXX methods - wxKeyEvent CreateKeyEvent(wxEventType evType, int id, - WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; - private: // common part of all ctors void Init(); @@ -433,24 +284,6 @@ private: DECLARE_EVENT_TABLE() }; -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - -// kbd code translation -WXDLLEXPORT int wxCharCodePalmToWX(int keySym, WXLPARAM lParam = 0); -WXDLLEXPORT int wxCharCodeWXToPalm(int id, bool *IsVirtual); - -// window creation helper class: before creating a new HWND, instantiate an -// object of this class on stack - this allows to process the messages sent to -// the window even before CreateWindow() returns -class wxWindowCreationHook -{ -public: - wxWindowCreationHook(wxWindowPalm *winBeingCreated); - ~wxWindowCreationHook(); -}; - // ---------------------------------------------------------------------------- // global objects // ---------------------------------------------------------------------------- @@ -459,7 +292,7 @@ public: // needs to "see" its dtor and not just forward declaration #include "wx/hash.h" -// pseudo-template HWND <-> wxWindow hash table +// pseudo-template WinHandle <-> wxWindow hash table WX_DECLARE_HASH(wxWindowPalm, wxWindowList, wxWinHashTable); extern wxWinHashTable *wxWinHandleHash; diff --git a/src/palmos/choice.cpp b/src/palmos/choice.cpp index 3cc53e1b6c..1a48dfcf53 100644 --- a/src/palmos/choice.cpp +++ b/src/palmos/choice.cpp @@ -120,7 +120,7 @@ bool wxChoice::CreateAndInit(wxWindow *parent, const wxValidator& validator, const wxString& name) { - return FALSE; + return false; } bool wxChoice::Create(wxWindow *parent, @@ -272,13 +272,4 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return false; } -WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) - ) -{ - return (WXHBRUSH) 0; -} - #endif // wxUSE_CHOICE diff --git a/src/palmos/combobox.cpp b/src/palmos/combobox.cpp index b86124b70a..d008403ad7 100644 --- a/src/palmos/combobox.cpp +++ b/src/palmos/combobox.cpp @@ -128,27 +128,6 @@ static WNDPROC gs_wndprocEdit = (WNDPROC)NULL; // implementation // ============================================================================ -WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, - WXHWND WXUNUSED(pWnd), - WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam)) -{ - HDC hdc = (HDC)pDC; - wxColour colBack = GetBackgroundColour(); - - if (!IsEnabled()) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - - return (WXHBRUSH)brush->GetResourceHandle(); -} - // ---------------------------------------------------------------------------- // wxComboBox callbacks // ---------------------------------------------------------------------------- diff --git a/src/palmos/control.cpp b/src/palmos/control.cpp index 5dd719b4c3..5f60d345ca 100644 --- a/src/palmos/control.cpp +++ b/src/palmos/control.cpp @@ -286,6 +286,17 @@ void wxControl::DoGetBounds( RectangleType &rect ) const FrmGetObjectBounds(form,index,&rect); } +void wxControl::DoSetBounds( RectangleType &rect ) +{ + FormType* form = GetParentForm(); + if(form==NULL) + return; + uint16_t index = FrmGetObjectIndex(form,GetId()); + if(index==frmInvalidObjectId) + return; + FrmSetObjectBounds(form,index,&rect); +} + void wxControl::DoGetPosition( int *x, int *y ) const { RectangleType rect; @@ -306,6 +317,18 @@ void wxControl::DoGetSize( int *width, int *height ) const *height = rect.extent.y; } +void wxControl::DoMoveWindow(int x, int y, int width, int height) +{ + wxRect area = GetRect(); + RectangleType rect; + rect.topLeft.x = x; + rect.topLeft.y = y; + rect.extent.x = width; + rect.extent.y = height; + DoSetBounds(rect); + GetParent()->Refresh(true, &area); +} + bool wxControl::Enable(bool enable) { ControlType *control = (ControlType *)GetObjectPtr(); @@ -468,17 +491,4 @@ void wxControl::OnEraseBackground(wxEraseEvent& event) { } -WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) - ) -{ - return (WXHBRUSH)0; -} - -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- - #endif // wxUSE_CONTROLS diff --git a/src/palmos/datectrl.cpp b/src/palmos/datectrl.cpp new file mode 100644 index 0000000000..5461f6471d --- /dev/null +++ b/src/palmos/datectrl.cpp @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/datectrl.cpp +// Purpose: wxDatePickerCtrl implementation +// Author: Wlodzimierz ABX Skiba +// Modified by: +// Created: 02/14/05 +// RCS-ID: $Id$ +// Copyright: (c) Wlodzimierz Skiba +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + +#if wxUSE_DATEPICKCTRL + +#include "wx/datectrl.h" +#include "wx/app.h" +#include "wx/intl.h" +#include "wx/dynlib.h" + +#define _WX_DEFINE_DATE_EVENTS_ +#include "wx/dateevt.h" + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl creation +// ---------------------------------------------------------------------------- + +bool wxDatePickerCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxDateTime& dt, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + if(!wxControl::Create(parent, id, pos, size, style, validator, name)) + return false; + + wxString label; + + if ( dt.IsValid() ) + label = _T("test2"); + + ig(!wxControl::PalmCreateControl(selectorTriggerCtl, label, pos, size)) + return false; + + return true; +} + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl geometry +// ---------------------------------------------------------------------------- + +wxSize wxDatePickerCtrl::DoGetBestSize() const +{ + const int y = GetCharHeight(); + + return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y)); +} + +// ---------------------------------------------------------------------------- +// wxDatePickerCtrl operations +// ---------------------------------------------------------------------------- + +void wxDatePickerCtrl::SetValue(const wxDateTime& dt) +{ + SetLabel(_T("test1")); +} + +wxDateTime wxDatePickerCtrl::GetValue() const +{ + wxDateTime dt; + // TODO + return dt; +} + +void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2) +{ + // TODO +} + +bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const +{ + // TODO + return false; +} + +#endif // wxUSE_DATEPICKCTRL + diff --git a/src/palmos/dcclient.cpp b/src/palmos/dcclient.cpp index ae1340f40e..643514095a 100644 --- a/src/palmos/dcclient.cpp +++ b/src/palmos/dcclient.cpp @@ -42,14 +42,14 @@ struct WXDLLEXPORT wxPaintDCInfo { wxPaintDCInfo(wxWindow *win, wxDC *dc) { - hwnd = win->GetHWND(); - hdc = dc->GetHDC(); - count = 1; + handle = win->GetWinHandle(); + hdc = dc->GetHDC(); + count = 1; } - WXHWND hwnd; // window for this DC - WXHDC hdc; // the DC handle - size_t count; // usage count + WXWINHANDLE handle; // window for this DC + WXHDC hdc; // the DC handle + size_t count; // usage count }; #include "wx/arrimpl.cpp" diff --git a/src/palmos/dialog.cpp b/src/palmos/dialog.cpp index c014f4ac35..d37c05cd61 100644 --- a/src/palmos/dialog.cpp +++ b/src/palmos/dialog.cpp @@ -105,8 +105,6 @@ BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) - EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) - EVT_CLOSE(wxDialog::OnCloseWindow) END_EVENT_TABLE() @@ -160,23 +158,6 @@ bool wxDialog::Create(wxWindow *parent, return false; } -// deprecated ctor -wxDialog::wxDialog(wxWindow *parent, - const wxString& title, - bool WXUNUSED(modal), - int x, - int y, - int w, - int h, - long style, - const wxString& name) -{ -} - -void wxDialog::SetModal(bool WXUNUSED(flag)) -{ -} - wxDialog::~wxDialog() { } @@ -185,11 +166,6 @@ wxDialog::~wxDialog() // showing the dialogs // ---------------------------------------------------------------------------- -bool wxDialog::IsModalShowing() const -{ - return false; -} - wxWindow *wxDialog::FindSuitableParent() const { return NULL; @@ -234,16 +210,3 @@ void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { } - -void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) -{ -} - -// --------------------------------------------------------------------------- -// dialog window proc -// --------------------------------------------------------------------------- - -WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} diff --git a/src/palmos/frame.cpp b/src/palmos/frame.cpp index 6015a059d3..3704c42d46 100644 --- a/src/palmos/frame.cpp +++ b/src/palmos/frame.cpp @@ -70,7 +70,6 @@ // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) - EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) EVT_PAINT(wxFrame::OnPaint) END_EVENT_TABLE() @@ -232,11 +231,6 @@ bool wxFrame::HandleMenuSelect(EventType* event) #endif // wxUSE_MENUS_NATIVE -// Responds to colour changes, and passes event on to children. -void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -} - void wxFrame::OnPaint(wxPaintEvent& event) { #if wxUSE_STATUSBAR @@ -279,24 +273,6 @@ void wxFrame::IconizeChildFrames(bool bIconize) { } -// =========================================================================== -// message processing -// =========================================================================== - -// --------------------------------------------------------------------------- -// our private (non virtual) message handlers -// --------------------------------------------------------------------------- - -bool wxFrame::HandlePaint() -{ - return false; -} - -bool wxFrame::HandleSize(int x, int y, WXUINT id) -{ - return false; -} - // ---------------------------------------------------------------------------- // wxFrame size management: we exclude the areas taken by menu/status/toolbars // from the client area, so the client area is what's really available for the diff --git a/src/palmos/listctrl.cpp b/src/palmos/listctrl.cpp index 7c75e86ff9..97de7a90a9 100644 --- a/src/palmos/listctrl.cpp +++ b/src/palmos/listctrl.cpp @@ -191,11 +191,6 @@ void wxListCtrl::SetSingleStyle(long style, bool add) { } -// Set the whole window style -void wxListCtrl::SetWindowStyleFlag(long flag) -{ -} - // ---------------------------------------------------------------------------- // accessors // ---------------------------------------------------------------------------- diff --git a/src/palmos/mdi.cpp b/src/palmos/mdi.cpp index 69dc5e5421..5fe6e7cfae 100644 --- a/src/palmos/mdi.cpp +++ b/src/palmos/mdi.cpp @@ -137,7 +137,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_SIZE(wxMDIParentFrame::OnSize) - EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) END_EVENT_TABLE() BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) @@ -201,12 +200,6 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() return new wxMDIClientWindow; } -// Responds to colour changes, and passes event on to children. -void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) -{ - event.Skip(); -} - WXHICON wxMDIParentFrame::GetDefaultIcon() const { // we don't have any standard icons (any more) @@ -248,16 +241,6 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, return 0; } -bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate) -{ - return false; -} - -bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) -{ - return false; -} - WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) @@ -340,11 +323,6 @@ WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message, return 0; } -bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) -{ - return false; -} - bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), WXHWND hwndAct, WXHWND hwndDeact) @@ -357,11 +335,6 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) return false; } -bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) -{ - return false; -} - // --------------------------------------------------------------------------- // MDI specific message translation/preprocessing // --------------------------------------------------------------------------- diff --git a/src/palmos/nativdlg.cpp b/src/palmos/nativdlg.cpp index 38eb31d488..6574ad25a5 100644 --- a/src/palmos/nativdlg.cpp +++ b/src/palmos/nativdlg.cpp @@ -72,13 +72,13 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id) // create wxWin window from a native HWND // --------------------------------------------------------------------------- -wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) +wxWindow* wxWindow::CreateWindowFromWinHandle(wxWindow* parent, WXWINHANDLE handle) { return NULL; } -// Make sure the window style (etc.) reflects the HWND style (roughly) -void wxWindow::AdoptAttributesFromHWND(void) +// Make sure the window style (etc.) reflects the WinHandle style (roughly) +void wxWindow::AdoptAttributesFromWinHandle(void) { } diff --git a/src/palmos/scrolbar.cpp b/src/palmos/scrolbar.cpp index 13637860f4..cfb72880e8 100644 --- a/src/palmos/scrolbar.cpp +++ b/src/palmos/scrolbar.cpp @@ -120,12 +120,6 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS } -WXHBRUSH wxScrollBar::OnCtlColor(WXHDC WXUNUSED(pDC), WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam)) -{ - return 0; -} - void wxScrollBar::Command(wxCommandEvent& event) { } diff --git a/src/palmos/slider.cpp b/src/palmos/slider.cpp index 40c6220183..2f344b1261 100644 --- a/src/palmos/slider.cpp +++ b/src/palmos/slider.cpp @@ -117,7 +117,6 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, // wxSL_RIGHT is ignored - always off // wxSL_TOP is ignored - always off // wxSL_SELRANGE is ignored - always off - // wxSL_INVERSE is ignored - always off // wxSL_VERTICAL is impossible in native form wxCHECK_MSG(!(style & wxSL_VERTICAL), false, _T("non vertical slider on PalmOS")); @@ -196,6 +195,14 @@ int wxSlider::GetPageSize() const return ret; } +int wxSlider::PalmInvertOrNot(int value) const +{ + if (m_windowStyle & wxSL_INVERSE) + return (GetMax() + GetMin()) - value; + else + return value; +} + int wxSlider::GetValue() const { ControlType *control = (ControlType *)GetObjectPtr(); @@ -203,12 +210,12 @@ int wxSlider::GetValue() const return 0; uint16_t ret; CtlGetSliderValues(control, NULL, NULL, NULL, &ret); - return ret; + return PalmInvertOrNot(ret); } void wxSlider::SetValue(int value) { - SetIntValue(value); + SetIntValue(PalmInvertOrNot(value)); m_oldValue = m_oldPos = value; } @@ -328,7 +335,7 @@ bool wxSlider::SendUpdatedEvent() bool wxSlider::SendScrollEvent(EventType* event) { wxEventType scrollEvent; - int newPos = event->data.ctlRepeat.value; + int newPos = PalmInvertOrNot(event->data.ctlRepeat.value); if ( newPos == m_oldPos ) { // nothing changed since last event diff --git a/src/palmos/statbrpalm.cpp b/src/palmos/statbrpalm.cpp index 567076d39c..f662696fdf 100644 --- a/src/palmos/statbrpalm.cpp +++ b/src/palmos/statbrpalm.cpp @@ -48,8 +48,6 @@ wxStatusBarPalm::wxStatusBarPalm() { SetParent(NULL); - m_hWnd = 0; - m_windowId = 0; } bool wxStatusBarPalm::Create(wxWindow *parent, @@ -68,7 +66,6 @@ bool wxStatusBarPalm::Create(wxWindow *parent, parent->AddChild(this); SetFieldsCount(1); - SubclassWin(m_hWnd); return true; } diff --git a/src/palmos/tabctrl.cpp b/src/palmos/tabctrl.cpp index 0fa7c888cf..b9afda7b3d 100644 --- a/src/palmos/tabctrl.cpp +++ b/src/palmos/tabctrl.cpp @@ -37,7 +37,6 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) - EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged) END_EVENT_TABLE() wxTabCtrl::wxTabCtrl() @@ -59,11 +58,6 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) return false; } -// Responds to colour changes, and passes event on to children. -void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -} - // Delete all items bool wxTabCtrl::DeleteAllItems() { diff --git a/src/palmos/textctrl.cpp b/src/palmos/textctrl.cpp index 8e4bf4b8c6..ed4f70fcbf 100644 --- a/src/palmos/textctrl.cpp +++ b/src/palmos/textctrl.cpp @@ -217,20 +217,11 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, return false; } -// Make sure the window style (etc.) reflects the HWND style (roughly) -void wxTextCtrl::AdoptAttributesFromHWND() -{ -} - WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const { return 0; } -void wxTextCtrl::SetWindowStyleFlag(long style) -{ -} - // ---------------------------------------------------------------------------- // set/get the controls text // ---------------------------------------------------------------------------- @@ -567,15 +558,6 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return false; } -WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) - ) -{ - return (WXHBRUSH) 0; -} - bool wxTextCtrl::AdjustSpaceLimit() { return false; diff --git a/src/palmos/toolbar.cpp b/src/palmos/toolbar.cpp index b3ee1228d4..8a483b74f5 100644 --- a/src/palmos/toolbar.cpp +++ b/src/palmos/toolbar.cpp @@ -93,7 +93,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent) - EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged) END_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -248,14 +247,6 @@ void wxToolBar::UpdateSize() { } -// ---------------------------------------------------------------------------- -// toolbar styles -// --------------------------------------------------------------------------- - -void wxToolBar::SetWindowStyleFlag(long style) -{ -} - // ---------------------------------------------------------------------------- // tool state // ---------------------------------------------------------------------------- @@ -276,11 +267,6 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog // event handlers // ---------------------------------------------------------------------------- -// Responds to colour changes, and passes event on to children. -void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event) -{ -} - void wxToolBar::OnMouseEvent(wxMouseEvent& event) { } diff --git a/src/palmos/toplevel.cpp b/src/palmos/toplevel.cpp index 52116b2db9..6e62444228 100644 --- a/src/palmos/toplevel.cpp +++ b/src/palmos/toplevel.cpp @@ -80,11 +80,6 @@ WXDWORD wxTopLevelWindowPalm::PalmGetStyle(long style, WXDWORD *exflags) const return 0; } -WXHWND wxTopLevelWindowPalm::PalmGetParent() const -{ - return NULL; -} - bool wxTopLevelWindowPalm::Create(wxWindow *parent, wxWindowID id, const wxString& title, @@ -147,6 +142,18 @@ wxTopLevelWindowPalm::~wxTopLevelWindowPalm() { } +// --------------------------------------------------------------------------- +// implementation +// --------------------------------------------------------------------------- + +WXWINHANDLE wxTopLevelWindowPalm::GetWinHandle() const +{ + FormType *form = GetForm(); + if(form) + return FrmGetWindowHandle(form); + return 0; +} + // ---------------------------------------------------------------------------- // wxTopLevelWindowPalm showing // ---------------------------------------------------------------------------- @@ -233,15 +240,11 @@ FormType *wxTopLevelWindowPalm::GetForm() const return FrmGetActiveForm(); } -#ifndef __WXWINCE__ - bool wxTopLevelWindowPalm::SetShape(const wxRegion& region) { return false; } -#endif // !__WXWINCE__ - // ---------------------------------------------------------------------------- // wxTopLevelWindow native event handling // ---------------------------------------------------------------------------- diff --git a/src/palmos/utilsgui.cpp b/src/palmos/utilsgui.cpp index 011d22ada7..eaab8f03b1 100644 --- a/src/palmos/utilsgui.cpp +++ b/src/palmos/utilsgui.cpp @@ -152,28 +152,3 @@ void wxDisplaySizeMM(int *width, int *height) void wxClientDisplayRect(int *x, int *y, int *width, int *height) { } - -// --------------------------------------------------------------------------- -// window information functions -// --------------------------------------------------------------------------- - -wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) -{ - wxString str; - - return str; -} - -wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) -{ - wxString str; - - return str; -} - -WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) -{ - return 0; -} - - diff --git a/src/palmos/window.cpp b/src/palmos/window.cpp index 6ecb274dfa..b46aad8784 100644 --- a/src/palmos/window.cpp +++ b/src/palmos/window.cpp @@ -93,10 +93,6 @@ wxMenu *wxCurrentPopupMenu = NULL; #endif // wxUSE_MENUS_NATIVE -// true if we had already created the std colour map, used by -// wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT) -static bool gs_hasStdCmap = false; - // --------------------------------------------------------------------------- // private functions // --------------------------------------------------------------------------- @@ -218,7 +214,6 @@ wxCONSTRUCTOR_DUMMY(wxWindow) BEGIN_EVENT_TABLE(wxWindowPalm, wxWindowBase) EVT_ERASE_BACKGROUND(wxWindowPalm::OnEraseBackground) - EVT_SYS_COLOUR_CHANGED(wxWindowPalm::OnSysColourChanged) EVT_INIT_DIALOG(wxWindowPalm::OnInitDialog) END_EVENT_TABLE() @@ -237,23 +232,19 @@ wxWindow *wxWindowPalm::FindItem(long id) const } // Find an item given the MS Windows handle -wxWindow *wxWindowPalm::FindItemByHWND(WXHWND hWnd, bool controlOnly) const +wxWindow *wxWindowPalm::FindItemByWinHandle(WXWINHANDLE handle, bool controlOnly) const { + // TODO return NULL; } -// Default command handler -bool wxWindowPalm::PalmCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) -{ - return false; -} - // ---------------------------------------------------------------------------- // constructors and such // ---------------------------------------------------------------------------- void wxWindowPalm::Init() { + m_handle = 0; } // Destructor @@ -263,11 +254,11 @@ wxWindowPalm::~wxWindowPalm() // real construction (Init() must have been called before!) bool wxWindowPalm::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") ); @@ -417,31 +408,10 @@ bool wxWindowPalm::ScrollPages(int pages) return false; } -// --------------------------------------------------------------------------- -// subclassing -// --------------------------------------------------------------------------- - -void wxWindowPalm::SubclassWin(WXHWND hWnd) -{ -} - -void wxWindowPalm::UnsubclassWin() -{ -} - -bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) -{ - return false; -} - // ---------------------------------------------------------------------------- // Style handling // ---------------------------------------------------------------------------- -void wxWindowPalm::SetWindowStyleFlag(long flags) -{ -} - WXDWORD wxWindowPalm::PalmGetStyle(long flags, WXDWORD *exstyle) const { return 0; @@ -452,11 +422,6 @@ void wxWindowPalm::SetupColours() { } -bool wxWindowPalm::IsMouseInWindow() const -{ - return false; -} - void wxWindowPalm::OnInternalIdle() { } @@ -477,6 +442,23 @@ void wxWindowPalm::Thaw() void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect) { + WinHandle handle = GetWinHandle(); + if(handle) + { + if(rect) + { + RectangleType dirtyRect; + dirtyRect.topLeft.x = rect->GetX(); + dirtyRect.topLeft.y = rect->GetY(); + dirtyRect.extent.x = rect->GetWidth(); + dirtyRect.extent.y = rect->GetHeight(); + WinInvalidateRect(handle, &dirtyRect); + } + else + { + WinInvalidateWindow(handle); + } + } } void wxWindowPalm::Update() @@ -552,6 +534,61 @@ void wxWindowPalm::DoMoveWindow(int x, int y, int width, int height) // width/height void wxWindowPalm::DoSetSize(int x, int y, int width, int height, int sizeFlags) { + // get the current size and position... + int currentX, currentY; + GetPosition(¤tX, ¤tY); + int currentW,currentH; + GetSize(¤tW, ¤tH); + + // ... and don't do anything (avoiding flicker) if it's already ok + if ( x == currentX && y == currentY && + width == currentW && height == currentH ) + { + return; + } + + if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + x = currentX; + if ( y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + y = currentY; + + AdjustForParentClientOrigin(x, y, sizeFlags); + + wxSize size = wxDefaultSize; + if ( width == wxDefaultCoord ) + { + if ( sizeFlags & wxSIZE_AUTO_WIDTH ) + { + size = DoGetBestSize(); + width = size.x; + } + else + { + // just take the current one + width = currentW; + } + } + + if ( height == wxDefaultCoord ) + { + if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) + { + if ( size.x == wxDefaultCoord ) + { + size = DoGetBestSize(); + } + //else: already called DoGetBestSize() above + + height = size.y; + } + else + { + // just take the current one + height = currentH; + } + } + + DoMoveWindow(x, y, width, height); } void wxWindowPalm::DoSetClientSize(int width, int height) @@ -601,60 +638,15 @@ bool wxWindowPalm::DoPopupMenu(wxMenu *menu, int x, int y) #endif // wxUSE_MENUS_NATIVE -// =========================================================================== -// pre/post message processing -// =========================================================================== - -WXLRESULT wxWindowPalm::PalmDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - -bool wxWindowPalm::PalmProcessMessage(WXMSG* pMsg) -{ - return false; -} - -bool wxWindowPalm::PalmTranslateMessage(WXMSG* pMsg) -{ - return false; -} - -bool wxWindowPalm::PalmShouldPreProcessMessage(WXMSG* WXUNUSED(pMsg)) -{ - return false; -} - -// --------------------------------------------------------------------------- -// Main wxWidgets window proc and the window proc for wxWindow -// --------------------------------------------------------------------------- - -// Hook for new window just as it's being created, when the window isn't yet -// associated with the handle - -// implementation of wxWindowCreationHook class: it just sets gs_winBeingCreated to the -// window being created and insures that it's always unset back later -wxWindowCreationHook::wxWindowCreationHook(wxWindowPalm *winBeingCreated) -{ -} - -wxWindowCreationHook::~wxWindowCreationHook() -{ -} - -WXLRESULT wxWindowPalm::PalmWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - // ---------------------------------------------------------------------------- // wxWindow <-> HWND map // ---------------------------------------------------------------------------- wxWinHashTable *wxWinHandleHash = NULL; -wxWindow *wxFindWinFromHandle(WXHWND hWnd) +wxWindow *wxFindWinFromWinHandle(WXWINHANDLE handle) { + // TODO return NULL; } @@ -663,34 +655,23 @@ void wxRemoveHandleAssociation(wxWindowPalm *win) } // ---------------------------------------------------------------------------- -// various Palm speciic class dependent functions +// various Palm specific class dependent functions // ---------------------------------------------------------------------------- -// Default destroyer - override if you destroy it in some other way -// (e.g. with MDI child windows) -void wxWindowPalm::PalmDestroyWindow() -{ -} - bool wxWindowPalm::PalmGetCreateWindowCoords(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h) const + const wxSize& size, + int& x, int& y, + int& w, int& h) const { return false; } -WXHWND wxWindowPalm::PalmGetParent() const -{ - return NULL; -} - bool wxWindowPalm::PalmCreate(const wxChar *wclass, - const wxChar *title, - const wxPoint& pos, - const wxSize& size, - WXDWORD style, - WXDWORD extendedStyle) + const wxChar *title, + const wxPoint& pos, + const wxSize& size, + WXDWORD style, + WXDWORD extendedStyle) { return false; } @@ -699,183 +680,15 @@ bool wxWindowPalm::PalmCreate(const wxChar *wclass, // Palm message handlers // =========================================================================== -// --------------------------------------------------------------------------- -// end session messages -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleQueryEndSession(long logOff, bool *mayEnd) -{ - return false; -} - -bool wxWindowPalm::HandleEndSession(bool endSession, long logOff) -{ - return false; -} - -// --------------------------------------------------------------------------- -// window creation/destruction -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) -{ - return false; -} - -bool wxWindowPalm::HandleDestroy() -{ - return false; -} - -// --------------------------------------------------------------------------- -// activation/focus -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleActivate(int state, - bool WXUNUSED(minimized), - WXHWND WXUNUSED(activate)) -{ - return false; -} - -bool wxWindowPalm::HandleSetFocus(WXHWND hwnd) -{ - return false; -} - -bool wxWindowPalm::HandleKillFocus(WXHWND hwnd) -{ - return false; -} - -// --------------------------------------------------------------------------- -// miscellaneous -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleShow(bool show, int WXUNUSED(status)) -{ - return false; -} - -bool wxWindowPalm::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) -{ - return false; -} - -bool wxWindowPalm::HandleDropFiles(WXWPARAM wParam) -{ - return false; -} - - -bool wxWindowPalm::HandleSetCursor(WXHWND WXUNUSED(hWnd), - short nHitTest, - int WXUNUSED(mouseMsg)) -{ - return false; -} - -// --------------------------------------------------------------------------- -// owner drawn stuff -// --------------------------------------------------------------------------- - -#if (wxUSE_OWNER_DRAWN && wxUSE_MENUS_NATIVE) || \ - (wxUSE_CONTROLS && !defined(__WXUNIVERSAL__)) - #define WXUNUSED_UNLESS_ODRAWN(param) param -#else - #define WXUNUSED_UNLESS_ODRAWN(param) -#endif - -bool -wxWindowPalm::PalmOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), - WXDRAWITEMSTRUCT * WXUNUSED_UNLESS_ODRAWN(itemStruct)) -{ - return false; -} - -bool -wxWindowPalm::PalmOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id), - WXMEASUREITEMSTRUCT * - WXUNUSED_UNLESS_ODRAWN(itemStruct)) -{ - return false; -} - -// --------------------------------------------------------------------------- -// colours and palettes -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleSysColorChange() -{ - return false; -} - -bool wxWindowPalm::HandleDisplayChange() -{ - return false; -} - -bool wxWindowPalm::HandleCtlColor(WXHBRUSH *brush, - WXHDC pDC, - WXHWND pWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam) -{ - return false; -} - -// Define for each class of dialog and control -WXHBRUSH wxWindowPalm::OnCtlColor(WXHDC WXUNUSED(hDC), - WXHWND WXUNUSED(hWnd), - WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam)) -{ - return (WXHBRUSH)0; -} - -bool wxWindowPalm::HandlePaletteChanged(WXHWND hWndPalChange) -{ - return false; -} - -bool wxWindowPalm::HandleCaptureChanged(WXHWND hWndGainedCapture) -{ - return false; -} - -bool wxWindowPalm::HandleQueryNewPalette() -{ - return false; -} - -// Responds to colour changes: passes event on to children. -void wxWindowPalm::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) -{ -} - // --------------------------------------------------------------------------- // painting // --------------------------------------------------------------------------- -bool wxWindowPalm::HandlePaint() -{ - return false; -} - // Can be called from an application's OnPaint handler void wxWindowPalm::OnPaint(wxPaintEvent& event) { } -bool wxWindowPalm::HandleEraseBkgnd(WXHDC hdc) -{ - return false; -} - void wxWindowPalm::OnEraseBackground(wxEraseEvent& event) { } @@ -884,16 +697,6 @@ void wxWindowPalm::OnEraseBackground(wxEraseEvent& event) // moving and resizing // --------------------------------------------------------------------------- -bool wxWindowPalm::HandleMinimize() -{ - return false; -} - -bool wxWindowPalm::HandleMaximize() -{ - return false; -} - bool wxWindowPalm::HandleMove(int x, int y) { return false; @@ -904,106 +707,6 @@ bool wxWindowPalm::HandleMoving(wxRect& rect) return false; } -bool wxWindowPalm::HandleSize(int WXUNUSED(w), int WXUNUSED(h), - WXUINT WXUNUSED(flag)) -{ - return false; -} - -bool wxWindowPalm::HandleSizing(wxRect& rect) -{ - return false; -} - -bool wxWindowPalm::HandleGetMinMaxInfo(void *mmInfo) -{ - return false; -} - -// --------------------------------------------------------------------------- -// command messages -// --------------------------------------------------------------------------- - -bool wxWindowPalm::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) -{ - return false; -} - -// --------------------------------------------------------------------------- -// mouse events -// --------------------------------------------------------------------------- - -void wxWindowPalm::InitMouseEvent(wxMouseEvent& event, - int x, int y, - WXUINT flags) -{ -} - -// Windows doesn't send the mouse events to the static controls (which are -// transparent in the sense that their WM_NCHITTEST handler returns -// HTTRANSPARENT) at all but we want all controls to receive the mouse events -// and so we manually check if we don't have a child window under mouse and if -// we do, send the event to it instead of the window Windows had sent WM_XXX -// to. -// -// Notice that this is not done for the mouse move events because this could -// (would?) be too slow, but only for clicks which means that the static texts -// still don't get move, enter nor leave events. -static wxWindowPalm *FindWindowForMouseEvent(wxWindowPalm *win, int *x, int *y) //TW:REQ:Univ -{ - return NULL; -} - -bool wxWindowPalm::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags) -{ - return false; -} - -bool wxWindowPalm::HandleMouseMove(int x, int y, WXUINT flags) -{ - return false; -} - - -bool wxWindowPalm::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - - -// --------------------------------------------------------------------------- -// keyboard handling -// --------------------------------------------------------------------------- - -// create the key event of the given type for the given key - used by -// HandleChar and HandleKeyDown/Up -wxKeyEvent wxWindowPalm::CreateKeyEvent(wxEventType evType, - int id, - WXLPARAM lParam, - WXWPARAM wParam) const -{ - wxKeyEvent event(evType); - - return event; -} - -// isASCII is true only when we're called from WM_CHAR handler and not from -// WM_KEYDOWN one -bool wxWindowPalm::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII) -{ - return false; -} - -bool wxWindowPalm::HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - -bool wxWindowPalm::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - // --------------------------------------------------------------------------- // joystick // --------------------------------------------------------------------------- @@ -1018,8 +721,9 @@ bool wxWindowPalm::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) // --------------------------------------------------------------------------- bool wxWindowPalm::PalmOnScroll(int orientation, WXWORD wParam, - WXWORD pos, WXHWND control) + WXWORD pos, WXWINHANDLE control) { + // TODO return false; } @@ -1027,53 +731,9 @@ bool wxWindowPalm::PalmOnScroll(int orientation, WXWORD wParam, // global functions // =========================================================================== -void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) +void wxGetCharSize(WXWINHANDLE wnd, int *x, int *y, const wxFont *the_font) { -} - -// Returns 0 if was a normal ASCII value, not a special key. This indicates that -// the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead. -int wxCharCodePalmToWX(int keySym, WXLPARAM lParam) -{ - return 0; -} - -int wxCharCodeWXToPalm(int id, bool *isVirtual) -{ - return 0; -} - -bool wxGetKeyState(wxKeyCode key) -{ - return false; -} - -wxWindow *wxGetActiveWindow() -{ - return NULL; -} - -extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) -{ - return NULL; -} - -// Find the wxWindow at the current mouse position, returning the mouse -// position. -wxWindow* wxFindWindowAtPointer(wxPoint& pt) -{ - return NULL; -} - -wxWindow* wxFindWindowAtPoint(const wxPoint& pt) -{ - return NULL; -} - -// Get the current mouse position. -wxPoint wxGetMousePosition() -{ - return wxPoint(0, 0); + // TODO } #if wxUSE_HOTKEY @@ -1088,15 +748,6 @@ bool wxWindowPalm::UnregisterHotKey(int hotkeyId) return false; } -#if wxUSE_ACCEL - -bool wxWindowPalm::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) -{ - return false; -} - -#endif // wxUSE_ACCEL - #endif // wxUSE_HOTKEY -- 2.47.2