aboutsummaryrefslogtreecommitdiff
path: root/demos/widgetsgallery/toolbarpage.h
blob: 95ef8bfda23da1dacbb8a3792025cfd84a03f793 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#ifndef TOOLBARPAGE_H
#define TOOLBARPAGE_H

#include "templatepage.h"
#include <MList>

class MToolBar;
class MGridLayoutPolicy;
class MList;

class TestModel : public QAbstractListModel
{
   Q_OBJECT

public:
   enum CallMode {
       MissedCall,
       ReceivedCall,
       InitiatedCall
   };
   TestModel(QObject *parent = 0);

   int rowCount(const QModelIndex &parent = QModelIndex()) const;

   QVariant data(const QModelIndex &index, int role) const;

   void reloadData();

   void setMode(CallMode mode);

private:
   CallMode mode;
   int maxRowCount;
   QStringList listNames;

};

class MContentItemCreator;
class ToolBarPage : public TemplatePage
{
    Q_OBJECT

public:
    ToolBarPage();
    virtual ~ToolBarPage();
    virtual QString timedemoTitle();

    virtual void createContent();

protected:
    virtual void createLayout();
    virtual void retranslateUi();

private slots:
    void fourButtons();
    void textEntryWithTwoButtons();
    void selectToolbarDefaultView();
    void selectToolbarTabView();
    void populateCallMissed();
    void populateCallReceived();
    void populateCallInitiated();
    void showCallDataAsList();
    void showCallDataAsGrid();

private:
    void addTextEntry();
    void clearToolbarActions();
    void addButtonsToTabView();

    MList* callList;
    TestModel* callModel;
    MContentItemCreator * cellCreator;

    MAction * exampleAction1;
    MAction * exampleAction2;
    MAction * defaultViewAction;
    MAction * tabViewAction;

    bool isDefaultView;

};

#endif