1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/windows.cpp
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "window.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/window.h"
37 #include "wx/dcclient.h"
38 #include "wx/dcmemory.h"
41 #include "wx/layout.h"
42 #include "wx/dialog.h"
44 #include "wx/listbox.h"
45 #include "wx/button.h"
46 #include "wx/msgdlg.h"
47 #include "wx/settings.h"
48 #include "wx/statbox.h"
51 #if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__)
52 #include "wx/ownerdrw.h"
55 #include "wx/module.h"
57 #if wxUSE_DRAG_AND_DROP
61 #if wxUSE_ACCESSIBILITY
62 #include "wx/access.h"
65 #include "wx/menuitem.h"
69 #include "wx/tooltip.h"
77 #include "wx/spinctrl.h"
78 #endif // wxUSE_SPINCTRL
83 #include "wx/textctrl.h"
84 #include "wx/notebook.h"
85 #include "wx/listctrl.h"
89 #include "wx/palmos/window.h"
91 // ---------------------------------------------------------------------------
93 // ---------------------------------------------------------------------------
95 #if wxUSE_MENUS_NATIVE
96 wxMenu
*wxCurrentPopupMenu
= NULL
;
97 #endif // wxUSE_MENUS_NATIVE
100 extern wxChar
*wxCanvasClassName
;
102 extern const wxChar
*wxCanvasClassName
;
105 // true if we had already created the std colour map, used by
106 // wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT)
107 static bool gs_hasStdCmap
= false;
109 // ---------------------------------------------------------------------------
111 // ---------------------------------------------------------------------------
113 // ---------------------------------------------------------------------------
115 // ---------------------------------------------------------------------------
117 // in wxUniv/Palm this class is abstract because it doesn't have DoPopupMenu()
119 #ifdef __WXUNIVERSAL__
120 IMPLEMENT_ABSTRACT_CLASS(wxWindowPalm
, wxWindowBase
)
122 #if wxUSE_EXTENDED_RTTI
124 // windows that are created from a parent window during its Create method, eg. spin controls in a calendar controls
125 // must never been streamed out separately otherwise chaos occurs. Right now easiest is to test for negative ids, as
126 // windows with negative ids never can be recreated anyway
128 bool wxWindowStreamingCallback( const wxObject
*object
, wxWriter
* , wxPersister
* , wxxVariantArray
& )
133 IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow
, wxWindowBase
,"wx/window.h", wxWindowStreamingCallback
)
135 // make wxWindowList known before the property is used
137 wxCOLLECTION_TYPE_INFO( wxWindow
* , wxWindowList
) ;
139 template<> void wxCollectionToVariantArray( wxWindowList
const &theList
, wxxVariantArray
&value
)
141 wxListCollectionToVariantArray
<wxWindowList::compatibility_iterator
>( theList
, value
) ;
144 WX_DEFINE_FLAGS( wxWindowStyle
)
146 wxBEGIN_FLAGS( wxWindowStyle
)
147 // new style border flags, we put them first to
148 // use them for streaming out
150 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
151 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
152 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
153 wxFLAGS_MEMBER(wxBORDER_RAISED
)
154 wxFLAGS_MEMBER(wxBORDER_STATIC
)
155 wxFLAGS_MEMBER(wxBORDER_NONE
)
157 // old style border flags
158 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
159 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
160 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
161 wxFLAGS_MEMBER(wxRAISED_BORDER
)
162 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
163 wxFLAGS_MEMBER(wxBORDER
)
165 // standard window styles
166 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
167 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
168 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
169 wxFLAGS_MEMBER(wxWANTS_CHARS
)
170 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
171 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
172 wxFLAGS_MEMBER(wxVSCROLL
)
173 wxFLAGS_MEMBER(wxHSCROLL
)
175 wxEND_FLAGS( wxWindowStyle
)
177 wxBEGIN_PROPERTIES_TABLE(wxWindow
)
178 wxEVENT_PROPERTY( Close
, wxEVT_CLOSE_WINDOW
, wxCloseEvent
)
179 wxEVENT_PROPERTY( Create
, wxEVT_CREATE
, wxWindowCreateEvent
)
180 wxEVENT_PROPERTY( Destroy
, wxEVT_DESTROY
, wxWindowDestroyEvent
)
181 // Always constructor Properties first
183 wxREADONLY_PROPERTY( Parent
,wxWindow
*, GetParent
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
184 wxPROPERTY( Id
,wxWindowID
, SetId
, GetId
, wxID_ANY
, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
185 wxPROPERTY( Position
,wxPoint
, SetPosition
, GetPosition
, wxDefaultPosition
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos
186 wxPROPERTY( Size
,wxSize
, SetSize
, GetSize
, wxDefaultSize
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size
187 wxPROPERTY( WindowStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
189 // Then all relations of the object graph
191 wxREADONLY_PROPERTY_COLLECTION( Children
, wxWindowList
, wxWindowBase
* , GetWindowChildren
, wxPROP_OBJECT_GRAPH
/*flags*/ , wxT("Helpstring") , wxT("group"))
193 // and finally all other properties
195 wxPROPERTY( ExtraStyle
, long , SetExtraStyle
, GetExtraStyle
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // extstyle
196 wxPROPERTY( BackgroundColour
, wxColour
, SetBackgroundColour
, GetBackgroundColour
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // bg
197 wxPROPERTY( ForegroundColour
, wxColour
, SetForegroundColour
, GetForegroundColour
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // fg
198 wxPROPERTY( Enabled
, bool , Enable
, IsEnabled
, wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
199 wxPROPERTY( Shown
, bool , Show
, IsShown
, wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
201 // possible property candidates (not in xrc) or not valid in all subclasses
202 wxPROPERTY( Title
,wxString
, SetTitle
, GetTitle
, wxT("") )
203 wxPROPERTY( Font
, wxFont
, SetFont
, GetWindowFont
, )
204 wxPROPERTY( Label
,wxString
, SetLabel
, GetLabel
, wxT("") )
205 // MaxHeight, Width , MinHeight , Width
206 // TODO switch label to control and title to toplevels
208 wxPROPERTY( ThemeEnabled
, bool , SetThemeEnabled
, GetThemeEnabled
, )
209 //wxPROPERTY( Cursor , wxCursor , SetCursor , GetCursor , )
210 // wxPROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , )
211 wxPROPERTY( AutoLayout
, bool , SetAutoLayout
, GetAutoLayout
, )
216 wxEND_PROPERTIES_TABLE()
218 wxBEGIN_HANDLERS_TABLE(wxWindow
)
219 wxEND_HANDLERS_TABLE()
221 wxCONSTRUCTOR_DUMMY(wxWindow
)
224 IMPLEMENT_DYNAMIC_CLASS(wxWindow
, wxWindowBase
)
226 #endif // __WXUNIVERSAL__/__WXPalm__
228 BEGIN_EVENT_TABLE(wxWindowPalm
, wxWindowBase
)
229 EVT_ERASE_BACKGROUND(wxWindowPalm::OnEraseBackground
)
230 EVT_SYS_COLOUR_CHANGED(wxWindowPalm::OnSysColourChanged
)
231 EVT_INIT_DIALOG(wxWindowPalm::OnInitDialog
)
234 // ===========================================================================
236 // ===========================================================================
238 // ---------------------------------------------------------------------------
239 // wxWindow utility functions
240 // ---------------------------------------------------------------------------
242 // Find an item given the MS Windows id
243 wxWindow
*wxWindowPalm::FindItem(long id
) const
248 // Find an item given the MS Windows handle
249 wxWindow
*wxWindowPalm::FindItemByHWND(WXHWND hWnd
, bool controlOnly
) const
254 // Default command handler
255 bool wxWindowPalm::PalmCommand(WXUINT
WXUNUSED(param
), WXWORD
WXUNUSED(id
))
260 // ----------------------------------------------------------------------------
261 // constructors and such
262 // ----------------------------------------------------------------------------
264 void wxWindowPalm::Init()
269 wxWindowPalm::~wxWindowPalm()
273 // real construction (Init() must have been called before!)
274 bool wxWindowPalm::Create(wxWindow
*parent
,
279 const wxString
& name
)
284 FormType
*wxWindowPalm::GetFormPtr()
288 void wxWindowPalm::SetFormPtr(FormType
*FormPtr
)
293 // ---------------------------------------------------------------------------
295 // ---------------------------------------------------------------------------
297 void wxWindowPalm::SetFocus()
301 void wxWindowPalm::SetFocusFromKbd()
305 // Get the window with the focus
306 wxWindow
*wxWindowBase::DoFindFocus()
311 bool wxWindowPalm::Enable(bool enable
)
316 bool wxWindowPalm::Show(bool show
)
321 // Raise the window to the top of the Z order
322 void wxWindowPalm::Raise()
326 // Lower the window to the bottom of the Z order
327 void wxWindowPalm::Lower()
331 void wxWindowPalm::SetTitle( const wxString
& title
)
335 wxString
wxWindowPalm::GetTitle() const
340 void wxWindowPalm::DoCaptureMouse()
344 void wxWindowPalm::DoReleaseMouse()
348 /* static */ wxWindow
*wxWindowBase::GetCapture()
353 bool wxWindowPalm::SetFont(const wxFont
& font
)
357 bool wxWindowPalm::SetCursor(const wxCursor
& cursor
)
362 void wxWindowPalm::WarpPointer (int x
, int y
)
366 // ---------------------------------------------------------------------------
368 // ---------------------------------------------------------------------------
370 // convert wxHORIZONTAL/wxVERTICAL to SB_HORZ/SB_VERT
371 static inline int wxDirToWinStyle(int orient
)
376 int wxWindowPalm::GetScrollPos(int orient
) const
381 // This now returns the whole range, not just the number
382 // of positions that we can scroll.
383 int wxWindowPalm::GetScrollRange(int orient
) const
388 int wxWindowPalm::GetScrollThumb(int orient
) const
393 void wxWindowPalm::SetScrollPos(int orient
, int pos
, bool refresh
)
397 // New function that will replace some of the above.
398 void wxWindowPalm::SetScrollbar(int orient
,
406 void wxWindowPalm::ScrollWindow(int dx
, int dy
, const wxRect
*prect
)
410 bool wxWindowPalm::ScrollLines(int lines
)
415 bool wxWindowPalm::ScrollPages(int pages
)
420 // ---------------------------------------------------------------------------
422 // ---------------------------------------------------------------------------
424 void wxWindowPalm::SubclassWin(WXHWND hWnd
)
428 void wxWindowPalm::UnsubclassWin()
432 bool wxCheckWindowWndProc(WXHWND hWnd
, WXFARPROC wndProc
)
437 // ----------------------------------------------------------------------------
439 // ----------------------------------------------------------------------------
441 void wxWindowPalm::SetWindowStyleFlag(long flags
)
445 WXDWORD
wxWindowPalm::PalmGetStyle(long flags
, WXDWORD
*exstyle
) const
450 // Setup background and foreground colours correctly
451 void wxWindowPalm::SetupColours()
455 bool wxWindowPalm::IsMouseInWindow() const
460 void wxWindowPalm::OnInternalIdle()
464 // Set this window to be the child of 'parent'.
465 bool wxWindowPalm::Reparent(wxWindowBase
*parent
)
470 void wxWindowPalm::Freeze()
474 void wxWindowPalm::Thaw()
478 void wxWindowPalm::Refresh(bool eraseBack
, const wxRect
*rect
)
482 void wxWindowPalm::Update()
486 // ---------------------------------------------------------------------------
488 // ---------------------------------------------------------------------------
491 #if wxUSE_DRAG_AND_DROP
492 void wxWindowPalm::SetDropTarget(wxDropTarget
*pDropTarget
)
495 #endif // wxUSE_DRAG_AND_DROP
497 // old style file-manager drag&drop support: we retain the old-style
498 // DragAcceptFiles in parallel with SetDropTarget.
499 void wxWindowPalm::DragAcceptFiles(bool accept
)
503 // ----------------------------------------------------------------------------
505 // ----------------------------------------------------------------------------
509 void wxWindowPalm::DoSetToolTip(wxToolTip
*tooltip
)
513 #endif // wxUSE_TOOLTIPS
515 // ---------------------------------------------------------------------------
516 // moving and resizing
517 // ---------------------------------------------------------------------------
520 void wxWindowPalm::DoGetSize(int *x
, int *y
) const
524 // Get size *available for subwindows* i.e. excluding menu bar etc.
525 void wxWindowPalm::DoGetClientSize(int *x
, int *y
) const
529 void wxWindowPalm::DoGetPosition(int *x
, int *y
) const
533 void wxWindowPalm::DoScreenToClient(int *x
, int *y
) const
537 void wxWindowPalm::DoClientToScreen(int *x
, int *y
) const
541 void wxWindowPalm::DoMoveWindow(int x
, int y
, int width
, int height
)
545 // set the size of the window: if the dimensions are positive, just use them,
546 // but if any of them is equal to -1, it means that we must find the value for
547 // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in
548 // which case -1 is a valid value for x and y)
550 // If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate
551 // the width/height to best suit our contents, otherwise we reuse the current
553 void wxWindowPalm::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
557 void wxWindowPalm::DoSetClientSize(int width
, int height
)
561 // For implementation purposes - sometimes decorations make the client area
563 wxPoint
wxWindowPalm::GetClientAreaOrigin() const
565 return wxPoint(0, 0);
568 // ---------------------------------------------------------------------------
570 // ---------------------------------------------------------------------------
572 int wxWindowPalm::GetCharHeight() const
577 int wxWindowPalm::GetCharWidth() const
582 void wxWindowPalm::GetTextExtent(const wxString
& string
,
584 int *descent
, int *externalLeading
,
585 const wxFont
*theFont
) const
589 // ---------------------------------------------------------------------------
591 // ---------------------------------------------------------------------------
593 #if wxUSE_MENUS_NATIVE
595 // yield for WM_COMMAND events only, i.e. process all WM_COMMANDs in the queue
596 // immediately, without waiting for the next event loop iteration
598 // NB: this function should probably be made public later as it can almost
599 // surely replace wxYield() elsewhere as well
600 static void wxYieldForCommandsOnly()
604 bool wxWindowPalm::DoPopupMenu(wxMenu
*menu
, int x
, int y
)
609 #endif // wxUSE_MENUS_NATIVE
611 // ===========================================================================
612 // pre/post message processing
613 // ===========================================================================
615 WXLRESULT
wxWindowPalm::PalmDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
620 bool wxWindowPalm::PalmProcessMessage(WXMSG
* pMsg
)
625 bool wxWindowPalm::PalmTranslateMessage(WXMSG
* pMsg
)
630 bool wxWindowPalm::PalmShouldPreProcessMessage(WXMSG
* WXUNUSED(pMsg
))
635 // ---------------------------------------------------------------------------
636 // Main wxWidgets window proc and the window proc for wxWindow
637 // ---------------------------------------------------------------------------
639 // Hook for new window just as it's being created, when the window isn't yet
640 // associated with the handle
642 // implementation of wxWindowCreationHook class: it just sets gs_winBeingCreated to the
643 // window being created and insures that it's always unset back later
644 wxWindowCreationHook::wxWindowCreationHook(wxWindowPalm
*winBeingCreated
)
648 wxWindowCreationHook::~wxWindowCreationHook()
652 WXLRESULT
wxWindowPalm::PalmWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
657 // ----------------------------------------------------------------------------
658 // wxWindow <-> HWND map
659 // ----------------------------------------------------------------------------
661 wxWinHashTable
*wxWinHandleHash
= NULL
;
663 wxWindow
*wxFindWinFromHandle(WXHWND hWnd
)
668 void wxRemoveHandleAssociation(wxWindowPalm
*win
)
672 // ----------------------------------------------------------------------------
673 // various Palm speciic class dependent functions
674 // ----------------------------------------------------------------------------
676 // Default destroyer - override if you destroy it in some other way
677 // (e.g. with MDI child windows)
678 void wxWindowPalm::PalmDestroyWindow()
682 bool wxWindowPalm::PalmGetCreateWindowCoords(const wxPoint
& pos
,
685 int& w
, int& h
) const
690 WXHWND
wxWindowPalm::PalmGetParent() const
695 bool wxWindowPalm::PalmCreate(const wxChar
*wclass
,
700 WXDWORD extendedStyle
)
705 // ===========================================================================
706 // Palm message handlers
707 // ===========================================================================
709 // ---------------------------------------------------------------------------
711 // ---------------------------------------------------------------------------
715 bool wxWindowPalm::HandleNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
)
722 bool wxWindowPalm::HandleTooltipNotify(WXUINT code
,
724 const wxString
& ttip
)
729 #endif // wxUSE_TOOLTIPS
731 bool wxWindowPalm::PalmOnNotify(int WXUNUSED(idCtrl
),
733 WXLPARAM
* WXUNUSED(result
))
740 // ---------------------------------------------------------------------------
741 // end session messages
742 // ---------------------------------------------------------------------------
744 bool wxWindowPalm::HandleQueryEndSession(long logOff
, bool *mayEnd
)
749 bool wxWindowPalm::HandleEndSession(bool endSession
, long logOff
)
754 // ---------------------------------------------------------------------------
755 // window creation/destruction
756 // ---------------------------------------------------------------------------
758 bool wxWindowPalm::HandleCreate(WXLPCREATESTRUCT cs
, bool *mayCreate
)
763 bool wxWindowPalm::HandleDestroy()
768 // ---------------------------------------------------------------------------
770 // ---------------------------------------------------------------------------
772 bool wxWindowPalm::HandleActivate(int state
,
773 bool WXUNUSED(minimized
),
774 WXHWND
WXUNUSED(activate
))
779 bool wxWindowPalm::HandleSetFocus(WXHWND hwnd
)
784 bool wxWindowPalm::HandleKillFocus(WXHWND hwnd
)
789 // ---------------------------------------------------------------------------
791 // ---------------------------------------------------------------------------
793 bool wxWindowPalm::HandleShow(bool show
, int WXUNUSED(status
))
798 bool wxWindowPalm::HandleInitDialog(WXHWND
WXUNUSED(hWndFocus
))
803 bool wxWindowPalm::HandleDropFiles(WXWPARAM wParam
)
809 bool wxWindowPalm::HandleSetCursor(WXHWND
WXUNUSED(hWnd
),
811 int WXUNUSED(mouseMsg
))
816 // ---------------------------------------------------------------------------
818 // ---------------------------------------------------------------------------
820 #if (wxUSE_OWNER_DRAWN && wxUSE_MENUS_NATIVE) || \
821 (wxUSE_CONTROLS && !defined(__WXUNIVERSAL__))
822 #define WXUNUSED_UNLESS_ODRAWN(param) param
824 #define WXUNUSED_UNLESS_ODRAWN(param)
828 wxWindowPalm::PalmOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id
),
829 WXDRAWITEMSTRUCT
* WXUNUSED_UNLESS_ODRAWN(itemStruct
))
835 wxWindowPalm::PalmOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id
),
836 WXMEASUREITEMSTRUCT
*
837 WXUNUSED_UNLESS_ODRAWN(itemStruct
))
842 // ---------------------------------------------------------------------------
843 // colours and palettes
844 // ---------------------------------------------------------------------------
846 bool wxWindowPalm::HandleSysColorChange()
851 bool wxWindowPalm::HandleDisplayChange()
856 bool wxWindowPalm::HandleCtlColor(WXHBRUSH
*brush
,
867 // Define for each class of dialog and control
868 WXHBRUSH
wxWindowPalm::OnCtlColor(WXHDC
WXUNUSED(hDC
),
869 WXHWND
WXUNUSED(hWnd
),
870 WXUINT
WXUNUSED(nCtlColor
),
871 WXUINT
WXUNUSED(message
),
872 WXWPARAM
WXUNUSED(wParam
),
873 WXLPARAM
WXUNUSED(lParam
))
878 bool wxWindowPalm::HandlePaletteChanged(WXHWND hWndPalChange
)
883 bool wxWindowPalm::HandleCaptureChanged(WXHWND hWndGainedCapture
)
888 bool wxWindowPalm::HandleQueryNewPalette()
893 // Responds to colour changes: passes event on to children.
894 void wxWindowPalm::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(event
))
898 // ---------------------------------------------------------------------------
900 // ---------------------------------------------------------------------------
902 bool wxWindowPalm::HandlePaint()
907 // Can be called from an application's OnPaint handler
908 void wxWindowPalm::OnPaint(wxPaintEvent
& event
)
912 bool wxWindowPalm::HandleEraseBkgnd(WXHDC hdc
)
917 void wxWindowPalm::OnEraseBackground(wxEraseEvent
& event
)
921 // ---------------------------------------------------------------------------
922 // moving and resizing
923 // ---------------------------------------------------------------------------
925 bool wxWindowPalm::HandleMinimize()
930 bool wxWindowPalm::HandleMaximize()
935 bool wxWindowPalm::HandleMove(int x
, int y
)
940 bool wxWindowPalm::HandleMoving(wxRect
& rect
)
945 bool wxWindowPalm::HandleSize(int WXUNUSED(w
), int WXUNUSED(h
),
946 WXUINT
WXUNUSED(flag
))
951 bool wxWindowPalm::HandleSizing(wxRect
& rect
)
956 bool wxWindowPalm::HandleGetMinMaxInfo(void *mmInfo
)
961 // ---------------------------------------------------------------------------
963 // ---------------------------------------------------------------------------
965 bool wxWindowPalm::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
970 // ---------------------------------------------------------------------------
972 // ---------------------------------------------------------------------------
974 void wxWindowPalm::InitMouseEvent(wxMouseEvent
& event
,
980 // Windows doesn't send the mouse events to the static controls (which are
981 // transparent in the sense that their WM_NCHITTEST handler returns
982 // HTTRANSPARENT) at all but we want all controls to receive the mouse events
983 // and so we manually check if we don't have a child window under mouse and if
984 // we do, send the event to it instead of the window Windows had sent WM_XXX
987 // Notice that this is not done for the mouse move events because this could
988 // (would?) be too slow, but only for clicks which means that the static texts
989 // still don't get move, enter nor leave events.
990 static wxWindowPalm
*FindWindowForMouseEvent(wxWindowPalm
*win
, int *x
, int *y
) //TW:REQ:Univ
995 bool wxWindowPalm::HandleMouseEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
1000 bool wxWindowPalm::HandleMouseMove(int x
, int y
, WXUINT flags
)
1006 bool wxWindowPalm::HandleMouseWheel(WXWPARAM wParam
, WXLPARAM lParam
)
1012 // ---------------------------------------------------------------------------
1013 // keyboard handling
1014 // ---------------------------------------------------------------------------
1016 // create the key event of the given type for the given key - used by
1017 // HandleChar and HandleKeyDown/Up
1018 wxKeyEvent
wxWindowPalm::CreateKeyEvent(wxEventType evType
,
1021 WXWPARAM wParam
) const
1023 wxKeyEvent
event(evType
);
1028 // isASCII is true only when we're called from WM_CHAR handler and not from
1030 bool wxWindowPalm::HandleChar(WXWPARAM wParam
, WXLPARAM lParam
, bool isASCII
)
1035 bool wxWindowPalm::HandleKeyDown(WXWPARAM wParam
, WXLPARAM lParam
)
1040 bool wxWindowPalm::HandleKeyUp(WXWPARAM wParam
, WXLPARAM lParam
)
1045 int wxWindowPalm::HandleMenuChar(int chAccel
, WXLPARAM lParam
)
1050 // ---------------------------------------------------------------------------
1052 // ---------------------------------------------------------------------------
1054 bool wxWindowPalm::HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
)
1059 // ---------------------------------------------------------------------------
1061 // ---------------------------------------------------------------------------
1063 bool wxWindowPalm::PalmOnScroll(int orientation
, WXWORD wParam
,
1064 WXWORD pos
, WXHWND control
)
1069 // ===========================================================================
1071 // ===========================================================================
1073 void wxGetCharSize(WXHWND wnd
, int *x
, int *y
, const wxFont
*the_font
)
1077 // Returns 0 if was a normal ASCII value, not a special key. This indicates that
1078 // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
1079 int wxCharCodePalmToWX(int keySym
, WXLPARAM lParam
)
1084 int wxCharCodeWXToPalm(int id
, bool *isVirtual
)
1089 bool wxGetKeyState(wxKeyCode key
)
1094 wxWindow
*wxGetActiveWindow()
1099 extern wxWindow
*wxGetWindowFromHWND(WXHWND hWnd
)
1104 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
1106 void wxSetKeyboardHook(bool doIt
)
1110 #endif // !__WXMICROWIN__
1113 const char *wxGetMessageName(int message
)
1117 #endif //__WXDEBUG__
1119 // Find the wxWindow at the current mouse position, returning the mouse
1121 wxWindow
* wxFindWindowAtPointer(wxPoint
& pt
)
1126 wxWindow
* wxFindWindowAtPoint(const wxPoint
& pt
)
1131 // Get the current mouse position.
1132 wxPoint
wxGetMousePosition()
1134 return wxPoint(0, 0);
1139 bool wxWindowPalm::RegisterHotKey(int hotkeyId
, int modifiers
, int keycode
)
1144 bool wxWindowPalm::UnregisterHotKey(int hotkeyId
)
1151 bool wxWindowPalm::HandleHotKey(WXWPARAM wParam
, WXLPARAM lParam
)
1156 #endif // wxUSE_ACCEL
1158 #endif // wxUSE_HOTKEY