1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9f62ea84SAndrew Rist * distributed with this work for additional information
6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at
10*9f62ea84SAndrew Rist *
11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist *
13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the
17*9f62ea84SAndrew Rist * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist * under the License.
19*9f62ea84SAndrew Rist *
20*9f62ea84SAndrew Rist *************************************************************/
21*9f62ea84SAndrew Rist
22*9f62ea84SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #define Region QtXRegion
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include <QColor>
27cdf0e10cSrcweir #include <QStyle>
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <kconfig.h>
30cdf0e10cSrcweir #include <kglobal.h>
31cdf0e10cSrcweir #include <kmenubar.h>
32cdf0e10cSrcweir #include <kconfiggroup.h>
33cdf0e10cSrcweir #include <kmainwindow.h>
34cdf0e10cSrcweir #include <kapplication.h>
35cdf0e10cSrcweir #include <ktoolbar.h>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #undef Region
38cdf0e10cSrcweir
39cdf0e10cSrcweir #include "KDESalFrame.hxx"
40cdf0e10cSrcweir #include "KDEXLib.hxx"
41cdf0e10cSrcweir #include "KDESalGraphics.hxx"
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include <tools/color.hxx>
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include <vcl/settings.hxx>
46cdf0e10cSrcweir #include <vcl/font.hxx>
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include <svdata.hxx>
49cdf0e10cSrcweir
50cdf0e10cSrcweir #include <unx/pspgraphics.h>
51cdf0e10cSrcweir
52cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
53cdf0e10cSrcweir #include <stdio.h>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir
KDESalFrame(SalFrame * pParent,sal_uLong nState)56cdf0e10cSrcweir KDESalFrame::KDESalFrame( SalFrame* pParent, sal_uLong nState ) :
57cdf0e10cSrcweir X11SalFrame( pParent, nState )
58cdf0e10cSrcweir {
59cdf0e10cSrcweir }
60cdf0e10cSrcweir
Show(sal_Bool bVisible,sal_Bool bNoActivate)61cdf0e10cSrcweir void KDESalFrame::Show( sal_Bool bVisible, sal_Bool bNoActivate )
62cdf0e10cSrcweir {
63cdf0e10cSrcweir if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
66cdf0e10cSrcweir pXLib->doStartup();
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
69cdf0e10cSrcweir X11SalFrame::Show( bVisible, bNoActivate );
70cdf0e10cSrcweir }
71cdf0e10cSrcweir
72cdf0e10cSrcweir /** Helper function to convert colors.
73cdf0e10cSrcweir */
toColor(const QColor & rColor)74cdf0e10cSrcweir static Color toColor( const QColor &rColor )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir return Color( rColor.red(), rColor.green(), rColor.blue() );
77cdf0e10cSrcweir }
78cdf0e10cSrcweir
79cdf0e10cSrcweir /** Helper function to read untranslated text entry from KConfig configuration repository.
80cdf0e10cSrcweir */
readEntryUntranslated(KConfigGroup * pGroup,const char * pKey)81cdf0e10cSrcweir static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
82cdf0e10cSrcweir {
83cdf0e10cSrcweir return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
84cdf0e10cSrcweir }
85cdf0e10cSrcweir
86cdf0e10cSrcweir #if 0
87cdf0e10cSrcweir /** Helper function to read color from KConfig configuration repository.
88cdf0e10cSrcweir */
89cdf0e10cSrcweir static Color readColor( KConfigGroup *pGroup, const char *pKey )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
92cdf0e10cSrcweir }
93cdf0e10cSrcweir #endif
94cdf0e10cSrcweir
95cdf0e10cSrcweir /** Helper function to add information to Font from QFont.
96cdf0e10cSrcweir
97cdf0e10cSrcweir Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
98cdf0e10cSrcweir */
toFont(const QFont & rQFont,const::com::sun::star::lang::Locale & rLocale)99cdf0e10cSrcweir static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& rLocale )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir psp::FastPrintFontInfo aInfo;
102cdf0e10cSrcweir QFontInfo qFontInfo( rQFont );
103cdf0e10cSrcweir
104cdf0e10cSrcweir // set family name
105cdf0e10cSrcweir aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
106cdf0e10cSrcweir
107cdf0e10cSrcweir // set italic
108cdf0e10cSrcweir aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
109cdf0e10cSrcweir
110cdf0e10cSrcweir // set weight
111cdf0e10cSrcweir int nWeight = qFontInfo.weight();
112cdf0e10cSrcweir if ( nWeight <= QFont::Light )
113cdf0e10cSrcweir aInfo.m_eWeight = psp::weight::Light;
114cdf0e10cSrcweir else if ( nWeight <= QFont::Normal )
115cdf0e10cSrcweir aInfo.m_eWeight = psp::weight::Normal;
116cdf0e10cSrcweir else if ( nWeight <= QFont::DemiBold )
117cdf0e10cSrcweir aInfo.m_eWeight = psp::weight::SemiBold;
118cdf0e10cSrcweir else if ( nWeight <= QFont::Bold )
119cdf0e10cSrcweir aInfo.m_eWeight = psp::weight::Bold;
120cdf0e10cSrcweir else
121cdf0e10cSrcweir aInfo.m_eWeight = psp::weight::UltraBold;
122cdf0e10cSrcweir
123cdf0e10cSrcweir // set width
124cdf0e10cSrcweir int nStretch = rQFont.stretch();
125cdf0e10cSrcweir if ( nStretch <= QFont::UltraCondensed )
126cdf0e10cSrcweir aInfo.m_eWidth = psp::width::UltraCondensed;
127cdf0e10cSrcweir else if ( nStretch <= QFont::ExtraCondensed )
128cdf0e10cSrcweir aInfo.m_eWidth = psp::width::ExtraCondensed;
129cdf0e10cSrcweir else if ( nStretch <= QFont::Condensed )
130cdf0e10cSrcweir aInfo.m_eWidth = psp::width::Condensed;
131cdf0e10cSrcweir else if ( nStretch <= QFont::SemiCondensed )
132cdf0e10cSrcweir aInfo.m_eWidth = psp::width::SemiCondensed;
133cdf0e10cSrcweir else if ( nStretch <= QFont::Unstretched )
134cdf0e10cSrcweir aInfo.m_eWidth = psp::width::Normal;
135cdf0e10cSrcweir else if ( nStretch <= QFont::SemiExpanded )
136cdf0e10cSrcweir aInfo.m_eWidth = psp::width::SemiExpanded;
137cdf0e10cSrcweir else if ( nStretch <= QFont::Expanded )
138cdf0e10cSrcweir aInfo.m_eWidth = psp::width::Expanded;
139cdf0e10cSrcweir else if ( nStretch <= QFont::ExtraExpanded )
140cdf0e10cSrcweir aInfo.m_eWidth = psp::width::ExtraExpanded;
141cdf0e10cSrcweir else
142cdf0e10cSrcweir aInfo.m_eWidth = psp::width::UltraExpanded;
143cdf0e10cSrcweir
144cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
145cdf0e10cSrcweir fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
146cdf0e10cSrcweir #endif
147cdf0e10cSrcweir
148cdf0e10cSrcweir // match font to e.g. resolve "Sans"
149cdf0e10cSrcweir psp::PrintFontManager::get().matchFont( aInfo, rLocale );
150cdf0e10cSrcweir
151cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
152cdf0e10cSrcweir fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",
153cdf0e10cSrcweir aInfo.m_nID != 0 ? "succeeded" : "failed",
154cdf0e10cSrcweir OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
155cdf0e10cSrcweir #endif
156cdf0e10cSrcweir
157cdf0e10cSrcweir // font height
158cdf0e10cSrcweir int nPointHeight = qFontInfo.pointSize();
159cdf0e10cSrcweir if ( nPointHeight <= 0 )
160cdf0e10cSrcweir nPointHeight = rQFont.pointSize();
161cdf0e10cSrcweir
162cdf0e10cSrcweir // Create the font
163cdf0e10cSrcweir Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
164cdf0e10cSrcweir if( aInfo.m_eWeight != psp::weight::Unknown )
165cdf0e10cSrcweir aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
166cdf0e10cSrcweir if( aInfo.m_eWidth != psp::width::Unknown )
167cdf0e10cSrcweir aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
168cdf0e10cSrcweir if( aInfo.m_eItalic != psp::italic::Unknown )
169cdf0e10cSrcweir aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
170cdf0e10cSrcweir if( aInfo.m_ePitch != psp::pitch::Unknown )
171cdf0e10cSrcweir aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) );
172cdf0e10cSrcweir
173cdf0e10cSrcweir return aFont;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir /** Implementation of KDE integration's main method.
177cdf0e10cSrcweir */
UpdateSettings(AllSettings & rSettings)178cdf0e10cSrcweir void KDESalFrame::UpdateSettings( AllSettings& rSettings )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir StyleSettings style( rSettings.GetStyleSettings() );
181cdf0e10cSrcweir bool bSetTitleFont = false;
182cdf0e10cSrcweir
183cdf0e10cSrcweir // General settings
184cdf0e10cSrcweir QPalette pal = kapp->palette();
185cdf0e10cSrcweir
186cdf0e10cSrcweir style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
187cdf0e10cSrcweir style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
188cdf0e10cSrcweir
189cdf0e10cSrcweir style.SetActiveColor2(toColor(pal.color(QPalette::Active, QPalette::Window)));
190cdf0e10cSrcweir style.SetDeactiveColor2(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
191cdf0e10cSrcweir
192cdf0e10cSrcweir style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
193cdf0e10cSrcweir style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
194cdf0e10cSrcweir
195cdf0e10cSrcweir // WM settings
196cdf0e10cSrcweir KConfig *pConfig = KGlobal::config().data();
197cdf0e10cSrcweir if ( pConfig )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir KConfigGroup aGroup = pConfig->group( "WM" );
200cdf0e10cSrcweir const char *pKey;
201cdf0e10cSrcweir
202cdf0e10cSrcweir pKey = "titleFont";
203cdf0e10cSrcweir if ( aGroup.hasKey( pKey ) )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
206cdf0e10cSrcweir style.SetTitleFont( aFont );
207cdf0e10cSrcweir bSetTitleFont = true;
208cdf0e10cSrcweir }
209cdf0e10cSrcweir
210cdf0e10cSrcweir aGroup = pConfig->group( "Icons" );
211cdf0e10cSrcweir
212cdf0e10cSrcweir pKey = "Theme";
213cdf0e10cSrcweir if ( aGroup.hasKey( pKey ) )
214cdf0e10cSrcweir style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
215cdf0e10cSrcweir
216cdf0e10cSrcweir //toolbar
217cdf0e10cSrcweir pKey = "toolbarFont";
218cdf0e10cSrcweir if ( aGroup.hasKey( pKey ) )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
221cdf0e10cSrcweir style.SetToolFont( aFont );
222cdf0e10cSrcweir }
223cdf0e10cSrcweir }
224cdf0e10cSrcweir
225cdf0e10cSrcweir Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
226cdf0e10cSrcweir Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
227cdf0e10cSrcweir Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
228cdf0e10cSrcweir Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
229cdf0e10cSrcweir Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
230cdf0e10cSrcweir Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
231cdf0e10cSrcweir Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
232cdf0e10cSrcweir
233cdf0e10cSrcweir // Foreground
234cdf0e10cSrcweir style.SetRadioCheckTextColor( aFore );
235cdf0e10cSrcweir style.SetLabelTextColor( aFore );
236cdf0e10cSrcweir style.SetInfoTextColor( aFore );
237cdf0e10cSrcweir style.SetDialogTextColor( aFore );
238cdf0e10cSrcweir style.SetGroupTextColor( aFore );
239cdf0e10cSrcweir
240cdf0e10cSrcweir // Text
241cdf0e10cSrcweir style.SetFieldTextColor( aText );
242cdf0e10cSrcweir style.SetFieldRolloverTextColor( aText );
243cdf0e10cSrcweir style.SetWindowTextColor( aText );
244cdf0e10cSrcweir style.SetHelpTextColor( aText );
245cdf0e10cSrcweir
246cdf0e10cSrcweir // Base
247cdf0e10cSrcweir style.SetFieldColor( aBase );
248cdf0e10cSrcweir style.SetHelpColor( aBase );
249cdf0e10cSrcweir style.SetWindowColor( aBase );
250cdf0e10cSrcweir style.SetActiveTabColor( aBase );
251cdf0e10cSrcweir
252cdf0e10cSrcweir // Buttons
253cdf0e10cSrcweir style.SetButtonTextColor( aButn );
254cdf0e10cSrcweir style.SetButtonRolloverTextColor( aButn );
255cdf0e10cSrcweir
256cdf0e10cSrcweir // Disable color
257cdf0e10cSrcweir style.SetDisableColor( aMid );
258cdf0e10cSrcweir
259cdf0e10cSrcweir // Workspace
260cdf0e10cSrcweir style.SetWorkspaceColor( aMid );
261cdf0e10cSrcweir
262cdf0e10cSrcweir // Background
263cdf0e10cSrcweir style.Set3DColors( aBack );
264cdf0e10cSrcweir style.SetFaceColor( aBack );
265cdf0e10cSrcweir style.SetInactiveTabColor( aBack );
266cdf0e10cSrcweir style.SetDialogColor( aBack );
267cdf0e10cSrcweir
268cdf0e10cSrcweir if( aBack == COL_LIGHTGRAY )
269cdf0e10cSrcweir style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
270cdf0e10cSrcweir else
271cdf0e10cSrcweir {
272cdf0e10cSrcweir Color aColor2 = style.GetLightColor();
273cdf0e10cSrcweir style.
274cdf0e10cSrcweir SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2),
275cdf0e10cSrcweir (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2),
276cdf0e10cSrcweir (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2)
277cdf0e10cSrcweir ) );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir // Selection
281cdf0e10cSrcweir style.SetHighlightColor( aHigh );
282cdf0e10cSrcweir style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) );
283cdf0e10cSrcweir
284cdf0e10cSrcweir // Font
285cdf0e10cSrcweir Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
286cdf0e10cSrcweir
287cdf0e10cSrcweir style.SetAppFont( aFont );
288cdf0e10cSrcweir style.SetHelpFont( aFont );
289cdf0e10cSrcweir
290cdf0e10cSrcweir if( !bSetTitleFont )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir style.SetTitleFont( aFont );
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir style.SetFloatTitleFont( aFont );
296cdf0e10cSrcweir style.SetMenuFont( aFont ); // will be changed according to pMenuBar
297cdf0e10cSrcweir //style.SetToolFont( aFont ); //already set above
298cdf0e10cSrcweir style.SetLabelFont( aFont );
299cdf0e10cSrcweir style.SetInfoFont( aFont );
300cdf0e10cSrcweir style.SetRadioCheckFont( aFont );
301cdf0e10cSrcweir style.SetPushButtonFont( aFont );
302cdf0e10cSrcweir style.SetFieldFont( aFont );
303cdf0e10cSrcweir style.SetIconFont( aFont );
304cdf0e10cSrcweir style.SetGroupFont( aFont );
305cdf0e10cSrcweir
306cdf0e10cSrcweir int flash_time = QApplication::cursorFlashTime();
307cdf0e10cSrcweir style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
308cdf0e10cSrcweir
309cdf0e10cSrcweir // Menu
310cdf0e10cSrcweir style.SetSkipDisabledInMenus( TRUE );
311cdf0e10cSrcweir KMenuBar* pMenuBar = new KMenuBar();
312cdf0e10cSrcweir if ( pMenuBar )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir // Color
315cdf0e10cSrcweir QPalette qMenuCG = pMenuBar->palette();
316cdf0e10cSrcweir
317cdf0e10cSrcweir // Menu text and background color, theme specific
318cdf0e10cSrcweir Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
319cdf0e10cSrcweir Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
320cdf0e10cSrcweir
321cdf0e10cSrcweir aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
322cdf0e10cSrcweir aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
323cdf0e10cSrcweir
324cdf0e10cSrcweir style.SetMenuTextColor( aMenuFore );
325cdf0e10cSrcweir style.SetMenuBarTextColor( aMenuFore );
326cdf0e10cSrcweir style.SetMenuColor( aMenuBack );
327cdf0e10cSrcweir style.SetMenuBarColor( aMenuBack );
328cdf0e10cSrcweir
329cdf0e10cSrcweir style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
330cdf0e10cSrcweir
331cdf0e10cSrcweir style.SetMenuHighlightTextColor( aMenuFore );
332cdf0e10cSrcweir
333cdf0e10cSrcweir // set special menubar higlight text color
334cdf0e10cSrcweir if ( kapp->style()->inherits( "HighContrastStyle" ) )
335cdf0e10cSrcweir ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
336cdf0e10cSrcweir else
337cdf0e10cSrcweir ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
338cdf0e10cSrcweir
339cdf0e10cSrcweir // Font
340cdf0e10cSrcweir aFont = toFont( pMenuBar->font(), rSettings.GetUILocale() );
341cdf0e10cSrcweir style.SetMenuFont( aFont );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir delete pMenuBar;
345cdf0e10cSrcweir
346cdf0e10cSrcweir // Scroll bar size
347cdf0e10cSrcweir style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
348cdf0e10cSrcweir
349cdf0e10cSrcweir rSettings.SetStyleSettings( style );
350cdf0e10cSrcweir }
351cdf0e10cSrcweir
352cdf0e10cSrcweir
ReleaseGraphics(SalGraphics * pGraphics)353cdf0e10cSrcweir void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
354cdf0e10cSrcweir {
355cdf0e10cSrcweir for( int i = 0; i < nMaxGraphics; i++ )
356cdf0e10cSrcweir {
357cdf0e10cSrcweir if( m_aGraphics[i].pGraphics == pGraphics )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir m_aGraphics[i].bInUse = false;
360cdf0e10cSrcweir break;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir }
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
updateGraphics(bool bClear)365cdf0e10cSrcweir void KDESalFrame::updateGraphics( bool bClear )
366cdf0e10cSrcweir {
367cdf0e10cSrcweir Drawable aDrawable = bClear ? None : GetWindow();
368cdf0e10cSrcweir for( int i = 0; i < nMaxGraphics; i++ )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir if( m_aGraphics[i].bInUse )
371cdf0e10cSrcweir m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() );
372cdf0e10cSrcweir }
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
~KDESalFrame()375cdf0e10cSrcweir KDESalFrame::~KDESalFrame()
376cdf0e10cSrcweir {
377cdf0e10cSrcweir }
378cdf0e10cSrcweir
~GraphicsHolder()379cdf0e10cSrcweir KDESalFrame::GraphicsHolder::~GraphicsHolder()
380cdf0e10cSrcweir {
381cdf0e10cSrcweir delete pGraphics;
382cdf0e10cSrcweir }
383cdf0e10cSrcweir
GetGraphics()384cdf0e10cSrcweir SalGraphics* KDESalFrame::GetGraphics()
385cdf0e10cSrcweir {
386cdf0e10cSrcweir if( GetWindow() )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir for( int i = 0; i < nMaxGraphics; i++ )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir if( ! m_aGraphics[i].bInUse )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir m_aGraphics[i].bInUse = true;
393cdf0e10cSrcweir if( ! m_aGraphics[i].pGraphics )
394cdf0e10cSrcweir {
395cdf0e10cSrcweir m_aGraphics[i].pGraphics = new KDESalGraphics();
396cdf0e10cSrcweir m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
397cdf0e10cSrcweir }
398cdf0e10cSrcweir return m_aGraphics[i].pGraphics;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir }
401cdf0e10cSrcweir }
402cdf0e10cSrcweir
403cdf0e10cSrcweir return NULL;
404cdf0e10cSrcweir }
405