| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/palmos/windows.cpp |
| 3 | // Purpose: wxWindow |
| 4 | // Author: William Osborne - minimal working wxPalmOS port |
| 5 | // Modified by: Wlodzimierz ABX Skiba - more than minimal functionality |
| 6 | // Created: 10/13/04 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // =========================================================================== |
| 13 | // declarations |
| 14 | // =========================================================================== |
| 15 | |
| 16 | // --------------------------------------------------------------------------- |
| 17 | // headers |
| 18 | // --------------------------------------------------------------------------- |
| 19 | |
| 20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 21 | #pragma implementation "window.h" |
| 22 | #endif |
| 23 | |
| 24 | // For compilers that support precompilation, includes "wx.h". |
| 25 | #include "wx/wxprec.h" |
| 26 | |
| 27 | #ifdef __BORLANDC__ |
| 28 | #pragma hdrstop |
| 29 | #endif |
| 30 | |
| 31 | #ifndef WX_PRECOMP |
| 32 | #include "wx/window.h" |
| 33 | #include "wx/accel.h" |
| 34 | #include "wx/setup.h" |
| 35 | #include "wx/menu.h" |
| 36 | #include "wx/dc.h" |
| 37 | #include "wx/dcclient.h" |
| 38 | #include "wx/dcmemory.h" |
| 39 | #include "wx/utils.h" |
| 40 | #include "wx/app.h" |
| 41 | #include "wx/layout.h" |
| 42 | #include "wx/dialog.h" |
| 43 | #include "wx/frame.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" |
| 49 | #endif |
| 50 | |
| 51 | #if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) |
| 52 | #include "wx/ownerdrw.h" |
| 53 | #endif |
| 54 | |
| 55 | #include "wx/module.h" |
| 56 | |
| 57 | #if wxUSE_DRAG_AND_DROP |
| 58 | #include "wx/dnd.h" |
| 59 | #endif |
| 60 | |
| 61 | #if wxUSE_ACCESSIBILITY |
| 62 | #include "wx/access.h" |
| 63 | #endif |
| 64 | |
| 65 | #include "wx/menuitem.h" |
| 66 | #include "wx/log.h" |
| 67 | |
| 68 | #if wxUSE_TOOLTIPS |
| 69 | #include "wx/tooltip.h" |
| 70 | #endif |
| 71 | |
| 72 | #if wxUSE_CARET |
| 73 | #include "wx/caret.h" |
| 74 | #endif // wxUSE_CARET |
| 75 | |
| 76 | #if wxUSE_SPINCTRL |
| 77 | #include "wx/spinctrl.h" |
| 78 | #endif // wxUSE_SPINCTRL |
| 79 | |
| 80 | #include "wx/intl.h" |
| 81 | #include "wx/log.h" |
| 82 | |
| 83 | #include "wx/textctrl.h" |
| 84 | #include "wx/notebook.h" |
| 85 | #include "wx/listctrl.h" |
| 86 | #include "wx/window.h" |
| 87 | |
| 88 | // --------------------------------------------------------------------------- |
| 89 | // global variables |
| 90 | // --------------------------------------------------------------------------- |
| 91 | |
| 92 | #if wxUSE_MENUS_NATIVE |
| 93 | wxMenu *wxCurrentPopupMenu = NULL; |
| 94 | #endif // wxUSE_MENUS_NATIVE |
| 95 | |
| 96 | // true if we had already created the std colour map, used by |
| 97 | // wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT) |
| 98 | static bool gs_hasStdCmap = false; |
| 99 | |
| 100 | // --------------------------------------------------------------------------- |
| 101 | // private functions |
| 102 | // --------------------------------------------------------------------------- |
| 103 | |
| 104 | // --------------------------------------------------------------------------- |
| 105 | // event tables |
| 106 | // --------------------------------------------------------------------------- |
| 107 | |
| 108 | // in wxUniv/Palm this class is abstract because it doesn't have DoPopupMenu() |
| 109 | // method |
| 110 | #ifdef __WXUNIVERSAL__ |
| 111 | IMPLEMENT_ABSTRACT_CLASS(wxWindowPalm, wxWindowBase) |
| 112 | #else // __WXPalm__ |
| 113 | #if wxUSE_EXTENDED_RTTI |
| 114 | |
| 115 | // windows that are created from a parent window during its Create method, eg. spin controls in a calendar controls |
| 116 | // must never been streamed out separately otherwise chaos occurs. Right now easiest is to test for negative ids, as |
| 117 | // windows with negative ids never can be recreated anyway |
| 118 | |
| 119 | bool wxWindowStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & ) |
| 120 | { |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow, wxWindowBase,"wx/window.h", wxWindowStreamingCallback) |
| 125 | |
| 126 | // make wxWindowList known before the property is used |
| 127 | |
| 128 | wxCOLLECTION_TYPE_INFO( wxWindow* , wxWindowList ) ; |
| 129 | |
| 130 | template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value) |
| 131 | { |
| 132 | wxListCollectionToVariantArray<wxWindowList::compatibility_iterator>( theList , value ) ; |
| 133 | } |
| 134 | |
| 135 | WX_DEFINE_FLAGS( wxWindowStyle ) |
| 136 | |
| 137 | wxBEGIN_FLAGS( wxWindowStyle ) |
| 138 | // new style border flags, we put them first to |
| 139 | // use them for streaming out |
| 140 | |
| 141 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) |
| 142 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) |
| 143 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) |
| 144 | wxFLAGS_MEMBER(wxBORDER_RAISED) |
| 145 | wxFLAGS_MEMBER(wxBORDER_STATIC) |
| 146 | wxFLAGS_MEMBER(wxBORDER_NONE) |
| 147 | |
| 148 | // old style border flags |
| 149 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) |
| 150 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) |
| 151 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) |
| 152 | wxFLAGS_MEMBER(wxRAISED_BORDER) |
| 153 | wxFLAGS_MEMBER(wxSTATIC_BORDER) |
| 154 | wxFLAGS_MEMBER(wxBORDER) |
| 155 | |
| 156 | // standard window styles |
| 157 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) |
| 158 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) |
| 159 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) |
| 160 | wxFLAGS_MEMBER(wxWANTS_CHARS) |
| 161 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) |
| 162 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) |
| 163 | wxFLAGS_MEMBER(wxVSCROLL) |
| 164 | wxFLAGS_MEMBER(wxHSCROLL) |
| 165 | |
| 166 | wxEND_FLAGS( wxWindowStyle ) |
| 167 | |
| 168 | wxBEGIN_PROPERTIES_TABLE(wxWindow) |
| 169 | wxEVENT_PROPERTY( Close , wxEVT_CLOSE_WINDOW , wxCloseEvent) |
| 170 | wxEVENT_PROPERTY( Create , wxEVT_CREATE , wxWindowCreateEvent ) |
| 171 | wxEVENT_PROPERTY( Destroy , wxEVT_DESTROY , wxWindowDestroyEvent ) |
| 172 | // Always constructor Properties first |
| 173 | |
| 174 | wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) |
| 175 | wxPROPERTY( Id,wxWindowID, SetId, GetId, wxID_ANY, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) |
| 176 | wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxDefaultPosition , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos |
| 177 | wxPROPERTY( Size,wxSize, SetSize, GetSize, wxDefaultSize , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size |
| 178 | wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style |
| 179 | |
| 180 | // Then all relations of the object graph |
| 181 | |
| 182 | wxREADONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren , wxPROP_OBJECT_GRAPH /*flags*/ , wxT("Helpstring") , wxT("group")) |
| 183 | |
| 184 | // and finally all other properties |
| 185 | |
| 186 | wxPROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // extstyle |
| 187 | wxPROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // bg |
| 188 | wxPROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // fg |
| 189 | wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) |
| 190 | wxPROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) |
| 191 | #if 0 |
| 192 | // possible property candidates (not in xrc) or not valid in all subclasses |
| 193 | wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) |
| 194 | wxPROPERTY( Font , wxFont , SetFont , GetWindowFont , ) |
| 195 | wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) |
| 196 | // MaxHeight, Width , MinHeight , Width |
| 197 | // TODO switch label to control and title to toplevels |
| 198 | |
| 199 | wxPROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , ) |
| 200 | //wxPROPERTY( Cursor , wxCursor , SetCursor , GetCursor , ) |
| 201 | // wxPROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , ) |
| 202 | wxPROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , ) |
| 203 | |
| 204 | |
| 205 | |
| 206 | #endif |
| 207 | wxEND_PROPERTIES_TABLE() |
| 208 | |
| 209 | wxBEGIN_HANDLERS_TABLE(wxWindow) |
| 210 | wxEND_HANDLERS_TABLE() |
| 211 | |
| 212 | wxCONSTRUCTOR_DUMMY(wxWindow) |
| 213 | |
| 214 | #else |
| 215 | IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) |
| 216 | #endif |
| 217 | #endif // __WXUNIVERSAL__/__WXPalm__ |
| 218 | |
| 219 | BEGIN_EVENT_TABLE(wxWindowPalm, wxWindowBase) |
| 220 | EVT_ERASE_BACKGROUND(wxWindowPalm::OnEraseBackground) |
| 221 | EVT_SYS_COLOUR_CHANGED(wxWindowPalm::OnSysColourChanged) |
| 222 | EVT_INIT_DIALOG(wxWindowPalm::OnInitDialog) |
| 223 | END_EVENT_TABLE() |
| 224 | |
| 225 | // =========================================================================== |
| 226 | // implementation |
| 227 | // =========================================================================== |
| 228 | |
| 229 | // --------------------------------------------------------------------------- |
| 230 | // wxWindow utility functions |
| 231 | // --------------------------------------------------------------------------- |
| 232 | |
| 233 | // Find an item given the MS Windows id |
| 234 | wxWindow *wxWindowPalm::FindItem(long id) const |
| 235 | { |
| 236 | return NULL; |
| 237 | } |
| 238 | |
| 239 | // Find an item given the MS Windows handle |
| 240 | wxWindow *wxWindowPalm::FindItemByHWND(WXHWND hWnd, bool controlOnly) const |
| 241 | { |
| 242 | return NULL; |
| 243 | } |
| 244 | |
| 245 | // Default command handler |
| 246 | bool wxWindowPalm::PalmCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) |
| 247 | { |
| 248 | return false; |
| 249 | } |
| 250 | |
| 251 | // ---------------------------------------------------------------------------- |
| 252 | // constructors and such |
| 253 | // ---------------------------------------------------------------------------- |
| 254 | |
| 255 | void wxWindowPalm::Init() |
| 256 | { |
| 257 | } |
| 258 | |
| 259 | // Destructor |
| 260 | wxWindowPalm::~wxWindowPalm() |
| 261 | { |
| 262 | } |
| 263 | |
| 264 | // real construction (Init() must have been called before!) |
| 265 | bool wxWindowPalm::Create(wxWindow *parent, |
| 266 | wxWindowID id, |
| 267 | const wxPoint& pos, |
| 268 | const wxSize& size, |
| 269 | long style, |
| 270 | const wxString& name) |
| 271 | { |
| 272 | wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") ); |
| 273 | |
| 274 | if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) |
| 275 | return false; |
| 276 | |
| 277 | parent->AddChild(this); |
| 278 | |
| 279 | InheritAttributes(); |
| 280 | |
| 281 | return true; |
| 282 | } |
| 283 | |
| 284 | FormType *wxWindowPalm::GetFormPtr() |
| 285 | { |
| 286 | return FrameForm; |
| 287 | } |
| 288 | void wxWindowPalm::SetFormPtr(FormType *FormPtr) |
| 289 | { |
| 290 | FrameForm=FormPtr; |
| 291 | } |
| 292 | |
| 293 | // --------------------------------------------------------------------------- |
| 294 | // basic operations |
| 295 | // --------------------------------------------------------------------------- |
| 296 | |
| 297 | void wxWindowPalm::SetFocus() |
| 298 | { |
| 299 | } |
| 300 | |
| 301 | void wxWindowPalm::SetFocusFromKbd() |
| 302 | { |
| 303 | } |
| 304 | |
| 305 | // Get the window with the focus |
| 306 | wxWindow *wxWindowBase::DoFindFocus() |
| 307 | { |
| 308 | return NULL; |
| 309 | } |
| 310 | |
| 311 | bool wxWindowPalm::Enable(bool enable) |
| 312 | { |
| 313 | return false; |
| 314 | } |
| 315 | |
| 316 | bool wxWindowPalm::Show(bool show) |
| 317 | { |
| 318 | return false; |
| 319 | } |
| 320 | |
| 321 | // Raise the window to the top of the Z order |
| 322 | void wxWindowPalm::Raise() |
| 323 | { |
| 324 | } |
| 325 | |
| 326 | // Lower the window to the bottom of the Z order |
| 327 | void wxWindowPalm::Lower() |
| 328 | { |
| 329 | } |
| 330 | |
| 331 | void wxWindowPalm::SetTitle( const wxString& title) |
| 332 | { |
| 333 | } |
| 334 | |
| 335 | wxString wxWindowPalm::GetTitle() const |
| 336 | { |
| 337 | return wxEmptyString; |
| 338 | } |
| 339 | |
| 340 | void wxWindowPalm::DoCaptureMouse() |
| 341 | { |
| 342 | } |
| 343 | |
| 344 | void wxWindowPalm::DoReleaseMouse() |
| 345 | { |
| 346 | } |
| 347 | |
| 348 | /* static */ wxWindow *wxWindowBase::GetCapture() |
| 349 | { |
| 350 | return NULL; |
| 351 | } |
| 352 | |
| 353 | bool wxWindowPalm::SetFont(const wxFont& font) |
| 354 | { |
| 355 | return false; |
| 356 | } |
| 357 | bool wxWindowPalm::SetCursor(const wxCursor& cursor) |
| 358 | { |
| 359 | return false; |
| 360 | } |
| 361 | |
| 362 | void wxWindowPalm::WarpPointer (int x, int y) |
| 363 | { |
| 364 | } |
| 365 | |
| 366 | // --------------------------------------------------------------------------- |
| 367 | // scrolling stuff |
| 368 | // --------------------------------------------------------------------------- |
| 369 | |
| 370 | // convert wxHORIZONTAL/wxVERTICAL to SB_HORZ/SB_VERT |
| 371 | static inline int wxDirToWinStyle(int orient) |
| 372 | { |
| 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | int wxWindowPalm::GetScrollPos(int orient) const |
| 377 | { |
| 378 | return 0; |
| 379 | } |
| 380 | |
| 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 |
| 384 | { |
| 385 | return 0; |
| 386 | } |
| 387 | |
| 388 | int wxWindowPalm::GetScrollThumb(int orient) const |
| 389 | { |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | void wxWindowPalm::SetScrollPos(int orient, int pos, bool refresh) |
| 394 | { |
| 395 | } |
| 396 | |
| 397 | // New function that will replace some of the above. |
| 398 | void wxWindowPalm::SetScrollbar(int orient, |
| 399 | int pos, |
| 400 | int pageSize, |
| 401 | int range, |
| 402 | bool refresh) |
| 403 | { |
| 404 | } |
| 405 | |
| 406 | void wxWindowPalm::ScrollWindow(int dx, int dy, const wxRect *prect) |
| 407 | { |
| 408 | } |
| 409 | |
| 410 | bool wxWindowPalm::ScrollLines(int lines) |
| 411 | { |
| 412 | return false; |
| 413 | } |
| 414 | |
| 415 | bool wxWindowPalm::ScrollPages(int pages) |
| 416 | { |
| 417 | return false; |
| 418 | } |
| 419 | |
| 420 | // --------------------------------------------------------------------------- |
| 421 | // subclassing |
| 422 | // --------------------------------------------------------------------------- |
| 423 | |
| 424 | void wxWindowPalm::SubclassWin(WXHWND hWnd) |
| 425 | { |
| 426 | } |
| 427 | |
| 428 | void wxWindowPalm::UnsubclassWin() |
| 429 | { |
| 430 | } |
| 431 | |
| 432 | bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) |
| 433 | { |
| 434 | return false; |
| 435 | } |
| 436 | |
| 437 | // ---------------------------------------------------------------------------- |
| 438 | // Style handling |
| 439 | // ---------------------------------------------------------------------------- |
| 440 | |
| 441 | void wxWindowPalm::SetWindowStyleFlag(long flags) |
| 442 | { |
| 443 | } |
| 444 | |
| 445 | WXDWORD wxWindowPalm::PalmGetStyle(long flags, WXDWORD *exstyle) const |
| 446 | { |
| 447 | return 0; |
| 448 | } |
| 449 | |
| 450 | // Setup background and foreground colours correctly |
| 451 | void wxWindowPalm::SetupColours() |
| 452 | { |
| 453 | } |
| 454 | |
| 455 | bool wxWindowPalm::IsMouseInWindow() const |
| 456 | { |
| 457 | return false; |
| 458 | } |
| 459 | |
| 460 | void wxWindowPalm::OnInternalIdle() |
| 461 | { |
| 462 | } |
| 463 | |
| 464 | // Set this window to be the child of 'parent'. |
| 465 | bool wxWindowPalm::Reparent(wxWindowBase *parent) |
| 466 | { |
| 467 | return false; |
| 468 | } |
| 469 | |
| 470 | void wxWindowPalm::Freeze() |
| 471 | { |
| 472 | } |
| 473 | |
| 474 | void wxWindowPalm::Thaw() |
| 475 | { |
| 476 | } |
| 477 | |
| 478 | void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect) |
| 479 | { |
| 480 | } |
| 481 | |
| 482 | void wxWindowPalm::Update() |
| 483 | { |
| 484 | } |
| 485 | |
| 486 | // --------------------------------------------------------------------------- |
| 487 | // drag and drop |
| 488 | // --------------------------------------------------------------------------- |
| 489 | |
| 490 | |
| 491 | #if wxUSE_DRAG_AND_DROP |
| 492 | void wxWindowPalm::SetDropTarget(wxDropTarget *pDropTarget) |
| 493 | { |
| 494 | } |
| 495 | #endif // wxUSE_DRAG_AND_DROP |
| 496 | |
| 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) |
| 500 | { |
| 501 | } |
| 502 | |
| 503 | // ---------------------------------------------------------------------------- |
| 504 | // tooltips |
| 505 | // ---------------------------------------------------------------------------- |
| 506 | |
| 507 | #if wxUSE_TOOLTIPS |
| 508 | |
| 509 | void wxWindowPalm::DoSetToolTip(wxToolTip *tooltip) |
| 510 | { |
| 511 | } |
| 512 | |
| 513 | #endif // wxUSE_TOOLTIPS |
| 514 | |
| 515 | // --------------------------------------------------------------------------- |
| 516 | // moving and resizing |
| 517 | // --------------------------------------------------------------------------- |
| 518 | |
| 519 | // Get total size |
| 520 | void wxWindowPalm::DoGetSize(int *x, int *y) const |
| 521 | { |
| 522 | } |
| 523 | |
| 524 | // Get size *available for subwindows* i.e. excluding menu bar etc. |
| 525 | void wxWindowPalm::DoGetClientSize(int *x, int *y) const |
| 526 | { |
| 527 | } |
| 528 | |
| 529 | void wxWindowPalm::DoGetPosition(int *x, int *y) const |
| 530 | { |
| 531 | } |
| 532 | |
| 533 | void wxWindowPalm::DoScreenToClient(int *x, int *y) const |
| 534 | { |
| 535 | } |
| 536 | |
| 537 | void wxWindowPalm::DoClientToScreen(int *x, int *y) const |
| 538 | { |
| 539 | } |
| 540 | |
| 541 | void wxWindowPalm::DoMoveWindow(int x, int y, int width, int height) |
| 542 | { |
| 543 | } |
| 544 | |
| 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) |
| 549 | // |
| 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 |
| 552 | // width/height |
| 553 | void wxWindowPalm::DoSetSize(int x, int y, int width, int height, int sizeFlags) |
| 554 | { |
| 555 | } |
| 556 | |
| 557 | void wxWindowPalm::DoSetClientSize(int width, int height) |
| 558 | { |
| 559 | } |
| 560 | |
| 561 | // For implementation purposes - sometimes decorations make the client area |
| 562 | // smaller |
| 563 | wxPoint wxWindowPalm::GetClientAreaOrigin() const |
| 564 | { |
| 565 | return wxPoint(0, 0); |
| 566 | } |
| 567 | |
| 568 | // --------------------------------------------------------------------------- |
| 569 | // text metrics |
| 570 | // --------------------------------------------------------------------------- |
| 571 | |
| 572 | int wxWindowPalm::GetCharHeight() const |
| 573 | { |
| 574 | return 0; |
| 575 | } |
| 576 | |
| 577 | int wxWindowPalm::GetCharWidth() const |
| 578 | { |
| 579 | return 0; |
| 580 | } |
| 581 | |
| 582 | void wxWindowPalm::GetTextExtent(const wxString& string, |
| 583 | int *x, int *y, |
| 584 | int *descent, int *externalLeading, |
| 585 | const wxFont *theFont) const |
| 586 | { |
| 587 | } |
| 588 | |
| 589 | // --------------------------------------------------------------------------- |
| 590 | // popup menu |
| 591 | // --------------------------------------------------------------------------- |
| 592 | |
| 593 | #if wxUSE_MENUS_NATIVE |
| 594 | |
| 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 |
| 597 | // |
| 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() |
| 601 | { |
| 602 | } |
| 603 | |
| 604 | bool wxWindowPalm::DoPopupMenu(wxMenu *menu, int x, int y) |
| 605 | { |
| 606 | return false; |
| 607 | } |
| 608 | |
| 609 | #endif // wxUSE_MENUS_NATIVE |
| 610 | |
| 611 | // =========================================================================== |
| 612 | // pre/post message processing |
| 613 | // =========================================================================== |
| 614 | |
| 615 | WXLRESULT wxWindowPalm::PalmDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) |
| 616 | { |
| 617 | return false; |
| 618 | } |
| 619 | |
| 620 | bool wxWindowPalm::PalmProcessMessage(WXMSG* pMsg) |
| 621 | { |
| 622 | return false; |
| 623 | } |
| 624 | |
| 625 | bool wxWindowPalm::PalmTranslateMessage(WXMSG* pMsg) |
| 626 | { |
| 627 | return false; |
| 628 | } |
| 629 | |
| 630 | bool wxWindowPalm::PalmShouldPreProcessMessage(WXMSG* WXUNUSED(pMsg)) |
| 631 | { |
| 632 | return false; |
| 633 | } |
| 634 | |
| 635 | // --------------------------------------------------------------------------- |
| 636 | // Main wxWidgets window proc and the window proc for wxWindow |
| 637 | // --------------------------------------------------------------------------- |
| 638 | |
| 639 | // Hook for new window just as it's being created, when the window isn't yet |
| 640 | // associated with the handle |
| 641 | |
| 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) |
| 645 | { |
| 646 | } |
| 647 | |
| 648 | wxWindowCreationHook::~wxWindowCreationHook() |
| 649 | { |
| 650 | } |
| 651 | |
| 652 | WXLRESULT wxWindowPalm::PalmWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) |
| 653 | { |
| 654 | return false; |
| 655 | } |
| 656 | |
| 657 | // ---------------------------------------------------------------------------- |
| 658 | // wxWindow <-> HWND map |
| 659 | // ---------------------------------------------------------------------------- |
| 660 | |
| 661 | wxWinHashTable *wxWinHandleHash = NULL; |
| 662 | |
| 663 | wxWindow *wxFindWinFromHandle(WXHWND hWnd) |
| 664 | { |
| 665 | return NULL; |
| 666 | } |
| 667 | |
| 668 | void wxRemoveHandleAssociation(wxWindowPalm *win) |
| 669 | { |
| 670 | } |
| 671 | |
| 672 | // ---------------------------------------------------------------------------- |
| 673 | // various Palm speciic class dependent functions |
| 674 | // ---------------------------------------------------------------------------- |
| 675 | |
| 676 | // Default destroyer - override if you destroy it in some other way |
| 677 | // (e.g. with MDI child windows) |
| 678 | void wxWindowPalm::PalmDestroyWindow() |
| 679 | { |
| 680 | } |
| 681 | |
| 682 | bool wxWindowPalm::PalmGetCreateWindowCoords(const wxPoint& pos, |
| 683 | const wxSize& size, |
| 684 | int& x, int& y, |
| 685 | int& w, int& h) const |
| 686 | { |
| 687 | return false; |
| 688 | } |
| 689 | |
| 690 | WXHWND wxWindowPalm::PalmGetParent() const |
| 691 | { |
| 692 | return NULL; |
| 693 | } |
| 694 | |
| 695 | bool wxWindowPalm::PalmCreate(const wxChar *wclass, |
| 696 | const wxChar *title, |
| 697 | const wxPoint& pos, |
| 698 | const wxSize& size, |
| 699 | WXDWORD style, |
| 700 | WXDWORD extendedStyle) |
| 701 | { |
| 702 | return false; |
| 703 | } |
| 704 | |
| 705 | // =========================================================================== |
| 706 | // Palm message handlers |
| 707 | // =========================================================================== |
| 708 | |
| 709 | // --------------------------------------------------------------------------- |
| 710 | // end session messages |
| 711 | // --------------------------------------------------------------------------- |
| 712 | |
| 713 | bool wxWindowPalm::HandleQueryEndSession(long logOff, bool *mayEnd) |
| 714 | { |
| 715 | return false; |
| 716 | } |
| 717 | |
| 718 | bool wxWindowPalm::HandleEndSession(bool endSession, long logOff) |
| 719 | { |
| 720 | return false; |
| 721 | } |
| 722 | |
| 723 | // --------------------------------------------------------------------------- |
| 724 | // window creation/destruction |
| 725 | // --------------------------------------------------------------------------- |
| 726 | |
| 727 | bool wxWindowPalm::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) |
| 728 | { |
| 729 | return false; |
| 730 | } |
| 731 | |
| 732 | bool wxWindowPalm::HandleDestroy() |
| 733 | { |
| 734 | return false; |
| 735 | } |
| 736 | |
| 737 | // --------------------------------------------------------------------------- |
| 738 | // activation/focus |
| 739 | // --------------------------------------------------------------------------- |
| 740 | |
| 741 | bool wxWindowPalm::HandleActivate(int state, |
| 742 | bool WXUNUSED(minimized), |
| 743 | WXHWND WXUNUSED(activate)) |
| 744 | { |
| 745 | return false; |
| 746 | } |
| 747 | |
| 748 | bool wxWindowPalm::HandleSetFocus(WXHWND hwnd) |
| 749 | { |
| 750 | return false; |
| 751 | } |
| 752 | |
| 753 | bool wxWindowPalm::HandleKillFocus(WXHWND hwnd) |
| 754 | { |
| 755 | return false; |
| 756 | } |
| 757 | |
| 758 | // --------------------------------------------------------------------------- |
| 759 | // miscellaneous |
| 760 | // --------------------------------------------------------------------------- |
| 761 | |
| 762 | bool wxWindowPalm::HandleShow(bool show, int WXUNUSED(status)) |
| 763 | { |
| 764 | return false; |
| 765 | } |
| 766 | |
| 767 | bool wxWindowPalm::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) |
| 768 | { |
| 769 | return false; |
| 770 | } |
| 771 | |
| 772 | bool wxWindowPalm::HandleDropFiles(WXWPARAM wParam) |
| 773 | { |
| 774 | return false; |
| 775 | } |
| 776 | |
| 777 | |
| 778 | bool wxWindowPalm::HandleSetCursor(WXHWND WXUNUSED(hWnd), |
| 779 | short nHitTest, |
| 780 | int WXUNUSED(mouseMsg)) |
| 781 | { |
| 782 | return false; |
| 783 | } |
| 784 | |
| 785 | // --------------------------------------------------------------------------- |
| 786 | // owner drawn stuff |
| 787 | // --------------------------------------------------------------------------- |
| 788 | |
| 789 | #if (wxUSE_OWNER_DRAWN && wxUSE_MENUS_NATIVE) || \ |
| 790 | (wxUSE_CONTROLS && !defined(__WXUNIVERSAL__)) |
| 791 | #define WXUNUSED_UNLESS_ODRAWN(param) param |
| 792 | #else |
| 793 | #define WXUNUSED_UNLESS_ODRAWN(param) |
| 794 | #endif |
| 795 | |
| 796 | bool |
| 797 | wxWindowPalm::PalmOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), |
| 798 | WXDRAWITEMSTRUCT * WXUNUSED_UNLESS_ODRAWN(itemStruct)) |
| 799 | { |
| 800 | return false; |
| 801 | } |
| 802 | |
| 803 | bool |
| 804 | wxWindowPalm::PalmOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id), |
| 805 | WXMEASUREITEMSTRUCT * |
| 806 | WXUNUSED_UNLESS_ODRAWN(itemStruct)) |
| 807 | { |
| 808 | return false; |
| 809 | } |
| 810 | |
| 811 | // --------------------------------------------------------------------------- |
| 812 | // colours and palettes |
| 813 | // --------------------------------------------------------------------------- |
| 814 | |
| 815 | bool wxWindowPalm::HandleSysColorChange() |
| 816 | { |
| 817 | return false; |
| 818 | } |
| 819 | |
| 820 | bool wxWindowPalm::HandleDisplayChange() |
| 821 | { |
| 822 | return false; |
| 823 | } |
| 824 | |
| 825 | bool wxWindowPalm::HandleCtlColor(WXHBRUSH *brush, |
| 826 | WXHDC pDC, |
| 827 | WXHWND pWnd, |
| 828 | WXUINT nCtlColor, |
| 829 | WXUINT message, |
| 830 | WXWPARAM wParam, |
| 831 | WXLPARAM lParam) |
| 832 | { |
| 833 | return false; |
| 834 | } |
| 835 | |
| 836 | // Define for each class of dialog and control |
| 837 | WXHBRUSH wxWindowPalm::OnCtlColor(WXHDC WXUNUSED(hDC), |
| 838 | WXHWND WXUNUSED(hWnd), |
| 839 | WXUINT WXUNUSED(nCtlColor), |
| 840 | WXUINT WXUNUSED(message), |
| 841 | WXWPARAM WXUNUSED(wParam), |
| 842 | WXLPARAM WXUNUSED(lParam)) |
| 843 | { |
| 844 | return (WXHBRUSH)0; |
| 845 | } |
| 846 | |
| 847 | bool wxWindowPalm::HandlePaletteChanged(WXHWND hWndPalChange) |
| 848 | { |
| 849 | return false; |
| 850 | } |
| 851 | |
| 852 | bool wxWindowPalm::HandleCaptureChanged(WXHWND hWndGainedCapture) |
| 853 | { |
| 854 | return false; |
| 855 | } |
| 856 | |
| 857 | bool wxWindowPalm::HandleQueryNewPalette() |
| 858 | { |
| 859 | return false; |
| 860 | } |
| 861 | |
| 862 | // Responds to colour changes: passes event on to children. |
| 863 | void wxWindowPalm::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) |
| 864 | { |
| 865 | } |
| 866 | |
| 867 | // --------------------------------------------------------------------------- |
| 868 | // painting |
| 869 | // --------------------------------------------------------------------------- |
| 870 | |
| 871 | bool wxWindowPalm::HandlePaint() |
| 872 | { |
| 873 | return false; |
| 874 | } |
| 875 | |
| 876 | // Can be called from an application's OnPaint handler |
| 877 | void wxWindowPalm::OnPaint(wxPaintEvent& event) |
| 878 | { |
| 879 | } |
| 880 | |
| 881 | bool wxWindowPalm::HandleEraseBkgnd(WXHDC hdc) |
| 882 | { |
| 883 | return false; |
| 884 | } |
| 885 | |
| 886 | void wxWindowPalm::OnEraseBackground(wxEraseEvent& event) |
| 887 | { |
| 888 | } |
| 889 | |
| 890 | // --------------------------------------------------------------------------- |
| 891 | // moving and resizing |
| 892 | // --------------------------------------------------------------------------- |
| 893 | |
| 894 | bool wxWindowPalm::HandleMinimize() |
| 895 | { |
| 896 | return false; |
| 897 | } |
| 898 | |
| 899 | bool wxWindowPalm::HandleMaximize() |
| 900 | { |
| 901 | return false; |
| 902 | } |
| 903 | |
| 904 | bool wxWindowPalm::HandleMove(int x, int y) |
| 905 | { |
| 906 | return false; |
| 907 | } |
| 908 | |
| 909 | bool wxWindowPalm::HandleMoving(wxRect& rect) |
| 910 | { |
| 911 | return false; |
| 912 | } |
| 913 | |
| 914 | bool wxWindowPalm::HandleSize(int WXUNUSED(w), int WXUNUSED(h), |
| 915 | WXUINT WXUNUSED(flag)) |
| 916 | { |
| 917 | return false; |
| 918 | } |
| 919 | |
| 920 | bool wxWindowPalm::HandleSizing(wxRect& rect) |
| 921 | { |
| 922 | return false; |
| 923 | } |
| 924 | |
| 925 | bool wxWindowPalm::HandleGetMinMaxInfo(void *mmInfo) |
| 926 | { |
| 927 | return false; |
| 928 | } |
| 929 | |
| 930 | // --------------------------------------------------------------------------- |
| 931 | // command messages |
| 932 | // --------------------------------------------------------------------------- |
| 933 | |
| 934 | bool wxWindowPalm::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) |
| 935 | { |
| 936 | return false; |
| 937 | } |
| 938 | |
| 939 | // --------------------------------------------------------------------------- |
| 940 | // mouse events |
| 941 | // --------------------------------------------------------------------------- |
| 942 | |
| 943 | void wxWindowPalm::InitMouseEvent(wxMouseEvent& event, |
| 944 | int x, int y, |
| 945 | WXUINT flags) |
| 946 | { |
| 947 | } |
| 948 | |
| 949 | // Windows doesn't send the mouse events to the static controls (which are |
| 950 | // transparent in the sense that their WM_NCHITTEST handler returns |
| 951 | // HTTRANSPARENT) at all but we want all controls to receive the mouse events |
| 952 | // and so we manually check if we don't have a child window under mouse and if |
| 953 | // we do, send the event to it instead of the window Windows had sent WM_XXX |
| 954 | // to. |
| 955 | // |
| 956 | // Notice that this is not done for the mouse move events because this could |
| 957 | // (would?) be too slow, but only for clicks which means that the static texts |
| 958 | // still don't get move, enter nor leave events. |
| 959 | static wxWindowPalm *FindWindowForMouseEvent(wxWindowPalm *win, int *x, int *y) //TW:REQ:Univ |
| 960 | { |
| 961 | return NULL; |
| 962 | } |
| 963 | |
| 964 | bool wxWindowPalm::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags) |
| 965 | { |
| 966 | return false; |
| 967 | } |
| 968 | |
| 969 | bool wxWindowPalm::HandleMouseMove(int x, int y, WXUINT flags) |
| 970 | { |
| 971 | return false; |
| 972 | } |
| 973 | |
| 974 | |
| 975 | bool wxWindowPalm::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam) |
| 976 | { |
| 977 | return false; |
| 978 | } |
| 979 | |
| 980 | |
| 981 | // --------------------------------------------------------------------------- |
| 982 | // keyboard handling |
| 983 | // --------------------------------------------------------------------------- |
| 984 | |
| 985 | // create the key event of the given type for the given key - used by |
| 986 | // HandleChar and HandleKeyDown/Up |
| 987 | wxKeyEvent wxWindowPalm::CreateKeyEvent(wxEventType evType, |
| 988 | int id, |
| 989 | WXLPARAM lParam, |
| 990 | WXWPARAM wParam) const |
| 991 | { |
| 992 | wxKeyEvent event(evType); |
| 993 | |
| 994 | return event; |
| 995 | } |
| 996 | |
| 997 | // isASCII is true only when we're called from WM_CHAR handler and not from |
| 998 | // WM_KEYDOWN one |
| 999 | bool wxWindowPalm::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII) |
| 1000 | { |
| 1001 | return false; |
| 1002 | } |
| 1003 | |
| 1004 | bool wxWindowPalm::HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam) |
| 1005 | { |
| 1006 | return false; |
| 1007 | } |
| 1008 | |
| 1009 | bool wxWindowPalm::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam) |
| 1010 | { |
| 1011 | return false; |
| 1012 | } |
| 1013 | |
| 1014 | // --------------------------------------------------------------------------- |
| 1015 | // joystick |
| 1016 | // --------------------------------------------------------------------------- |
| 1017 | |
| 1018 | bool wxWindowPalm::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) |
| 1019 | { |
| 1020 | return false; |
| 1021 | } |
| 1022 | |
| 1023 | // --------------------------------------------------------------------------- |
| 1024 | // scrolling |
| 1025 | // --------------------------------------------------------------------------- |
| 1026 | |
| 1027 | bool wxWindowPalm::PalmOnScroll(int orientation, WXWORD wParam, |
| 1028 | WXWORD pos, WXHWND control) |
| 1029 | { |
| 1030 | return false; |
| 1031 | } |
| 1032 | |
| 1033 | // =========================================================================== |
| 1034 | // global functions |
| 1035 | // =========================================================================== |
| 1036 | |
| 1037 | void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) |
| 1038 | { |
| 1039 | } |
| 1040 | |
| 1041 | // Returns 0 if was a normal ASCII value, not a special key. This indicates that |
| 1042 | // the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead. |
| 1043 | int wxCharCodePalmToWX(int keySym, WXLPARAM lParam) |
| 1044 | { |
| 1045 | return 0; |
| 1046 | } |
| 1047 | |
| 1048 | int wxCharCodeWXToPalm(int id, bool *isVirtual) |
| 1049 | { |
| 1050 | return 0; |
| 1051 | } |
| 1052 | |
| 1053 | bool wxGetKeyState(wxKeyCode key) |
| 1054 | { |
| 1055 | return false; |
| 1056 | } |
| 1057 | |
| 1058 | wxWindow *wxGetActiveWindow() |
| 1059 | { |
| 1060 | return NULL; |
| 1061 | } |
| 1062 | |
| 1063 | extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) |
| 1064 | { |
| 1065 | return NULL; |
| 1066 | } |
| 1067 | |
| 1068 | // Find the wxWindow at the current mouse position, returning the mouse |
| 1069 | // position. |
| 1070 | wxWindow* wxFindWindowAtPointer(wxPoint& pt) |
| 1071 | { |
| 1072 | return NULL; |
| 1073 | } |
| 1074 | |
| 1075 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) |
| 1076 | { |
| 1077 | return NULL; |
| 1078 | } |
| 1079 | |
| 1080 | // Get the current mouse position. |
| 1081 | wxPoint wxGetMousePosition() |
| 1082 | { |
| 1083 | return wxPoint(0, 0); |
| 1084 | } |
| 1085 | |
| 1086 | #if wxUSE_HOTKEY |
| 1087 | |
| 1088 | bool wxWindowPalm::RegisterHotKey(int hotkeyId, int modifiers, int keycode) |
| 1089 | { |
| 1090 | return false; |
| 1091 | } |
| 1092 | |
| 1093 | bool wxWindowPalm::UnregisterHotKey(int hotkeyId) |
| 1094 | { |
| 1095 | return false; |
| 1096 | } |
| 1097 | |
| 1098 | #if wxUSE_ACCEL |
| 1099 | |
| 1100 | bool wxWindowPalm::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) |
| 1101 | { |
| 1102 | return false; |
| 1103 | } |
| 1104 | |
| 1105 | #endif // wxUSE_ACCEL |
| 1106 | |
| 1107 | #endif // wxUSE_HOTKEY |
| 1108 | |
| 1109 | |