• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • 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
28class KAction;
29
30namespace KTextEditor
31{
32
33class SmartRange;
34
60class KTEXTEDITOR_EXPORT Attribute : public QTextCharFormat, public KShared
61{
62 friend class SmartRange;
63
64 public:
65 typedef KSharedPtr<Attribute> Ptr;
66
70 Attribute();
71
75 Attribute(const Attribute& a);
76
80 virtual ~Attribute();
81
89 void changed() const;
90
91 //BEGIN custom properties
95 enum CustomProperties {
97 Outline = QTextFormat::UserProperty,
99 SelectedForeground,
101 SelectedBackground,
103 BackgroundFillWhitespace,
105 AttributeDynamicEffect = 0x10A00,
107 AttributeInternalProperty = 0x10E00,
109 AttributeUserProperty = 0x110000
110 };
111
126 bool fontBold() const;
127
135 void setFontBold(bool bold = true);
136
142 QBrush outline() const;
143
151 void setOutline(const QBrush& brush);
152
158 QBrush selectedForeground() const;
159
167 void setSelectedForeground(const QBrush& foreground);
168
174 QBrush selectedBackground() const;
175
183 void setSelectedBackground(const QBrush& brush);
184
190 bool backgroundFillWhitespace() const;
191
199 void setBackgroundFillWhitespace(bool fillWhitespace);
200
201 // Fix deficiencies in QText{Char}Format
205 void clear();
206
212 bool hasAnyProperty() const;
213 //END
214
215 //BEGIN Action association
234 void associateAction(KAction* action);
235
242 void dissociateAction(KAction* action);
243
247 const QList<KAction*>& associatedActions() const;
248
252 void clearAssociatedActions();
254 //END
255
256 //BEGIN Dynamic highlighting
262 enum ActivationType {
264 ActivateMouseIn = 0,
266 ActivateCaretIn
267 };
268
273 enum Effect {
274 EffectNone = 0x0 ,
275 EffectFadeIn = 0x1 ,
276 EffectFadeOut = 0x2 ,
277 EffectPulse = 0x4 ,
278 EffectCycleGradient = 0x8
279 };
280 Q_DECLARE_FLAGS(Effects, Effect)
296 Attribute::Ptr dynamicAttribute(ActivationType type) const;
297
306 void setDynamicAttribute(ActivationType type, Attribute::Ptr attribute);
307
308 Effects effects() const;
309 void setEffects(Effects effects);
311 //END
312
320 Attribute& operator+=(const Attribute& a);
321
327 Attribute& operator=(const Attribute& a);
328
329 protected:
343 private:
344 class AttributePrivate* const d;
345};
346
347Q_DECLARE_OPERATORS_FOR_FLAGS(Attribute::Effects)
348
349}
350
351#endif
352
353// kate: space-indent on; indent-width 2; replace-tabs on;
KAction
KSharedPtr
KShared
KTextEditor::Attribute
A class which provides customized text decorations.
Definition: attribute.h:61
KTextEditor::Attribute::ActivationType
ActivationType
Several automatic activation mechanisms exist for associated attributes.
Definition: attribute.h:262
KTextEditor::Attribute::changed
void changed() const
Notify the editor implementation that a property of this attribute has been changed.
KTextEditor::Attribute::Effect
Effect
Dynamic effects for display.
Definition: attribute.h:273
KTextEditor::Attribute::CustomProperties
CustomProperties
Custom property types, which may or may not be supported by implementations.
Definition: attribute.h:95
KTextEditor::Attribute::SelectedBackground
@ SelectedBackground
Changes the brush used to paint the background when it is selected.
Definition: attribute.h:101
KTextEditor::Attribute::SelectedForeground
@ SelectedForeground
Changes the brush used to paint the text when it is selected.
Definition: attribute.h:99
KTextEditor::Attribute::BackgroundFillWhitespace
@ BackgroundFillWhitespace
Determines whether background color is drawn over whitespace. Defaults to true.
Definition: attribute.h:103
KTextEditor::Attribute::Ptr
KSharedPtr< Attribute > Ptr
Definition: attribute.h:65
KTextEditor::Attribute::associateAction
void associateAction(KAction *action)
Associate an action with this attribute.
KTextEditor::Attribute::dissociateAction
void dissociateAction(KAction *action)
Remove the association with an action from this attribute; it will no longer be managed by associated...
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:95
QList
QTextCharFormat
ksharedptr.h
ktexteditor_export.h
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
KTextEditor
Namespace for the KDE Text Editor Interfaces.
Definition: annotationinterface.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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