summaryrefslogtreecommitdiffstats
path: root/kicker/applets/launcher/quickbuttongroup.h
blob: d45480542c5f94dde7448c9e062b35522ca0e0ff (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
/*  Copyright 2004, Daniel Woods Bullok <[email protected]>
    distributed under the terms of the
    GNU GENERAL PUBLIC LICENSE Version 2 -
    See the file tdebase/COPYING for details
*/

#ifndef __quickbuttongroup_h__
#define __quickbuttongroup_h__

#include <tqstring.h>
#include <functional>
#include "easyvector.h"
#include "quickbutton.h"


class QuickButtonGroup: virtual public EasyVector< QuickButton* > {
public:
    QuickButtonGroup(const EasyVector< QuickButton* > &kv):EasyVector< QuickButton* >(kv){};
    QuickButtonGroup():EasyVector< QuickButton* >(){};
    Index findDescriptor(const TQString &desc);

    void show();
    void hide();
    void setDragging(bool drag);
    void setEnableDrag(bool enable);
    void deleteContents();
    void setUpdatesEnabled(bool enable);
};

QuickButtonGroup::Index QuickButtonGroup::findDescriptor(const TQString &desc)
{   return findProperty(desc, std::mem_fn(&QuickButton::url));}

inline void QuickButtonGroup::setUpdatesEnabled(bool enable)
{   for (QuickButtonGroup::iterator i=begin();i!=end();++i) {
        (*i)->setUpdatesEnabled(enable);
        if (enable) { (*i)->update();}
    }
}

inline void QuickButtonGroup::show()
{   std::for_each(begin(),end(),std::mem_fn(&TQWidget::show));}

inline void QuickButtonGroup::hide()
{   std::for_each(begin(),end(),std::mem_fn(&TQWidget::hide));}

inline void QuickButtonGroup::setDragging(bool drag)
{   std::for_each(begin(),end(),std::bind(std::mem_fn(&QuickButton::setDragging),std::placeholders::_1,drag));}

inline void QuickButtonGroup::setEnableDrag(bool enable)
{   std::for_each(begin(),end(),std::bind(std::mem_fn(&QuickButton::setEnableDrag),std::placeholders::_1,enable));}

inline void QuickButtonGroup::deleteContents()
{   for (QuickButtonGroup::iterator i=begin();i!=end();++i) {
        delete (*i);
        (*i)=0;
    }
}

#endif