1 /****************************************************************************
5 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
11 #ifndef _TAB_WIDGET_H_
12 #define _TAB_WIDGET_H_
29 TYPE_GENERIC
= TYPE_FIRST
,
30 TYPE_COMMAND_URL_SHORTCUT
,
31 TYPE_MENUENTRY_SHORTCUT
,
33 TYPE_KEYBOARD_INPUT_SHORTCUT
,
34 TYPE_KEYBOARD_INPUT_GESTURE
,
35 TYPE_ACTIVATE_WINDOW_SHORTCUT
,
38 Tab_widget( QWidget
* parent_P
= NULL
, const char* name_P
= NULL
);
39 virtual ~Tab_widget();
40 void set_action_type( action_type_t type_P
, bool force_P
= false );
41 void save_current_action_changes();
42 void load_current_action();
44 static action_type_t
type( const Action_data
* data_P
);
45 Q_SIGNALS
: // internal
46 void clear_pages_signal();
48 void set_action_type_slot( int type_P
);
50 void check_action_type();
52 void show_pages( const Pages_set
& pages_P
);
53 enum tab_pos_t
{ TAB_FIRST
, TAB_INFO
= TAB_FIRST
, TAB_GENERAL_SETTINGS
, TAB_GESTURES_SETTINGS
,
54 TAB_GENERAL
, TAB_GROUP_GENERAL
,
55 TAB_TRIGGERS
, TAB_SHORTCUT_TRIGGER
, TAB_GESTURE_TRIGGER
, TAB_ACTIONS
, TAB_COMMAND_URL
,
56 TAB_MENUENTRY
, TAB_DBUS
, TAB_KEYBOARD_INPUT
, TAB_WINDOW
, TAB_CONDITIONS
, TAB_VOICE_SETTINGS
, TAB_END
};
57 QWidget
* pages
[ TAB_END
];
58 enum tab_show_type_t
{ NONE
, DATA
, GROUP
};
59 tab_show_type_t current_type
;
60 action_type_t current_data_type
;
61 static const char* const tab_labels
[];
62 class Pages_set
// that main reason for existence of this class is the fact that
63 { // I was very curious if overloading operator, ( = comma ) really
64 public: // works ( it does, but not exactly as I expected :( )
65 Pages_set( tab_pos_t page_P
);
66 Pages_set
& operator,( tab_pos_t page_P
);
67 bool is_set( tab_pos_t page_P
) const;
71 friend Pages_set
operator,( tab_pos_t page1_P
, tab_pos_t page2_P
); // CHECKME
72 friend tab_pos_t
& operator++( tab_pos_t
& val_P
); // CHECKME
75 //***************************************************************************
77 //***************************************************************************
83 Tab_widget::tab_pos_t
& operator++( Tab_widget::tab_pos_t
& val_P
)
85 val_P
= static_cast< Tab_widget::tab_pos_t
>( val_P
+ 1 );
90 void Tab_widget::clear_pages()
92 emit
clear_pages_signal();
95 // Tab_widget::Pages_set
98 Tab_widget::Pages_set::Pages_set( tab_pos_t page_P
)
100 for( tab_pos_t i
= TAB_FIRST
;
104 set
[ page_P
] = true;
108 bool Tab_widget::Pages_set::is_set( tab_pos_t page_P
) const
110 return set
[ page_P
];
114 Tab_widget::Pages_set
& Tab_widget::Pages_set::operator,( tab_pos_t page_P
)
116 set
[ page_P
] = true;
121 Tab_widget::Pages_set
operator,( Tab_widget::tab_pos_t page1_P
, Tab_widget::tab_pos_t page2_P
)
123 return Tab_widget::Pages_set( page1_P
), page2_P
;
128 Tab_widget::action_type_t
& operator++( Tab_widget::action_type_t
& val_P
)
130 val_P
= static_cast< Tab_widget::action_type_t
>( val_P
+ 1 );
134 } // namespace KHotKeys