xref: /aoo42x/main/dtrans/test/win32/dnd/atlwindow.hxx (revision fbcf0fe9)
1*fbcf0fe9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*fbcf0fe9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*fbcf0fe9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*fbcf0fe9SAndrew Rist  * distributed with this work for additional information
6*fbcf0fe9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*fbcf0fe9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*fbcf0fe9SAndrew Rist  * "License"); you may not use this file except in compliance
9*fbcf0fe9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*fbcf0fe9SAndrew Rist  *
11*fbcf0fe9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*fbcf0fe9SAndrew Rist  *
13*fbcf0fe9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*fbcf0fe9SAndrew Rist  * software distributed under the License is distributed on an
15*fbcf0fe9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*fbcf0fe9SAndrew Rist  * KIND, either express or implied.  See the License for the
17*fbcf0fe9SAndrew Rist  * specific language governing permissions and limitations
18*fbcf0fe9SAndrew Rist  * under the License.
19*fbcf0fe9SAndrew Rist  *
20*fbcf0fe9SAndrew Rist  *************************************************************/
21*fbcf0fe9SAndrew Rist 
22*fbcf0fe9SAndrew Rist 
23cdf0e10cSrcweir #ifndef _WINDOW_HXX_
24cdf0e10cSrcweir #define _WINDOW_HXX_
25cdf0e10cSrcweir #include <atlbase.h>
26cdf0e10cSrcweir extern CComModule _Module;
27cdf0e10cSrcweir #include<atlcom.h>
28cdf0e10cSrcweir #include<atlctl.h>
29cdf0e10cSrcweir #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
30cdf0e10cSrcweir #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
31cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp>
32cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
33cdf0e10cSrcweir #include "../../source/inc/DtObjFactory.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace com::sun::star::uno;
37cdf0e10cSrcweir using namespace com::sun::star::datatransfer::dnd;
38cdf0e10cSrcweir using namespace com::sun::star::datatransfer;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir struct ThreadData
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	Reference<XDragSource> source;
43cdf0e10cSrcweir 	Reference<XTransferable> transferable;
44cdf0e10cSrcweir 	HANDLE evtThreadReady;
45cdf0e10cSrcweir };
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class AWindow: public CWindowImpl<AWindow, CWindow,
48cdf0e10cSrcweir 	  CWinTraits<WS_CAPTION |WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0> >
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	TCHAR m_strName[80];
51cdf0e10cSrcweir 	Reference<XDropTarget> m_xDropTarget;
52cdf0e10cSrcweir 	Reference<XDragSource> m_xDragSource;
53cdf0e10cSrcweir 	BOOL m_isMTA;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	HWND m_hwndEdit;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	CDTransObjFactory m_aDataConverter;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir public:
AWindow(LPCTSTR strName)60cdf0e10cSrcweir 	AWindow(LPCTSTR strName)
61cdf0e10cSrcweir 	{
62cdf0e10cSrcweir 		RECT rcPos= {0,0,200,200};
63cdf0e10cSrcweir 		Create(0, rcPos, strName);
64cdf0e10cSrcweir 	}
AWindow(LPCTSTR strName,RECT pos,BOOL mta=FALSE)65cdf0e10cSrcweir 	AWindow(LPCTSTR strName, RECT pos, BOOL mta=FALSE): m_isMTA( mta)
66cdf0e10cSrcweir 	{
67cdf0e10cSrcweir 		Create(0, pos, strName);
68cdf0e10cSrcweir 	}
69cdf0e10cSrcweir 
~AWindow()70cdf0e10cSrcweir 	~AWindow()
71cdf0e10cSrcweir 	{
72cdf0e10cSrcweir 		if(m_hWnd)
73cdf0e10cSrcweir 			DestroyWindow();
74cdf0e10cSrcweir 	}
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	BEGIN_MSG_MAP(AWindow)
78cdf0e10cSrcweir 		MESSAGE_HANDLER( WM_CLOSE, OnClose)
79cdf0e10cSrcweir 		MESSAGE_HANDLER( WM_CREATE, OnCreate)
80cdf0e10cSrcweir 		MESSAGE_RANGE_HANDLER( WM_MOUSEFIRST,  WM_MOUSELAST, OnMouseAction)
81cdf0e10cSrcweir 		MESSAGE_HANDLER( WM_TIMER, OnTimer)
82cdf0e10cSrcweir 		MESSAGE_HANDLER( WM_SIZE, OnSize)
83cdf0e10cSrcweir 		MESSAGE_HANDLER( WM_SETFOCUS, OnFocus)
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	END_MSG_MAP()
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
88cdf0e10cSrcweir 	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
89cdf0e10cSrcweir 	LRESULT OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
90cdf0e10cSrcweir 	LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
91cdf0e10cSrcweir 	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
92cdf0e10cSrcweir 	LRESULT OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir };
95cdf0e10cSrcweir 
96cdf0e10cSrcweir #endif
97