KTextEditor
attribute.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KDELIBS_KTEXTEDITOR_ATTRIBUTE_H
00020 #define KDELIBS_KTEXTEDITOR_ATTRIBUTE_H
00021
00022 #include <QtGui/QTextFormat>
00023
00024 #include <ksharedptr.h>
00025 #include <ktexteditor/ktexteditor_export.h>
00026
00027 class KAction;
00028
00029 namespace KTextEditor
00030 {
00031
00032 class SmartRange;
00033
00059 class KTEXTEDITOR_EXPORT Attribute : public QTextCharFormat, public KShared
00060 {
00061 friend class SmartRange;
00062
00063 public:
00064 typedef KSharedPtr<Attribute> Ptr;
00065
00069 Attribute();
00070
00074 Attribute(const Attribute& a);
00075
00079 virtual ~Attribute();
00080
00088 void changed() const;
00089
00090
00094 enum CustomProperties {
00096 Outline = QTextFormat::UserProperty,
00098 SelectedForeground,
00100 SelectedBackground,
00102 BackgroundFillWhitespace,
00104 AttributeDynamicEffect = 0x10A00,
00106 AttributeInternalProperty = 0x10E00,
00108 AttributeUserProperty = 0x110000
00109 };
00110
00125 bool fontBold() const;
00126
00134 void setFontBold(bool bold = true);
00135
00141 QBrush outline() const;
00142
00150 void setOutline(const QBrush& brush);
00151
00157 QBrush selectedForeground() const;
00158
00166 void setSelectedForeground(const QBrush& foreground);
00167
00173 QBrush selectedBackground() const;
00174
00182 void setSelectedBackground(const QBrush& brush);
00183
00189 bool backgroundFillWhitespace() const;
00190
00198 void setBackgroundFillWhitespace(bool fillWhitespace);
00199
00200
00204 void clear();
00205
00211 bool hasAnyProperty() const;
00212
00213
00214
00233 void associateAction(KAction* action);
00234
00241 void dissociateAction(KAction* action);
00242
00246 const QList<KAction*>& associatedActions() const;
00247
00251 void clearAssociatedActions();
00253
00254
00255
00261 enum ActivationType {
00263 ActivateMouseIn = 0,
00265 ActivateCaretIn
00266 };
00267
00272 enum Effect {
00273 EffectNone = 0x0 ,
00274 EffectFadeIn = 0x1 ,
00275 EffectFadeOut = 0x2 ,
00276 EffectPulse = 0x4 ,
00277 EffectCycleGradient = 0x8
00278 };
00279 Q_DECLARE_FLAGS(Effects, Effect)
00295 Attribute::Ptr dynamicAttribute(ActivationType type) const;
00296
00305 void setDynamicAttribute(ActivationType type, Attribute::Ptr attribute);
00306
00307 Effects effects() const;
00308 void setEffects(Effects effects);
00310
00311
00319 Attribute& operator+=(const Attribute& a);
00320
00326 Attribute& operator=(const Attribute& a);
00327
00328 protected:
00342 private:
00343 class AttributePrivate* const d;
00344 };
00345
00346 Q_DECLARE_OPERATORS_FOR_FLAGS(Attribute::Effects)
00347
00348 }
00349
00350 #endif
00351
00352