xref: /AOO41X/main/vcl/unx/kde4/KDESalGraphics.hxx (revision 0d63794c5b3715d9f8da2f4b7b451b7426ee7897)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #pragma once
25 
26 #include <rtl/string.hxx>
27 #include <unx/saldisp.hxx>
28 #include <unx/salgdi.h>
29 
30 #define Region QtXRegion
31 #include <QImage>
32 #undef Region
33 
34 /** handles graphics drawings requests and performs the needed drawing operations */
35 class KDESalGraphics : public X11SalGraphics
36 {
37     QImage* m_image;
38 
39     public:
40         KDESalGraphics();
41         virtual ~KDESalGraphics();
42 
43         /**
44             What widgets can be drawn the native way.
45             @param type Type of the widget.
46             @param part Specification of the widget's part if it consists of more than one.
47             @return true if the platform supports native drawing of the widget type defined by part.
48         */
49         virtual sal_Bool IsNativeControlSupported( ControlType type, ControlPart part );
50 
51         /** Test whether the position is in the native widget.
52             If the return value is TRUE, bIsInside contains information whether
53             aPos was or was not inside the native widget specified by the
54             type/part combination.
55         */
56         virtual sal_Bool hitTestNativeControl( ControlType type, ControlPart part,
57                                         const Rectangle& rControlRegion, const Point& aPos,
58                                         sal_Bool& rIsInside );
59         /** Draw the requested control described by part/nControlState.
60 
61             @param rControlRegion
62             The bounding Rectangle of the complete control in VCL frame coordinates.
63 
64             @param aValue
65             An optional value (tristate/numerical/string).
66 
67             @param aCaption
68             A caption or title string (like button text etc.)
69         */
70         virtual sal_Bool drawNativeControl( ControlType type, ControlPart part,
71                                         const Rectangle& rControlRegion, ControlState nControlState,
72                                         const ImplControlValue& aValue,
73                                         const rtl::OUString& aCaption );
74 
75         /** Draw text on the widget.
76             OPTIONAL. Draws the requested text for the control described by part/nControlState.
77             Used if text is not drawn by DrawNativeControl().
78 
79             @param rControlRegion The bounding region of the complete control in VCL frame coordinates.
80             @param aValue An optional value (tristate/numerical/string)
81             @param aCaption A caption or title string (like button text etc.)
82         */
drawNativeControlText(ControlType,ControlPart,const Rectangle &,ControlState,const ImplControlValue &,const rtl::OUString &)83         virtual sal_Bool drawNativeControlText( ControlType, ControlPart,
84                                             const Rectangle&, ControlState,
85                                             const ImplControlValue&,
86                                             const rtl::OUString& ) { return false; }
87         /** Check if the bounding regions match.
88 
89             If the return value is TRUE, rNativeBoundingRegion
90             contains the true bounding region covered by the control
91             including any adornment, while rNativeContentRegion contains the area
92             within the control that can be safely drawn into without drawing over
93             the borders of the control.
94 
95             @param rControlRegion
96             The bounding region of the control in VCL frame coordinates.
97 
98             @param aValue
99             An optional value (tristate/numerical/string)
100 
101             @param aCaption
102             A caption or title string (like button text etc.)
103         */
104         virtual sal_Bool getNativeControlRegion( ControlType type, ControlPart part,
105                                             const Rectangle& rControlRegion, ControlState nControlState,
106                                             const ImplControlValue& aValue,
107                                             const rtl::OUString& aCaption,
108                                             Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
109 };
110