]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/window.h
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
20 #pragma interface "window.h"
23 // [at least] some version of Windows send extra mouse move messages after
24 // a mouse click or a key press - to temporarily fix this problem, set the
27 // a better solution should be found later...
28 #define wxUSE_MOUSEEVENT_HACK 0
30 // ---------------------------------------------------------------------------
31 // wxWindow declaration for Palm
32 // ---------------------------------------------------------------------------
34 class WXDLLEXPORT wxWindowPalm
: public wxWindowBase
37 wxWindowPalm() { Init(); }
39 wxWindowPalm(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
44 const wxString
& name
= wxPanelNameStr
)
47 Create(parent
, id
, pos
, size
, style
, name
);
50 virtual ~wxWindowPalm();
52 bool Create(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
57 const wxString
& name
= wxPanelNameStr
);
59 // implement base class pure virtuals
60 virtual void SetTitle( const wxString
& title
);
61 virtual wxString
GetTitle() const;
66 virtual bool Show( bool show
= true );
67 virtual bool Enable( bool enable
= true );
69 virtual void SetFocus();
70 virtual void SetFocusFromKbd();
72 virtual bool Reparent(wxWindowBase
*newParent
);
74 virtual void WarpPointer(int x
, int y
);
76 virtual void Refresh( bool eraseBackground
= true,
77 const wxRect
*rect
= NULL
);
78 virtual void Update();
79 virtual void Freeze();
82 virtual bool SetCursor( const wxCursor
&cursor
);
83 virtual bool SetFont( const wxFont
&font
);
85 virtual int GetCharHeight() const;
86 virtual int GetCharWidth() const;
87 virtual void GetTextExtent(const wxString
& string
,
89 int *descent
= (int *) NULL
,
90 int *externalLeading
= (int *) NULL
,
91 const wxFont
*theFont
= (const wxFont
*) NULL
)
94 #if wxUSE_MENUS_NATIVE
95 virtual bool DoPopupMenu( wxMenu
*menu
, int x
, int y
);
96 #endif // wxUSE_MENUS_NATIVE
98 virtual void SetScrollbar( int orient
, int pos
, int thumbVisible
,
99 int range
, bool refresh
= true );
100 virtual void SetScrollPos( int orient
, int pos
, bool refresh
= true );
101 virtual int GetScrollPos( int orient
) const;
102 virtual int GetScrollThumb( int orient
) const;
103 virtual int GetScrollRange( int orient
) const;
104 virtual void ScrollWindow( int dx
, int dy
,
105 const wxRect
* rect
= (wxRect
*) NULL
);
107 virtual bool ScrollLines(int lines
);
108 virtual bool ScrollPages(int pages
);
110 #if wxUSE_DRAG_AND_DROP
111 virtual void SetDropTarget( wxDropTarget
*dropTarget
);
112 #endif // wxUSE_DRAG_AND_DROP
114 // Accept files for dragging
115 virtual void DragAcceptFiles(bool accept
);
117 #ifndef __WXUNIVERSAL__
118 // Native resource loading (implemented in src/Palm/nativdlg.cpp)
119 // FIXME: should they really be all virtual?
120 virtual bool LoadNativeDialog(wxWindow
* parent
, wxWindowID
& id
);
121 virtual bool LoadNativeDialog(wxWindow
* parent
, const wxString
& name
);
122 wxWindow
* GetWindowChild1(wxWindowID id
);
123 wxWindow
* GetWindowChild(wxWindowID id
);
124 #endif // __WXUNIVERSAL__
127 // install and deinstall a system wide hotkey
128 virtual bool RegisterHotKey(int hotkeyId
, int modifiers
, int keycode
);
129 virtual bool UnregisterHotKey(int hotkeyId
);
130 #endif // wxUSE_HOTKEY
132 // implementation from now on
133 // --------------------------
138 virtual WXWINHANDLE
GetWinHandle() const { return m_handle
; }
139 virtual WXWidget
GetHandle() const { return GetWinHandle(); }
144 void OnEraseBackground(wxEraseEvent
& event
);
145 void OnPaint(wxPaintEvent
& event
);
148 wxWindow
*FindItem(long id
) const;
149 wxWindow
*FindItemByWinHandle(WXWINHANDLE handle
, bool controlOnly
= false) const;
151 // Palm only: true if this control is part of the main control
152 virtual bool ContainsWinHandle(WXWINHANDLE
WXUNUSED(handle
)) const { return false; };
154 // translate wxWidgets style flags for this control into the Windows style
155 // and optional extended style for the corresponding native control
157 // this is the function that should be overridden in the derived classes,
158 // but you will mostly use PalmGetCreateWindowFlags() below
159 virtual WXDWORD
PalmGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const ;
161 // get the Palm window flags corresponding to wxWidgets ones
163 // the functions returns the flags (WS_XXX) directly and puts the ext
164 // (WS_EX_XXX) flags into the provided pointer if not NULL
165 WXDWORD
PalmGetCreateWindowFlags(WXDWORD
*exflags
= NULL
) const
166 { return PalmGetStyle(GetWindowStyle(), exflags
); }
168 // translate wxWidgets coords into Windows ones suitable to be passed to
171 // returns true if non default coords are returned, false otherwise
172 bool PalmGetCreateWindowCoords(const wxPoint
& pos
,
175 int& w
, int& h
) const;
177 // creates the window of specified Windows class with given style, extended
178 // style, title and geometry (default values
180 // returns true if the window has been created, false if creation failed
181 bool PalmCreate(const wxChar
*wclass
,
182 const wxChar
*title
= NULL
,
183 const wxPoint
& pos
= wxDefaultPosition
,
184 const wxSize
& size
= wxDefaultSize
,
186 WXDWORD exendedStyle
= 0);
188 #ifndef __WXUNIVERSAL__
189 // Create an appropriate wxWindow from a WinHandle
190 virtual wxWindow
* CreateWindowFromWinHandle(wxWindow
* parent
, WXWINHANDLE handle
);
192 // Make sure the window style reflects the WinHandle style (roughly)
193 virtual void AdoptAttributesFromWinHandle();
194 #endif // __WXUNIVERSAL__
196 // Setup background and foreground colours correctly
197 virtual void SetupColours();
199 // ------------------------------------------------------------------------
200 // internal handlers for Palm messages: all handlers return a boolean value:
201 // true means that the handler processed the event and false that it didn't
202 // ------------------------------------------------------------------------
204 // scroll event (both horizontal and vertical)
205 virtual bool PalmOnScroll(int orientation
, WXWORD nSBCode
,
206 WXWORD pos
, WXWINHANDLE control
);
208 // virtual function for implementing internal idle
210 virtual void OnInternalIdle() ;
217 FormType
*GetFormPtr();
218 void SetFormPtr(FormType
*FormPtr
);
220 // additional (Palm specific) flags
221 bool m_mouseInWindow
:1;
222 bool m_lastKeydownProcessed
:1;
224 // the size of one page for scrolling
228 #if wxUSE_MOUSEEVENT_HACK
229 // the coordinates of the last mouse event and the type of it
232 int m_lastMouseEvent
;
233 #endif // wxUSE_MOUSEEVENT_HACK
235 WXHMENU m_hMenu
; // Menu, if any
237 // implement the base class pure virtuals
238 virtual void DoClientToScreen( int *x
, int *y
) const;
239 virtual void DoScreenToClient( int *x
, int *y
) const;
240 virtual void DoGetPosition( int *x
, int *y
) const;
241 virtual void DoGetSize( int *width
, int *height
) const;
242 virtual void DoGetClientSize( int *width
, int *height
) const;
243 virtual void DoSetSize(int x
, int y
,
244 int width
, int height
,
245 int sizeFlags
= wxSIZE_AUTO
);
246 virtual void DoSetClientSize(int width
, int height
);
248 virtual void DoCaptureMouse();
249 virtual void DoReleaseMouse();
251 // move the window to the specified location and resize it: this is called
252 // from both DoSetSize() and DoSetClientSize() and would usually just call
253 // ::MoveWindow() except for composite controls which will want to arrange
254 // themselves inside the given rectangle
255 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
258 virtual void DoSetToolTip( wxToolTip
*tip
);
260 // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in
261 // comctl32.dll in our code -- see the function body for more info)
262 bool HandleTooltipNotify(WXUINT code
,
264 const wxString
& ttip
);
265 #endif // wxUSE_TOOLTIPS
268 // common part of all ctors
271 // the (non-virtual) handlers for the events
272 bool HandleMove(int x
, int y
);
273 bool HandleMoving(wxRect
& rect
);
274 bool HandleJoystickEvent(WXUINT msg
, int x
, int y
, WXUINT flags
);
276 // list of disabled children before last call to our Disable()
277 wxWindowList
*m_childrenDisabled
;
279 // number of calls to Freeze() minus number of calls to Thaw()
280 unsigned int m_frozenness
;
282 DECLARE_DYNAMIC_CLASS(wxWindowPalm
)
283 DECLARE_NO_COPY_CLASS(wxWindowPalm
)
284 DECLARE_EVENT_TABLE()
287 // ----------------------------------------------------------------------------
289 // ----------------------------------------------------------------------------
291 // notice that this hash must be defined after wxWindow declaration as it
292 // needs to "see" its dtor and not just forward declaration
295 // pseudo-template WinHandle <-> wxWindow hash table
296 WX_DECLARE_HASH(wxWindowPalm
, wxWindowList
, wxWinHashTable
);
298 extern wxWinHashTable
*wxWinHandleHash
;