21#ifndef __TDEACCELMANAGER_PRIVATE_H__
22#define __TDEACCELMANAGER_PRIVATE_H__
26#include <tqmemarray.h>
27#include <tqvaluelist.h>
46 TDEAccelString() : m_pureText(), m_accel(-1) {}
47 TDEAccelString(
const TQString &input,
int initalWeight=-1);
49 void calculateWeights(
int initialWeight);
51 const TQString &pure()
const {
return m_pureText; }
52 TQString accelerated()
const;
54 int accel()
const {
return m_accel; }
55 void setAccel(
int accel) { m_accel = accel; }
57 int originalAccel()
const {
return m_orig_accel; }
58 TQString originalText()
const {
return m_origText; }
60 TQChar accelerator()
const;
62 int maxWeight(
int &index,
const TQString &used);
64 bool operator == (
const TDEAccelString &c)
const {
return m_pureText == c.m_pureText && m_accel == c.m_accel && m_orig_accel == c.m_orig_accel; }
69 int stripAccelerator(TQString &input);
73 TQString m_pureText, m_origText;
74 int m_accel, m_orig_accel;
75 TQMemArray<int> m_weight;
80typedef TQValueList<TDEAccelString> TDEAccelStringList;
134class TDEPopupAccelManager :
public TQObject
140 static void manage(TQPopupMenu *popup);
145 TDEPopupAccelManager(TQPopupMenu *popup);
155 void calculateAccelerators();
157 void findMenuEntries(TDEAccelStringList &list);
158 void setMenuEntries(
const TDEAccelStringList &list);
160 TQPopupMenu *m_popup;
161 TDEAccelStringList m_entries;
167class QWidgetStackAccelManager :
public TQObject
173 static void manage(TQWidgetStack *popup);
178 QWidgetStackAccelManager(TQWidgetStack *popup);
183 void aboutToShow(TQWidget *);
184 bool eventFilter ( TQObject * watched, TQEvent * e );
188 void calculateAccelerators();
190 TQWidgetStack *m_stack;
191 TDEAccelStringList m_entries;
This class encapsulates the algorithm finding the 'best' distribution of accelerators in a hierarchy ...
@ FIRST_CHARACTER_EXTRA_WEIGHT
Additional weight for first character in string.
@ STANDARD_ACCEL
Additional weight for KDE standard accelerators.
@ MENU_TITLE_WEIGHT
Default weight for menu titles.
@ GROUP_BOX_WEIGHT
Default weight for group boxes (low priority).
@ DIALOG_BUTTON_EXTRA_WEIGHT
Additional weight for the dialog buttons (large, we basically never want these reassigned).
@ WANTED_ACCEL_EXTRA_WEIGHT
Additional weight for a 'wanted' accelerator.
@ DEFAULT_WEIGHT
Default control weight.
@ WORD_BEGINNING_EXTRA_WEIGHT
Additional weight for the beginning of a word.
@ ACTION_ELEMENT_WEIGHT
Default weight for an 'action' widget (ie, pushbuttons).
static void findAccelerators(TDEAccelStringList &result, TQString &used)
Method to call to find the best distribution of accelerators.