]> git.saurik.com Git - wxWidgets.git/blame - src/msw/nativewin.cpp
Don't consider fully opaque bitmaps as having alpha in wxMSW.
[wxWidgets.git] / src / msw / nativewin.cpp
CommitLineData
dfba244c
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/msw/nativewin.cpp
3// Purpose: wxNativeWindow implementation
4// Author: Vadim Zeitlin
5// Created: 2008-03-05
6// RCS-ID: $Id$
7// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// for compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#ifndef WX_PRECOMP
27#endif // WX_PRECOMP
28
29#include "wx/nativewin.h"
30#include "wx/msw/private.h"
31
32// ============================================================================
33// implementation
34// ============================================================================
35
36bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd)
37{
38 if ( !::IsWindow(hwnd) )
39 {
40 // strictly speaking, the fact that IsWindow() returns true doesn't
41 // mean that the window handle is valid -- it could be being deleted
42 // right now, for example
43 //
44 // but if it returns false, the handle is definitely invalid
45 return false;
46 }
47
48 // make this HWND really a wxWindow
49 SubclassWin(hwnd);
50
51 // inherit the other attributes we can from the native HWND
52 AdoptAttributesFromHWND();
53
54 return true;
55}
56
da00cef2
VZ
57bool wxNativeContainerWindow::IsShown() const
58{
59 return (IsWindowVisible(static_cast<HWND>(m_hWnd)) != 0);
60}
61
2aee749c
VZ
62void wxNativeContainerWindow::OnNativeDestroyed()
63{
9eff73c6
VZ
64 // don't use Close() or even Destroy() here, we really don't want to keep
65 // an object using a no more existing HWND around for longer than necessary
66 delete this;
67}
68
69WXLRESULT wxNativeContainerWindow::MSWWindowProc(WXUINT nMsg,
70 WXWPARAM wParam,
71 WXLPARAM lParam)
72{
73 if ( nMsg == WM_DESTROY )
74 {
75 OnNativeDestroyed();
76
77 return 0;
78 }
79
80 return wxTopLevelWindow::MSWWindowProc(nMsg, wParam, lParam);
2aee749c
VZ
81}
82
dfba244c
VZ
83wxNativeContainerWindow::~wxNativeContainerWindow()
84{
85 // prevent the base class dtor from destroying the window, it doesn't
86 // belong to us so we should leave it alive
87 DissociateHandle();
88}
89