1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-06-26 20:59:19 +00:00
|
|
|
// Name: wx/msw/window.h
|
2005-11-03 16:47:29 +00:00
|
|
|
// Purpose: wxWindowMSW class
|
1998-05-20 14:12:05 +00:00
|
|
|
// Author: Julian Smart
|
2001-06-26 20:59:19 +00:00
|
|
|
// Modified by: Vadim Zeitlin on 13.05.99: complete refont of message handling,
|
|
|
|
// elimination of Default(), ...
|
1998-05-20 14:12:05 +00:00
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 10:34:04 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_WINDOW_H_
|
|
|
|
#define _WX_WINDOW_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-12-20 23:49:21 +00:00
|
|
|
|
2004-12-15 12:22:51 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_4
|
|
|
|
// they're unused by wxWidgets...
|
1999-05-10 00:42:57 +00:00
|
|
|
enum
|
1998-12-20 23:49:21 +00:00
|
|
|
{
|
1999-05-10 00:42:57 +00:00
|
|
|
wxKEY_SHIFT = 1,
|
|
|
|
wxKEY_CTRL = 2
|
1998-12-20 23:49:21 +00:00
|
|
|
};
|
2004-12-15 12:22:51 +00:00
|
|
|
#endif
|
1998-12-20 23:49:21 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxWindow declaration for MSW
|
|
|
|
// ---------------------------------------------------------------------------
|
1999-10-10 23:28:07 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
class WXDLLEXPORT wxWindowMSW : public wxWindowBase
|
1998-12-20 23:49:21 +00:00
|
|
|
{
|
2005-04-28 14:45:09 +00:00
|
|
|
friend class wxSpinCtrl;
|
|
|
|
friend class wxSlider;
|
|
|
|
friend class wxRadioBox;
|
2005-05-14 22:01:09 +00:00
|
|
|
#if defined __VISUALC__ && __VISUALC__ <= 1200
|
|
|
|
friend class wxWindowMSW;
|
|
|
|
#endif
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
2004-01-15 13:49:22 +00:00
|
|
|
wxWindowMSW() { Init(); }
|
2001-06-26 20:59:19 +00:00
|
|
|
|
|
|
|
wxWindowMSW(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2004-01-15 13:49:22 +00:00
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual ~wxWindowMSW();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxPanelNameStr);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// implement base class pure virtuals
|
2005-11-03 16:47:29 +00:00
|
|
|
virtual void SetLabel(const wxString& label);
|
|
|
|
virtual wxString GetLabel() const;
|
1999-05-19 00:53:27 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void Raise();
|
|
|
|
virtual void Lower();
|
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
virtual bool Show( bool show = true );
|
|
|
|
virtual bool Enable( bool enable = true );
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual void SetFocus();
|
2002-04-21 00:32:14 +00:00
|
|
|
virtual void SetFocusFromKbd();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual bool Reparent(wxWindowBase *newParent);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual void WarpPointer(int x, int y);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
virtual void Refresh( bool eraseBackground = true,
|
1999-05-10 00:42:57 +00:00
|
|
|
const wxRect *rect = (const wxRect *) NULL );
|
2001-06-26 20:59:19 +00:00
|
|
|
virtual void Update();
|
2001-07-29 21:22:12 +00:00
|
|
|
virtual void Freeze();
|
|
|
|
virtual void Thaw();
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2002-02-17 22:43:43 +00:00
|
|
|
virtual void SetWindowStyleFlag( long style );
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual bool SetCursor( const wxCursor &cursor );
|
|
|
|
virtual bool SetFont( const wxFont &font );
|
1999-02-22 11:01:13 +00:00
|
|
|
|
|
|
|
virtual int GetCharHeight() const;
|
|
|
|
virtual int GetCharWidth() const;
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual void GetTextExtent(const wxString& string,
|
|
|
|
int *x, int *y,
|
|
|
|
int *descent = (int *) NULL,
|
|
|
|
int *externalLeading = (int *) NULL,
|
|
|
|
const wxFont *theFont = (const wxFont *) NULL)
|
|
|
|
const;
|
|
|
|
|
|
|
|
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
2004-09-07 11:11:05 +00:00
|
|
|
int range, bool refresh = true );
|
|
|
|
virtual void SetScrollPos( int orient, int pos, bool refresh = true );
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual int GetScrollPos( int orient ) const;
|
|
|
|
virtual int GetScrollThumb( int orient ) const;
|
|
|
|
virtual int GetScrollRange( int orient ) const;
|
|
|
|
virtual void ScrollWindow( int dx, int dy,
|
|
|
|
const wxRect* rect = (wxRect *) NULL );
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-07-30 15:22:38 +00:00
|
|
|
virtual bool ScrollLines(int lines);
|
|
|
|
virtual bool ScrollPages(int pages);
|
2001-07-29 22:47:40 +00:00
|
|
|
|
1998-09-25 13:28:52 +00:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
|
|
|
#endif // wxUSE_DRAG_AND_DROP
|
1999-02-01 00:05:03 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
// Accept files for dragging
|
|
|
|
virtual void DragAcceptFiles(bool accept);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-07-08 22:55:59 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_4
|
|
|
|
wxDEPRECATED( bool GetUseCtl3D() const );
|
|
|
|
wxDEPRECATED( bool GetTransparentBackground() const );
|
2004-09-07 11:11:05 +00:00
|
|
|
wxDEPRECATED( void SetTransparent(bool t = true) );
|
2003-07-08 22:55:59 +00:00
|
|
|
#endif // WXWIN_COMPATIBILITY_2_4
|
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#ifndef __WXUNIVERSAL__
|
1999-05-10 00:42:57 +00:00
|
|
|
// Native resource loading (implemented in src/msw/nativdlg.cpp)
|
|
|
|
// FIXME: should they really be all virtual?
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
|
|
|
|
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
|
1999-05-19 00:53:27 +00:00
|
|
|
wxWindow* GetWindowChild1(wxWindowID id);
|
|
|
|
wxWindow* GetWindowChild(wxWindowID id);
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // __WXUNIVERSAL__
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-07-10 09:56:47 +00:00
|
|
|
#if wxUSE_HOTKEY
|
2003-07-10 09:16:00 +00:00
|
|
|
// install and deinstall a system wide hotkey
|
2003-07-10 09:56:47 +00:00
|
|
|
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
|
2003-07-10 09:16:00 +00:00
|
|
|
virtual bool UnregisterHotKey(int hotkeyId);
|
2003-07-10 09:56:47 +00:00
|
|
|
#endif // wxUSE_HOTKEY
|
2003-07-10 09:16:00 +00:00
|
|
|
|
2004-09-11 22:17:22 +00:00
|
|
|
// window handle stuff
|
|
|
|
// -------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 22:29:23 +00:00
|
|
|
WXHWND GetHWND() const { return m_hWnd; }
|
|
|
|
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
|
|
|
virtual WXWidget GetHandle() const { return GetHWND(); }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2004-09-11 22:17:22 +00:00
|
|
|
void AssociateHandle(WXWidget handle);
|
|
|
|
void DissociateHandle();
|
|
|
|
|
2005-08-28 16:19:45 +00:00
|
|
|
// does this window have deferred position and/or size?
|
|
|
|
bool IsSizeDeferred() const;
|
|
|
|
|
2004-09-11 22:17:22 +00:00
|
|
|
|
|
|
|
// implementation from now on
|
|
|
|
// ==========================
|
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// event handlers
|
|
|
|
// --------------
|
2000-01-22 01:44:16 +00:00
|
|
|
|
2000-08-03 16:11:51 +00:00
|
|
|
void OnPaint(wxPaintEvent& event);
|
2004-11-15 18:10:48 +00:00
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
2004-07-28 19:34:19 +00:00
|
|
|
#ifdef __WXWINCE__
|
2004-11-15 18:10:48 +00:00
|
|
|
void OnInitDialog(wxInitDialogEvent& event);
|
2004-07-28 19:34:19 +00:00
|
|
|
#endif
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
public:
|
1999-02-22 11:01:13 +00:00
|
|
|
// Windows subclassing
|
|
|
|
void SubclassWin(WXHWND hWnd);
|
|
|
|
void UnsubclassWin();
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
|
|
|
|
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
// return true if the window is of a standard (i.e. not wxWidgets') class
|
2002-06-15 15:32:20 +00:00
|
|
|
//
|
|
|
|
// to understand why does it work, look at SubclassWin() code and comments
|
|
|
|
bool IsOfStandardClass() const { return m_oldWndProc != NULL; }
|
|
|
|
|
1999-08-30 07:11:47 +00:00
|
|
|
wxWindow *FindItem(long id) const;
|
2004-09-07 11:11:05 +00:00
|
|
|
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const;
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
// MSW only: true if this control is part of the main control
|
|
|
|
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return false; };
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// translate wxWidgets style flags for this control into the Windows style
|
2002-02-17 22:43:43 +00:00
|
|
|
// and optional extended style for the corresponding native control
|
|
|
|
//
|
|
|
|
// this is the function that should be overridden in the derived classes,
|
|
|
|
// but you will mostly use MSWGetCreateWindowFlags() below
|
2003-05-06 21:57:32 +00:00
|
|
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ;
|
2002-02-17 22:43:43 +00:00
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// get the MSW window flags corresponding to wxWidgets ones
|
2002-02-17 22:43:43 +00:00
|
|
|
//
|
|
|
|
// the functions returns the flags (WS_XXX) directly and puts the ext
|
|
|
|
// (WS_EX_XXX) flags into the provided pointer if not NULL
|
|
|
|
WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const
|
|
|
|
{ return MSWGetStyle(GetWindowStyle(), exflags); }
|
|
|
|
|
2004-05-23 14:56:36 +00:00
|
|
|
// translate wxWidgets coords into Windows ones suitable to be passed to
|
2001-10-07 22:17:24 +00:00
|
|
|
// ::CreateWindow()
|
|
|
|
//
|
2004-09-07 11:11:05 +00:00
|
|
|
// returns true if non default coords are returned, false otherwise
|
2001-10-07 22:17:24 +00:00
|
|
|
bool MSWGetCreateWindowCoords(const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
int& x, int& y,
|
|
|
|
int& w, int& h) const;
|
|
|
|
|
2002-05-25 17:11:19 +00:00
|
|
|
// get the HWND to be used as parent of this window with CreateWindow()
|
|
|
|
virtual WXHWND MSWGetParent() const;
|
|
|
|
|
2001-10-07 22:17:24 +00:00
|
|
|
// creates the window of specified Windows class with given style, extended
|
|
|
|
// style, title and geometry (default values
|
|
|
|
//
|
2004-09-07 11:11:05 +00:00
|
|
|
// returns true if the window has been created, false if creation failed
|
2001-10-07 22:17:24 +00:00
|
|
|
bool MSWCreate(const wxChar *wclass,
|
|
|
|
const wxChar *title = NULL,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
WXDWORD style = 0,
|
1999-05-13 21:21:04 +00:00
|
|
|
WXDWORD exendedStyle = 0);
|
2001-10-07 22:17:24 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
#ifndef __WXUNIVERSAL__
|
1999-02-22 11:01:13 +00:00
|
|
|
// Create an appropriate wxWindow from a HWND
|
|
|
|
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
|
|
|
|
|
|
|
|
// Make sure the window style reflects the HWND style (roughly)
|
|
|
|
virtual void AdoptAttributesFromHWND();
|
2001-06-26 20:59:19 +00:00
|
|
|
#endif // __WXUNIVERSAL__
|
1999-02-22 11:01:13 +00:00
|
|
|
|
|
|
|
// Setup background and foreground colours correctly
|
|
|
|
virtual void SetupColours();
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// helpers for message handlers: these perform the same function as the
|
|
|
|
// message crackers from <windowsx.h> - 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,
|
2004-11-19 18:37:42 +00:00
|
|
|
WXHDC *hdc, WXHWND *hwnd);
|
1999-05-19 00:53:27 +00:00
|
|
|
void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam,
|
|
|
|
WXWORD *item, WXWORD *flags, WXHMENU *hmenu);
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// ------------------------------------------------------------------------
|
2001-03-31 18:43:54 +00:00
|
|
|
// internal handlers for MSW messages: all handlers return a boolean value:
|
2004-09-07 11:11:05 +00:00
|
|
|
// true means that the handler processed the event and false that it didn't
|
1999-05-13 21:21:04 +00:00
|
|
|
// ------------------------------------------------------------------------
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// 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 MSWOnXXX() function
|
|
|
|
// and if the derived class wants to process them, it should override
|
|
|
|
// MSWWindowProc() directly.
|
1999-05-13 21:21:04 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// scroll event (both horizontal and vertical)
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
|
|
|
|
WXWORD pos, WXHWND control);
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// child control notifications
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// owner-drawn controls need to process these messages
|
|
|
|
virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
|
|
|
|
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
|
|
|
|
|
|
|
|
// the rest are not virtual
|
|
|
|
bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
|
|
|
|
bool HandleInitDialog(WXHWND hWndFocus);
|
|
|
|
bool HandleDestroy();
|
|
|
|
|
|
|
|
bool HandlePaint();
|
2005-04-11 14:41:36 +00:00
|
|
|
bool HandlePrintClient(WXHDC hDC);
|
|
|
|
bool HandleEraseBkgnd(WXHDC hDC);
|
1999-05-19 00:53:27 +00:00
|
|
|
|
|
|
|
bool HandleMinimize();
|
|
|
|
bool HandleMaximize();
|
|
|
|
bool HandleSize(int x, int y, WXUINT flag);
|
2003-06-01 14:37:28 +00:00
|
|
|
bool HandleSizing(wxRect& rect);
|
1999-05-19 00:53:27 +00:00
|
|
|
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);
|
|
|
|
|
2004-11-19 19:40:31 +00:00
|
|
|
bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd);
|
1999-05-13 21:21:04 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandlePaletteChanged(WXHWND hWndPalChange);
|
|
|
|
bool HandleQueryNewPalette();
|
|
|
|
bool HandleSysColorChange();
|
2002-02-07 18:46:31 +00:00
|
|
|
bool HandleDisplayChange();
|
2002-04-12 20:26:43 +00:00
|
|
|
bool HandleCaptureChanged(WXHWND gainedCapture);
|
2006-02-24 14:19:12 +00:00
|
|
|
bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam);
|
1999-05-13 21:21:04 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleQueryEndSession(long logOff, bool *mayEnd);
|
|
|
|
bool HandleEndSession(bool endSession, long logOff);
|
1999-05-13 21:21:04 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleSetFocus(WXHWND wnd);
|
|
|
|
bool HandleKillFocus(WXHWND wnd);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleDropFiles(WXWPARAM wParam);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
|
|
|
|
bool HandleMouseMove(int x, int y, WXUINT flags);
|
2001-05-04 07:26:30 +00:00
|
|
|
bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = false);
|
2001-05-02 19:48:15 +00:00
|
|
|
bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam);
|
2003-07-10 09:16:00 +00:00
|
|
|
#if wxUSE_ACCEL
|
|
|
|
bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
#endif
|
2002-12-21 15:01:21 +00:00
|
|
|
#ifdef __WIN32__
|
|
|
|
int HandleMenuChar(int chAccel, WXLPARAM lParam);
|
|
|
|
#endif
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
bool HandleQueryDragIcon(WXHICON *hIcon);
|
|
|
|
|
|
|
|
bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
|
|
|
// Window procedure
|
2004-02-25 10:45:02 +00:00
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
|
|
|
// Calls an appropriate default window procedure
|
2004-02-25 10:45:02 +00:00
|
|
|
virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2001-08-05 15:07:28 +00:00
|
|
|
|
|
|
|
// message processing helpers
|
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
// return false if the message shouldn't be translated/preprocessed but
|
2001-08-05 15:07:28 +00:00
|
|
|
// dispatched normally
|
|
|
|
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
|
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
// return true if the message was preprocessed and shouldn't be dispatched
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual bool MSWProcessMessage(WXMSG* pMsg);
|
2001-08-05 15:07:28 +00:00
|
|
|
|
2004-09-07 11:11:05 +00:00
|
|
|
// return true if the message was translated and shouldn't be dispatched
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual bool MSWTranslateMessage(WXMSG* pMsg);
|
2001-08-05 15:07:28 +00:00
|
|
|
|
|
|
|
// called when the window is about to be destroyed
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void MSWDestroyWindow();
|
|
|
|
|
2004-11-19 18:37:42 +00:00
|
|
|
|
2004-12-13 00:09:54 +00:00
|
|
|
// this function should return the brush to paint the children controls
|
|
|
|
// background or 0 if this window doesn't impose any particular background
|
|
|
|
// on its children
|
|
|
|
//
|
2005-04-10 15:23:08 +00:00
|
|
|
// the base class version returns a solid brush if we have a non default
|
|
|
|
// background colour or 0 otherwise
|
2005-04-10 21:55:12 +00:00
|
|
|
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd);
|
2004-12-13 00:09:54 +00:00
|
|
|
|
2005-04-10 15:23:08 +00:00
|
|
|
// return the background brush to use for painting the given window by
|
|
|
|
// quering the parent windows via their MSWGetBgBrushForChild() recursively
|
2004-12-13 00:09:54 +00:00
|
|
|
//
|
2005-04-10 21:55:12 +00:00
|
|
|
// hWndToPaint is normally NULL meaning this window itself, but it can also
|
2005-04-10 15:23:08 +00:00
|
|
|
// be a child of this window which is used by the static box and could be
|
|
|
|
// potentially useful for other transparent controls
|
2005-04-10 21:55:12 +00:00
|
|
|
WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL);
|
2005-04-10 15:23:08 +00:00
|
|
|
|
|
|
|
// gives the parent the possibility to draw its children background, e.g.
|
|
|
|
// this is used by wxNotebook to do it using DrawThemeBackground()
|
2005-02-19 20:49:50 +00:00
|
|
|
//
|
2005-04-10 15:23:08 +00:00
|
|
|
// return true if background was drawn, false otherwise
|
|
|
|
virtual bool MSWPrintChild(WXHDC WXUNUSED(hDC), wxWindow * WXUNUSED(child))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2005-02-19 20:49:50 +00:00
|
|
|
|
2005-06-16 15:36:48 +00:00
|
|
|
// some controls (e.g. wxListBox) need to set the return value themselves
|
|
|
|
//
|
|
|
|
// return true to let parent handle it if we don't, false otherwise
|
|
|
|
virtual bool MSWShouldPropagatePrintChild()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-02-19 20:49:50 +00:00
|
|
|
|
1999-02-22 11:01:13 +00:00
|
|
|
// Responds to colour changes: passes event on to children.
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
|
|
|
|
void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags);
|
1999-02-22 11:01:13 +00:00
|
|
|
|
2001-06-26 20:59:19 +00:00
|
|
|
// check if mouse is in the window
|
|
|
|
bool IsMouseInWindow() const;
|
|
|
|
|
2005-01-19 02:31:09 +00:00
|
|
|
// synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
|
|
|
|
void GenerateMouseLeave();
|
|
|
|
|
2003-07-09 10:15:21 +00:00
|
|
|
// virtual function for implementing internal idle
|
|
|
|
// behaviour
|
2005-04-10 15:23:08 +00:00
|
|
|
virtual void OnInternalIdle();
|
2003-07-09 10:15:21 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
protected:
|
2006-02-08 21:47:09 +00:00
|
|
|
|
|
|
|
#if wxUSE_MENUS_NATIVE
|
|
|
|
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
|
|
|
#endif // wxUSE_MENUS_NATIVE
|
|
|
|
|
1999-05-10 22:29:23 +00:00
|
|
|
// the window handle
|
|
|
|
WXHWND m_hWnd;
|
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// the old window proc (we subclass all windows)
|
1999-02-22 11:01:13 +00:00
|
|
|
WXFARPROC m_oldWndProc;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// additional (MSW specific) flags
|
|
|
|
bool m_mouseInWindow:1;
|
2002-04-02 00:36:29 +00:00
|
|
|
bool m_lastKeydownProcessed:1;
|
1999-02-22 11:01:13 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// the size of one page for scrolling
|
1999-02-22 11:01:13 +00:00
|
|
|
int m_xThumbSize;
|
|
|
|
int m_yThumbSize;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// implement the base class pure virtuals
|
1999-05-19 01:00:57 +00:00
|
|
|
virtual void DoClientToScreen( int *x, int *y ) const;
|
|
|
|
virtual void DoScreenToClient( int *x, int *y ) const;
|
1999-05-10 00:42:57 +00:00
|
|
|
virtual void DoGetPosition( int *x, int *y ) const;
|
|
|
|
virtual void DoGetSize( int *width, int *height ) const;
|
|
|
|
virtual void DoGetClientSize( int *width, int *height ) const;
|
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
1999-02-22 11:01:13 +00:00
|
|
|
virtual void DoSetClientSize(int width, int height);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2002-01-19 19:31:19 +00:00
|
|
|
virtual void DoCaptureMouse();
|
|
|
|
virtual void DoReleaseMouse();
|
2002-04-02 00:36:29 +00:00
|
|
|
|
2004-07-25 12:30:08 +00:00
|
|
|
// has the window been frozen by Freeze()?
|
|
|
|
bool IsFrozen() const { return m_frozenness > 0; }
|
|
|
|
|
2005-07-30 00:01:51 +00:00
|
|
|
// this simply moves/resizes the given HWND which is supposed to be our
|
|
|
|
// sibling (this is useful for controls which are composite at MSW level
|
|
|
|
// and for which DoMoveWindow() is not enough)
|
2005-08-05 17:35:38 +00:00
|
|
|
//
|
|
|
|
// returns true if the window move was deferred, false if it was moved
|
|
|
|
// immediately (no error return)
|
|
|
|
bool DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height);
|
2005-07-30 00:01:51 +00:00
|
|
|
|
1999-10-10 23:28:07 +00:00
|
|
|
// move the window to the specified location and resize it: this is called
|
|
|
|
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
|
|
|
// ::MoveWindow() except for composite controls which will want to arrange
|
|
|
|
// themselves inside the given rectangle
|
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual void DoSetToolTip( wxToolTip *tip );
|
2002-06-20 14:49:19 +00:00
|
|
|
|
|
|
|
// process TTN_NEEDTEXT message properly (i.e. fixing the bugs in
|
|
|
|
// comctl32.dll in our code -- see the function body for more info)
|
|
|
|
bool HandleTooltipNotify(WXUINT code,
|
|
|
|
WXLPARAM lParam,
|
|
|
|
const wxString& ttip);
|
1999-05-10 00:42:57 +00:00
|
|
|
#endif // wxUSE_TOOLTIPS
|
|
|
|
|
2001-09-24 16:39:49 +00:00
|
|
|
// the helper functions used by HandleChar/KeyXXX methods
|
2002-04-07 21:06:59 +00:00
|
|
|
wxKeyEvent CreateKeyEvent(wxEventType evType, int id,
|
|
|
|
WXLPARAM lParam = 0, WXWPARAM wParam = 0) const;
|
2001-09-24 16:39:49 +00:00
|
|
|
|
2005-01-05 22:46:32 +00:00
|
|
|
|
|
|
|
// default OnEraseBackground() implementation, return true if we did erase
|
2005-04-10 15:23:08 +00:00
|
|
|
// the background, false otherwise (i.e. the system should erase it)
|
|
|
|
bool DoEraseBackground(WXHDC hDC);
|
2005-01-05 22:46:32 +00:00
|
|
|
|
2005-10-23 10:53:16 +00:00
|
|
|
// generate WM_CHANGEUISTATE if it's needed for the OS we're running under
|
2005-09-27 11:08:42 +00:00
|
|
|
//
|
2005-10-23 10:53:16 +00:00
|
|
|
// action should be one of the UIS_XXX constants
|
|
|
|
// state should be one or more of the UISF_XXX constants
|
|
|
|
// if action == UIS_INITIALIZE then it doesn't seem to matter what we use
|
|
|
|
// for state as the system will decide for us what needs to be set
|
|
|
|
void MSWUpdateUIState(int action, int state = 0);
|
2005-09-03 23:00:22 +00:00
|
|
|
|
1998-11-24 23:30:50 +00:00
|
|
|
private:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
// the (non-virtual) handlers for the events
|
|
|
|
bool HandleMove(int x, int y);
|
2003-06-01 14:37:28 +00:00
|
|
|
bool HandleMoving(wxRect& rect);
|
1999-05-13 21:21:04 +00:00
|
|
|
bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags);
|
|
|
|
bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
|
|
|
|
2002-08-30 00:34:08 +00:00
|
|
|
// list of disabled children before last call to our Disable()
|
|
|
|
wxWindowList *m_childrenDisabled;
|
|
|
|
|
2004-03-02 18:15:00 +00:00
|
|
|
// number of calls to Freeze() minus number of calls to Thaw()
|
|
|
|
unsigned int m_frozenness;
|
|
|
|
|
2005-01-04 18:57:41 +00:00
|
|
|
// current defer window position operation handle (may be NULL)
|
2005-01-05 22:46:32 +00:00
|
|
|
WXHANDLE m_hDWP;
|
2005-01-04 18:57:41 +00:00
|
|
|
|
2005-05-19 22:17:01 +00:00
|
|
|
// When deferred positioning is done these hold the pending changes, and
|
|
|
|
// are used for the default values if another size/pos changes is done on
|
|
|
|
// this window before the group of deferred changes is completed.
|
|
|
|
wxPoint m_pendingPosition;
|
|
|
|
wxSize m_pendingSize;
|
2005-01-04 18:57:41 +00:00
|
|
|
|
2001-08-12 21:45:41 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxWindowMSW)
|
|
|
|
DECLARE_NO_COPY_CLASS(wxWindowMSW)
|
1998-11-24 23:30:50 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
2003-07-08 22:55:59 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// inline functions
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY_2_4
|
|
|
|
|
|
|
|
inline bool wxWindowMSW::GetUseCtl3D() const { return false; }
|
|
|
|
inline bool wxWindowMSW::GetTransparentBackground() const { return false; }
|
|
|
|
inline void wxWindowMSW::SetTransparent(bool WXUNUSED(t)) { }
|
|
|
|
|
|
|
|
#endif // WXWIN_COMPATIBILITY_2_4
|
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// global functions
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-10 00:42:57 +00:00
|
|
|
// kbd code translation
|
2004-03-21 23:13:50 +00:00
|
|
|
WXDLLEXPORT int wxCharCodeMSWToWX(int keySym, WXLPARAM lParam = 0);
|
2004-10-07 13:36:41 +00:00
|
|
|
WXDLLEXPORT WXWORD wxCharCodeWXToMSW(int id, bool *IsVirtual);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-10-07 22:17:24 +00:00
|
|
|
// 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(wxWindowMSW *winBeingCreated);
|
|
|
|
~wxWindowCreationHook();
|
|
|
|
};
|
|
|
|
|
2004-03-22 18:06:23 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// global objects
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// notice that this hash must be defined after wxWindow declaration as it
|
|
|
|
// needs to "see" its dtor and not just forward declaration
|
|
|
|
#include "wx/hash.h"
|
|
|
|
|
|
|
|
// pseudo-template HWND <-> wxWindow hash table
|
2004-05-15 16:56:16 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_2_4
|
|
|
|
WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable);
|
|
|
|
#else
|
2004-05-08 10:19:14 +00:00
|
|
|
WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable);
|
2004-05-15 16:56:16 +00:00
|
|
|
#endif
|
2004-03-22 18:06:23 +00:00
|
|
|
|
|
|
|
extern wxWinHashTable *wxWinHandleHash;
|
|
|
|
|
2005-11-03 16:47:29 +00:00
|
|
|
#endif // _WX_WINDOW_H_
|