• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • kde-4.14
  • applications
  • kate
  • ktexteditor
attribute.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  * Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KDELIBS_KTEXTEDITOR_ATTRIBUTE_H
21 #define KDELIBS_KTEXTEDITOR_ATTRIBUTE_H
22 
23 #include <QtGui/QTextFormat>
24 
25 #include <ksharedptr.h>
26 #include <ktexteditor/ktexteditor_export.h>
27 
28 class KAction;
29 
30 namespace KTextEditor
31 {
32 
58 class KTEXTEDITOR_EXPORT Attribute : public QTextCharFormat, public KShared
59 {
60  public:
61  typedef KSharedPtr<Attribute> Ptr;
62 
66  Attribute();
67 
71  Attribute(const Attribute& a);
72 
76  virtual ~Attribute();
77 
85  void changed() const;
86 
87  //BEGIN custom properties
91  enum CustomProperties {
93  Outline = QTextFormat::UserProperty,
95  SelectedForeground,
97  SelectedBackground,
99  BackgroundFillWhitespace,
101  AttributeDynamicEffect = 0x10A00,
103  AttributeInternalProperty = 0x10E00,
105  AttributeUserProperty = 0x110000
106  };
107 
122  bool fontBold() const;
123 
131  void setFontBold(bool bold = true);
132 
138  QBrush outline() const;
139 
147  void setOutline(const QBrush& brush);
148 
154  QBrush selectedForeground() const;
155 
163  void setSelectedForeground(const QBrush& foreground);
164 
170  QBrush selectedBackground() const;
171 
179  void setSelectedBackground(const QBrush& brush);
180 
186  bool backgroundFillWhitespace() const;
187 
195  void setBackgroundFillWhitespace(bool fillWhitespace);
196 
197  // Fix deficiencies in QText{Char}Format
201  void clear();
202 
208  bool hasAnyProperty() const;
209  //END
210 
211  //BEGIN Action association
230  void associateAction(KAction* action);
231 
238  void dissociateAction(KAction* action);
239 
243  const QList<KAction*>& associatedActions() const;
244 
248  void clearAssociatedActions();
250  //END
251 
252  //BEGIN Dynamic highlighting
258  enum ActivationType {
260  ActivateMouseIn = 0,
262  ActivateCaretIn
263  };
264 
269  enum Effect {
270  EffectNone = 0x0 ,
271  EffectFadeIn = 0x1 ,
272  EffectFadeOut = 0x2 ,
273  EffectPulse = 0x4 ,
274  EffectCycleGradient = 0x8
275  };
276  Q_DECLARE_FLAGS(Effects, Effect)
292  Attribute::Ptr dynamicAttribute(ActivationType type) const;
293 
302  void setDynamicAttribute(ActivationType type, Attribute::Ptr attribute);
303 
304  Effects effects() const;
305  void setEffects(Effects effects);
307  //END
308 
316  Attribute& operator+=(const Attribute& a);
317 
323  Attribute& operator=(const Attribute& a);
324 
325  private:
326  class AttributePrivate* const d;
327 };
328 
329 Q_DECLARE_OPERATORS_FOR_FLAGS(Attribute::Effects)
330 
331 }
332 
333 #endif
334 
335 // kate: space-indent on; indent-width 2; replace-tabs on;
KTextEditor::Attribute::Effect
Effect
Dynamic effects for display.
Definition: attribute.h:269
KTextEditor::Attribute
A class which provides customized text decorations.
Definition: attribute.h:58
QBrush
KTextEditor::Attribute::BackgroundFillWhitespace
Determines whether background color is drawn over whitespace. Defaults to true.
Definition: attribute.h:99
KTextEditor::Attribute::CustomProperties
CustomProperties
Custom property types, which may or may not be supported by implementations.
Definition: attribute.h:91
ktexteditor_export.h
KTextEditor::Attribute::Ptr
KSharedPtr< Attribute > Ptr
Definition: attribute.h:61
KTEXTEDITOR_EXPORT
#define KTEXTEDITOR_EXPORT
Definition: ktexteditor_export.h:35
QList< KAction * >
KTextEditor::Attribute::SelectedBackground
Changes the brush used to paint the background when it is selected.
Definition: attribute.h:97
QTextCharFormat
KTextEditor::Attribute::ActivationType
ActivationType
Several automatic activation mechanisms exist for associated attributes.
Definition: attribute.h:258
KTextEditor::Attribute::SelectedForeground
Changes the brush used to paint the text when it is selected.
Definition: attribute.h:95
KShared
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal