• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • kdecore
kaccelmanager_private.h
1 /* This file is part of the KDE project
2  Copyright (C) 2002 Matthias Hoelzer-Kluepfel <mhk@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 
21 #ifndef __KACCELMANAGER_PRIVATE_H__
22 #define __KACCELMANAGER_PRIVATE_H__
23 
24 
25 #include <tqstring.h>
26 #include <tqmemarray.h>
27 #include <tqvaluelist.h>
28 #include <tqobject.h>
29 
30 class TQWidgetStack;
31 
42 class KAccelString
43 {
44 public:
45 
46  KAccelString() : m_pureText(), m_accel(-1) {}
47  KAccelString(const TQString &input, int initalWeight=-1);
48 
49  void calculateWeights(int initialWeight);
50 
51  const TQString &pure() const { return m_pureText; }
52  TQString accelerated() const;
53 
54  int accel() const { return m_accel; }
55  void setAccel(int accel) { m_accel = accel; }
56 
57  int originalAccel() const { return m_orig_accel; }
58  TQString originalText() const { return m_origText; }
59 
60  TQChar accelerator() const;
61 
62  int maxWeight(int &index, const TQString &used);
63 
64  bool operator == (const KAccelString &c) const { return m_pureText == c.m_pureText && m_accel == c.m_accel && m_orig_accel == c.m_orig_accel; }
65 
66 
67 private:
68 
69  int stripAccelerator(TQString &input);
70 
71  void dump();
72 
73  TQString m_pureText, m_origText;
74  int m_accel, m_orig_accel;
75  TQMemArray<int> m_weight;
76 
77 };
78 
79 
80 typedef TQValueList<KAccelString> KAccelStringList;
81 
82 
90 class KAccelManagerAlgorithm
91 {
92 public:
93 
95  enum {
97  DEFAULT_WEIGHT = 50,
99  FIRST_CHARACTER_EXTRA_WEIGHT = 50,
101  WORD_BEGINNING_EXTRA_WEIGHT = 50,
103  DIALOG_BUTTON_EXTRA_WEIGHT = 300,
105  WANTED_ACCEL_EXTRA_WEIGHT = 150,
107  ACTION_ELEMENT_WEIGHT = 50,
109  GROUP_BOX_WEIGHT = -2000,
111  MENU_TITLE_WEIGHT = 250,
113  STANDARD_ACCEL = 300
114  };
115 
117  static void findAccelerators(KAccelStringList &result, TQString &used);
118 
119 };
120 
121 
122 class TQPopupMenu;
123 
124 
134 class KPopupAccelManager : public TQObject
135 {
136  Q_OBJECT
137 
138 public:
139 
140  static void manage(TQPopupMenu *popup);
141 
142 
143 protected:
144 
145  KPopupAccelManager(TQPopupMenu *popup);
146 
147 
148 private slots:
149 
150  void aboutToShow();
151 
152 
153 private:
154 
155  void calculateAccelerators();
156 
157  void findMenuEntries(KAccelStringList &list);
158  void setMenuEntries(const KAccelStringList &list);
159 
160  TQPopupMenu *m_popup;
161  KAccelStringList m_entries;
162  int m_count;
163 
164 };
165 
166 
167 class QWidgetStackAccelManager : public TQObject
168 {
169  Q_OBJECT
170 
171 public:
172 
173  static void manage(TQWidgetStack *popup);
174 
175 
176 protected:
177 
178  QWidgetStackAccelManager(TQWidgetStack *popup);
179 
180 
181 private slots:
182 
183  void aboutToShow(TQWidget *);
184  bool eventFilter ( TQObject * watched, TQEvent * e );
185 
186 private:
187 
188  void calculateAccelerators();
189 
190  TQWidgetStack *m_stack;
191  KAccelStringList m_entries;
192 
193 };
194 
195 
196 #endif

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |