~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/lib/Item.h

  • Committer: Package Import Robot
  • Author(s): Whoopie
  • Date: 2012-03-22 10:29:10 UTC
  • mfrom: (4.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120322102910-tb8hugi2su1tguwh
Tags: 1.0.2-1ubuntu1
* Apply some upstream patches to fix FTBFS (LP: #913018):
  - debian/patches/05_glib_includes.patch: fix glib includes.
  - debian/patches/06_use_XkbKeycodeToKeysym.patch: use 
    XkbKeycodeToKeysym instead of (deprecated) XKeycodeToKeysym.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2009 by Savoir-Faire Linux                              *
 
3
 *   Author : Jérémy Quentin                                               *
 
4
 *   jeremy.quentin@savoirfairelinux.com                                   *
 
5
 *                                                                         *
 
6
 *   This program is free software; you can redistribute it and/or modify  *
 
7
 *   it under the terms of the GNU General Public License as published by  *
 
8
 *   the Free Software Foundation; either version 3 of the License, or     *
 
9
 *   (at your option) any later version.                                   *
 
10
 *                                                                         *
 
11
 *   This program is distributed in the hope that it will be useful,       *
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
14
 *   GNU General Public License for more details.                          *
 
15
 *                                                                         *
 
16
 *   You should have received a copy of the GNU General Public License     *
 
17
 *   along with this program; if not, write to the                         *
 
18
 *   Free Software Foundation, Inc.,                                       *
 
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
20
 **************************************************************************/
 
21
#ifndef ITEM_H
 
22
#define ITEM_H
 
23
 
 
24
#include "typedefs.h"
 
25
 
 
26
class QListWidgetItem;
 
27
 
 
28
/**
 
29
        @author Jérémy Quentin <jeremy.quentin@gmail.com>         
 
30
        Represents an item of a list, that is displayed           
 
31
        by an QListWidgetItem with a QWidget inside.              
 
32
        The two objects are contained in this class, but their    
 
33
        initializations are pure virtual.                         
 
34
        The template class WIDGET_TYPE should be derived from     
 
35
        QWidget.                                                  
 
36
        The implementation of initItem should call initItemWidget 
 
37
*/
 
38
template<class WIDGET_TYPE>class LIB_EXPORT Item
 
39
{
 
40
protected:
 
41
        QListWidgetItem * item;
 
42
        WIDGET_TYPE * itemWidget;
 
43
        
 
44
 
 
45
public:
 
46
        /**
 
47
         *  Would be great to take the QListWidget as attribute         
 
48
         *  to be able to add the itemWidget to the item in the list.   
 
49
         *  For the moment, we have to do it from outside.              
 
50
         */
 
51
        Item(/*QListWidget *list=0*/) {
 
52
                item = NULL;
 
53
                itemWidget = NULL;
 
54
        }
 
55
        
 
56
        /**
 
57
         *   Be careful that it is not already deleted by QObject 
 
58
         *   Commented for safety reasons...                      
 
59
         */
 
60
        virtual ~Item() {
 
61
//              delete item;
 
62
//              delete itemWidget;
 
63
        }
 
64
        
 
65
        QListWidgetItem* getItem() {
 
66
                return item;
 
67
        }
 
68
        
 
69
        WIDGET_TYPE* getItemWidget() {
 
70
                return itemWidget;
 
71
        }
 
72
        
 
73
        const QListWidgetItem* getItem() const {
 
74
                return item;
 
75
        }
 
76
        const WIDGET_TYPE* getItemWidget() const {
 
77
                return itemWidget;
 
78
        }
 
79
        
 
80
        /**
 
81
         *   Initializes the item and widget            
 
82
         *   Implementation should call initItemWidget! 
 
83
         */
 
84
        virtual void initItem() = 0;
 
85
        
 
86
protected:
 
87
        virtual void initItemWidget() = 0;
 
88
        
 
89
        
 
90
};
 
91
 
 
92
#endif