kstyle.h
/*
* $Id: kstyle.h 465272 2005-09-29 09:47:40Z mueller $
*
* KStyle
* Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
*
* QWindowsStyle CC_ListView and style images were kindly donated by TrollTech,
* Copyright (C) 1998-2000 TrollTech AS.
*
* Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __KSTYLE_H
#define __KSTYLE_H
// W A R N I N G
// -------------
// This API is still subject to change.
// I will remove this warning when I feel the API is sufficiently flexible.
#include <qcommonstyle.h>
#include <kdelibs_export.h>
class KPixmap;
struct KStylePrivate;
class KDEFX_EXPORT KStyle: public QCommonStyle
{
Q_OBJECT
public:
typedef uint KStyleFlags;
enum KStyleOption {
Default = 0x00000000,
AllowMenuTransparency = 0x00000001,
FilledFrameWorkaround = 0x00000002
};
enum KStyleScrollBarType {
WindowsStyleScrollBar = 0x00000000,
PlatinumStyleScrollBar = 0x00000001,
ThreeButtonScrollBar = 0x00000002,
NextStyleScrollBar = 0x00000004
};
KStyle( KStyleFlags flags = KStyle::Default,
KStyleScrollBarType sbtype = KStyle::WindowsStyleScrollBar );
~KStyle();
static QString defaultStyle();
void setScrollBarType(KStyleScrollBarType sbtype);
KStyleFlags styleFlags() const;
// ---------------------------------------------------------------------------
virtual void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup& cg,
const QPopupMenu* popup ) const;
enum KStylePrimitive {
KPE_DockWindowHandle,
KPE_ToolBarHandle,
KPE_GeneralHandle,
KPE_SliderGroove,
KPE_SliderHandle,
KPE_ListViewExpander,
KPE_ListViewBranch
};
virtual void drawKStylePrimitive( KStylePrimitive kpe,
QPainter* p,
const QWidget* widget,
const QRect &r,
const QColorGroup &cg,
SFlags flags = Style_Default,
const QStyleOption& = QStyleOption::Default ) const;
enum KStylePixelMetric {
KPM_MenuItemSeparatorHeight = 0x00000001,
KPM_MenuItemHMargin = 0x00000002,
KPM_MenuItemVMargin = 0x00000004,
KPM_MenuItemHFrame = 0x00000008,
KPM_MenuItemVFrame = 0x00000010,
KPM_MenuItemCheckMarkHMargin = 0x00000020,
KPM_MenuItemArrowHMargin = 0x00000040,
KPM_MenuItemTabSpacing = 0x00000080,
KPM_ListViewBranchThickness = 0x00000100
};
int kPixelMetric( KStylePixelMetric kpm, const QWidget* widget = 0 ) const;
// ---------------------------------------------------------------------------
void polish( QWidget* widget );
void unPolish( QWidget* widget );
void polishPopupMenu( QPopupMenu* );
void drawPrimitive( PrimitiveElement pe,
QPainter* p,
const QRect &r,
const QColorGroup &cg,
SFlags flags = Style_Default,
const QStyleOption& = QStyleOption::Default ) const;
void drawControl( ControlElement element,
QPainter* p,
const QWidget* widget,
const QRect &r,
const QColorGroup &cg,
SFlags flags = Style_Default,
const QStyleOption& = QStyleOption::Default ) const;
void drawComplexControl( ComplexControl control,
QPainter *p,
const QWidget* widget,
const QRect &r,
const QColorGroup &cg,
SFlags flags = Style_Default,
SCFlags controls = SC_All,
SCFlags active = SC_None,
const QStyleOption& = QStyleOption::Default ) const;
SubControl querySubControl( ComplexControl control,
const QWidget* widget,
const QPoint &pos,
const QStyleOption& = QStyleOption::Default ) const;
QRect querySubControlMetrics( ComplexControl control,
const QWidget* widget,
SubControl sc,
const QStyleOption& = QStyleOption::Default ) const;
int pixelMetric( PixelMetric m,
const QWidget* widget = 0 ) const;
QRect subRect( SubRect r,
const QWidget* widget ) const;
QPixmap stylePixmap( StylePixmap stylepixmap,
const QWidget* widget = 0,
const QStyleOption& = QStyleOption::Default ) const;
int styleHint( StyleHint sh,
const QWidget* w = 0,
const QStyleOption &opt = QStyleOption::Default,
QStyleHintReturn* shr = 0 ) const;
protected:
bool eventFilter( QObject* object, QEvent* event );
private:
// Disable copy constructor and = operator
KStyle( const KStyle & );
KStyle& operator=( const KStyle & );
protected:
virtual void virtual_hook( int id, void* data );
private:
KStylePrivate *d;
};
// vim: set noet ts=4 sw=4:
#endif
KStyle::KStyleScrollBarType
KStyleScrollBarType
KStyle ScrollBarType:
Definition: kstyle.h:109
KStyle::KStyleOption
KStyleOption
Definition: kstyle.h:80
KStyle::KStyleFlags
uint KStyleFlags
KStyle Flags:
Definition: kstyle.h:79
KPixmap
Off-screen paint device with extended features.
Definition: kpixmap.h:57
KStyle::Default
All options disabled.
Definition: kstyle.h:81
KStyle
Simplifies and extends the QStyle API to make style coding easier.
Definition: kstyle.h:57
KStyle::KStylePrimitive
KStylePrimitive
KStyle Primitive Elements:
Definition: kstyle.h:227
KStyle::WindowsStyleScrollBar
two button, windows style
Definition: kstyle.h:110

KDE Home | KDE Accessibility Home | Description of Access Keys