]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/window.h
aeb2a5f9a96520a3aab37c1bb82e15b92d6f385e
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/window.h
3 // Purpose: wxWindow class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - more than minimal functionality
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ---------------------------------------------------------------------------
17 // ---------------------------------------------------------------------------
19 // [at least] some version of Windows send extra mouse move messages after
20 // a mouse click or a key press - to temporarily fix this problem, set the
23 // a better solution should be found later...
24 #define wxUSE_MOUSEEVENT_HACK 0
26 // ---------------------------------------------------------------------------
27 // wxWindow declaration for Palm
28 // ---------------------------------------------------------------------------
30 class WXDLLEXPORT wxWindowPalm
: public wxWindowBase
33 wxWindowPalm() { Init(); }
35 wxWindowPalm(wxWindow
*parent
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
40 const wxString
& name
= wxPanelNameStr
)
43 Create(parent
, id
, pos
, size
, style
, name
);
46 virtual ~wxWindowPalm();
48 bool Create(wxWindow
*parent
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
53 const wxString
& name
= wxPanelNameStr
);
55 // implement base class pure virtuals
57 virtual void SetLabel( const wxString
& label
);
58 virtual wxString
GetLabel() const;
63 virtual bool Show( bool show
= true );
64 virtual bool Enable( bool enable
= true );
66 virtual void SetFocus();
67 virtual void SetFocusFromKbd();
69 virtual bool Reparent(wxWindowBase
*newParent
);
71 virtual void WarpPointer(int x
, int y
);
73 virtual void Refresh( bool eraseBackground
= true,
74 const wxRect
*rect
= NULL
);
75 virtual void Update();
76 virtual void Freeze();
79 virtual bool SetCursor( const wxCursor
&cursor
);
80 virtual bool SetFont( const wxFont
&font
);
82 virtual int GetCharHeight() const;
83 virtual int GetCharWidth() const;
84 virtual void GetTextExtent(const wxString
& string
,
86 int *descent
= (int *) NULL
,
87 int *externalLeading
= (int *) NULL
,
88 const wxFont
*theFont
= (const wxFont
*) NULL
)
91 #if wxUSE_MENUS_NATIVE
92 virtual bool DoPopupMenu( wxMenu
*menu
, int x
, int y
);
93 #endif // wxUSE_MENUS_NATIVE
95 virtual void SetScrollbar( int orient
, int pos
, int thumbVisible
,
96 int range
, bool refresh
= true );
97 virtual void SetScrollPos( int orient
, int pos
, bool refresh
= true );
98 virtual int GetScrollPos( int orient
) const;
99 virtual int GetScrollThumb( int orient
) const;
100 virtual int GetScrollRange( int orient
) const;
101 virtual void ScrollWindow( int dx
, int dy
,
102 const wxRect
* rect
= (wxRect
*) NULL
);
104 virtual bool ScrollLines(int lines
);
105 virtual bool ScrollPages(int pages
);
107 #if wxUSE_DRAG_AND_DROP
108 virtual void SetDropTarget( wxDropTarget
*dropTarget
);
109 #endif // wxUSE_DRAG_AND_DROP
111 // Accept files for dragging
112 virtual void DragAcceptFiles(bool accept
);
114 #ifndef __WXUNIVERSAL__
115 // Native resource loading (implemented in src/Palm/nativdlg.cpp)
116 // FIXME: should they really be all virtual?
117 virtual bool LoadNativeDialog(wxWindow
* parent
, wxWindowID
& id
);
118 virtual bool LoadNativeDialog(wxWindow
* parent
, const wxString
& name
);
119 wxWindow
* GetWindowChild1(wxWindowID id
);
120 wxWindow
* GetWindowChild(wxWindowID id
);
121 #endif // __WXUNIVERSAL__
124 // install and deinstall a system wide hotkey
125 virtual bool RegisterHotKey(int hotkeyId
, int modifiers
, int keycode
);
126 virtual bool UnregisterHotKey(int hotkeyId
);
127 #endif // wxUSE_HOTKEY
129 // implementation from now on
130 // --------------------------
135 WXHWND
GetHWND() const { return m_hWnd
; }
136 void SetHWND(WXHWND hWnd
) { m_hWnd
= hWnd
; }
137 virtual WXWidget
GetHandle() const { return GetHWND(); }
142 void OnEraseBackground(wxEraseEvent
& event
);
143 void OnPaint(wxPaintEvent
& event
);
146 wxWindow
*FindItem(long id
) const;
147 wxWindow
*FindItemByWinHandle(WXWINHANDLE handle
, bool controlOnly
= false) const;
149 // Palm only: true if this control is part of the main control
150 virtual bool ContainsWinHandle(WXWINHANDLE
WXUNUSED(handle
)) const { return false; };
152 // translate wxWidgets style flags for this control into the Windows style
153 // and optional extended style for the corresponding native control
155 // this is the function that should be overridden in the derived classes,
156 // but you will mostly use PalmGetCreateWindowFlags() below
157 virtual WXDWORD
PalmGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const ;
159 // get the Palm window flags corresponding to wxWidgets ones
161 // the functions returns the flags (WS_XXX) directly and puts the ext
162 // (WS_EX_XXX) flags into the provided pointer if not NULL
163 WXDWORD
PalmGetCreateWindowFlags(WXDWORD
*exflags
= NULL
) const
164 { return PalmGetStyle(GetWindowStyle(), exflags
); }
166 // translate wxWidgets coords into Windows ones suitable to be passed to
169 // returns true if non default coords are returned, false otherwise
170 bool PalmGetCreateWindowCoords(const wxPoint
& pos
,
173 int& w
, int& h
) const;
175 // creates the window of specified Windows class with given style, extended
176 // style, title and geometry (default values
178 // returns true if the window has been created, false if creation failed
179 bool PalmCreate(const wxChar
*wclass
,
180 const wxChar
*title
= NULL
,
181 const wxPoint
& pos
= wxDefaultPosition
,
182 const wxSize
& size
= wxDefaultSize
,
184 WXDWORD exendedStyle
= 0);
186 #ifndef __WXUNIVERSAL__
187 // Create an appropriate wxWindow from a WinHandle
188 virtual wxWindow
* CreateWindowFromWinHandle(wxWindow
* parent
, WXWINHANDLE handle
);
190 // Make sure the window style reflects the WinHandle style (roughly)
191 virtual void AdoptAttributesFromWinHandle();
192 #endif // __WXUNIVERSAL__
194 // Setup background and foreground colours correctly
195 virtual void SetupColours();
197 // ------------------------------------------------------------------------
198 // internal handlers for Palm messages: all handlers return a boolean value:
199 // true means that the handler processed the event and false that it didn't
200 // ------------------------------------------------------------------------
202 // scroll event (both horizontal and vertical)
203 virtual bool PalmOnScroll(int orientation
, WXWORD nSBCode
,
204 WXWORD pos
, WXWINHANDLE control
);
206 // virtual function for implementing internal idle
208 virtual void OnInternalIdle() ;
215 WXFORMPTR
GetFormPtr();
216 void SetFormPtr(WXFORMPTR FormPtr
);
218 // additional (Palm specific) flags
219 bool m_mouseInWindow
:1;
220 bool m_lastKeydownProcessed
:1;
222 // the size of one page for scrolling
226 #if wxUSE_MOUSEEVENT_HACK
227 // the coordinates of the last mouse event and the type of it
230 int m_lastMouseEvent
;
231 #endif // wxUSE_MOUSEEVENT_HACK
233 WXHMENU m_hMenu
; // Menu, if any
235 // implement the base class pure virtuals
236 virtual void DoClientToScreen( int *x
, int *y
) const;
237 virtual void DoScreenToClient( int *x
, int *y
) const;
238 virtual void DoGetPosition( int *x
, int *y
) const;
239 virtual void DoGetSize( int *width
, int *height
) const;
240 virtual void DoGetClientSize( int *width
, int *height
) const;
241 virtual void DoSetSize(int x
, int y
,
242 int width
, int height
,
243 int sizeFlags
= wxSIZE_AUTO
);
244 virtual void DoSetClientSize(int width
, int height
);
246 virtual void DoCaptureMouse();
247 virtual void DoReleaseMouse();
249 // move the window to the specified location and resize it: this is called
250 // from both DoSetSize() and DoSetClientSize() and would usually just call
251 // ::MoveWindow() except for composite controls which will want to arrange
252 // themselves inside the given rectangle
253 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
256 virtual void DoSetToolTip( wxToolTip
*tip
);
258 // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in
259 // comctl32.dll in our code -- see the function body for more info)
260 bool HandleTooltipNotify(WXUINT code
,
262 const wxString
& ttip
);
263 #endif // wxUSE_TOOLTIPS
266 // common part of all ctors
269 // the (non-virtual) handlers for the events
270 bool HandleMove(int x
, int y
);
271 bool HandleMoving(wxRect
& rect
);
272 bool HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
);
274 // number of calls to Freeze() minus number of calls to Thaw()
275 unsigned int m_frozenness
;
277 DECLARE_DYNAMIC_CLASS(wxWindowPalm
)
278 DECLARE_NO_COPY_CLASS(wxWindowPalm
)
279 DECLARE_EVENT_TABLE()
282 // ----------------------------------------------------------------------------
284 // ----------------------------------------------------------------------------
286 // notice that this hash must be defined after wxWindow declaration as it
287 // needs to "see" its dtor and not just forward declaration
290 // pseudo-template WinHandle <-> wxWindow hash table
291 WX_DECLARE_HASH(wxWindowPalm
, wxWindowList
, wxWinHashTable
);
293 extern wxWinHashTable
*wxWinHandleHash
;