xref: /trunk/main/vcl/inc/unx/gtk/gtkdata.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _VCL_GTKDATA_HXX
29 #define _VCL_GTKDATA_HXX
30 
31 #include <tools/prex.h>
32 #include <gdk/gdk.h>
33 #include <gdk/gdkx.h>
34 #include <gtk/gtk.h>
35 #include <tools/postx.h>
36 
37 #include <unx/saldisp.hxx>
38 #include <unx/saldata.hxx>
39 #include <vcl/ptrstyle.hxx>
40 
41 #include <list>
42 
43 class GtkData : public X11SalData
44 {
45 public:
46     GtkData() {}
47     virtual ~GtkData();
48 
49     virtual void Init();
50 
51     virtual void initNWF();
52     virtual void deInitNWF();
53 };
54 
55 class GtkSalFrame;
56 
57 class GtkSalDisplay : public SalDisplay
58 {
59     GdkDisplay*						m_pGdkDisplay;
60 	GdkCursor                      *m_aCursors[ POINTER_COUNT ];
61     bool                            m_bStartupCompleted;
62     std::vector< int >              m_aXineramaScreenIndexMap;
63 
64 	GdkCursor* getFromXPM( const char *pBitmap, const char *pMask,
65 						   int nWidth, int nHeight, int nXHot, int nYHot );
66 public:
67 			 GtkSalDisplay( GdkDisplay* pDisplay );
68     virtual ~GtkSalDisplay();
69 
70     GdkDisplay* GetGdkDisplay() const { return m_pGdkDisplay; }
71 
72     virtual void deregisterFrame( SalFrame* pFrame );
73 	GdkCursor *getCursor( PointerStyle ePointerStyle );
74 	virtual int CaptureMouse( SalFrame* pFrame );
75     virtual long Dispatch( XEvent *pEvent );
76     virtual void initScreen( int nScreen ) const;
77 
78     virtual int GetDefaultMonitorNumber() const;
79 
80     static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
81                                            GdkEvent* event,
82                                            gpointer data );
83 	inline bool HasMoreEvents()     { return m_aUserEvents.size() > 1; }
84 	inline void EventGuardAcquire() { osl_acquireMutex( hEventGuard_ ); }
85 	inline void EventGuardRelease() { osl_releaseMutex( hEventGuard_ ); }
86     void startupNotificationCompleted() { m_bStartupCompleted = true; }
87 
88     void screenSizeChanged( GdkScreen* );
89     void monitorsChanged( GdkScreen* );
90 };
91 
92 
93 #endif // _VCL_GTKDATA_HXX
94