summaryrefslogtreecommitdiffstats
path: root/src/kommando.h
blob: 73cab7f511c0ada78c6b06ad19e11e2987e2aebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************************
 *   Copyright (C) 2005 by Daniel Stöckel                                  *
 *   [email protected]                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef _KOMMANDO_H_
#define _KOMMANDO_H_

#include <ntqwidget.h>
#include <ntqptrlist.h>

#include <kpixmap.h>

#include "menu.h"

class Kommando : public TQWidget
{
    Q_OBJECT

    public:
        Kommando();

        /*
        * The window needs to appear at the mousecursors current position
        * overriding TQWidget::show() makes this easy, showEvent() does not
        * work properly though.
        */
        virtual void show();
        virtual void hide();
        virtual void toggle();
        virtual void execute();
        virtual void selectButton(int num);
        virtual void nextButton() { selectButton(actMenu->selectedButtonNum()+1); }
        virtual void previousButton() { selectButton(actMenu->selectedButtonNum()-1); }

        virtual void setActTopLevelMenu(const TQString& appName);
        virtual void setActMenu(Menu* newmenu);
        virtual void setTopLevelMenus(const TQPtrList<Menu>& newmenus);
        //virtual Menu* getMainMenu(){return mainMenu;}
        virtual const TQPixmap* screenshot(){return &mScreenshot;}
        virtual void setNavButtonSize(unsigned short size);
        virtual void resize();

    public slots:
        //Slot for TDEGlobalAccel
        virtual void slotGlobAccel();

    protected:
        Menu* actMenu;
        TQPtrList<Menu> mTopLevelMenus;
        RoundButton navbutton;
        bool middleMouseButtonState;
        int oldNavbuttonIconType;  //holds whether the icon should be changed
        KPixmap mScreenshot;

        //Some events
        virtual void paintEvent (TQPaintEvent* evt);
        virtual void windowActivationChange ( bool oldActive );
        virtual void wheelEvent (TQWheelEvent * evt);
        virtual void keyPressEvent(TQKeyEvent* evt);
        virtual void mousePressEvent(TQMouseEvent* evt);
        virtual void mouseReleaseEvent(TQMouseEvent* evt);

    protected slots:
        virtual void slotOnClick();
        virtual void slotNavClick();
        virtual void slotButtonSelected(int type);
};

#endif // _KOMMANDO_H_