~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipeui/ipeui.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-12-11 21:22:35 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091211212235-5iio4nzpra64snab
Tags: 7.0.10-1
* New upstream.  Closes: #551192.
  - New build-depends: libcairo2-dev, liblua5.1-0-dev, gsfonts
  - patches/config.diff: Remove.  Upstream build system replaced.
  - Runtime lib package changed to libipe7.0.10 from libipe1c2a
  - Devel package renamed to libipe-dev (from libipe1-dev)
  - Package ipe depends on lua5.1 due to ipe-update-master.

* rules: Re-write to use dh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
// --------------------------------------------------------------------
 
3
// A UI toolkit for Lua
 
4
// --------------------------------------------------------------------
 
5
/*
 
6
 
 
7
    This file is part of the extensible drawing editor Ipe.
 
8
    Copyright (C) 1993-2009  Otfried Cheong
 
9
 
 
10
    Ipe is free software; you can redistribute it and/or modify it
 
11
    under the terms of the GNU General Public License as published by
 
12
    the Free Software Foundation; either version 3 of the License, or
 
13
    (at your option) any later version.
 
14
 
 
15
    As a special exception, you have permission to link Ipe with the
 
16
    CGAL library and distribute executables, as long as you follow the
 
17
    requirements of the Gnu General Public License in regard to all of
 
18
    the software in the executable aside from CGAL.
 
19
 
 
20
    Ipe is distributed in the hope that it will be useful, but WITHOUT
 
21
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
22
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
23
    License for more details.
 
24
 
 
25
    You should have received a copy of the GNU General Public License
 
26
    along with Ipe; if not, you can find it at
 
27
    "http://www.gnu.org/copyleft/gpl.html", or write to the Free
 
28
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
29
 
 
30
*/
 
31
 
 
32
#ifndef IPEDIALOGS_H
 
33
#define IPEDIALOGS_H
 
34
 
 
35
#include <QDialog>
 
36
#include <QGridLayout>
 
37
#include <QAction>
 
38
 
 
39
class QTimer;
 
40
 
 
41
// avoid including Lua headers here
 
42
typedef struct lua_State lua_State;
 
43
 
 
44
namespace ipeui {
 
45
 
 
46
  // --------------------------------------------------------------------
 
47
 
 
48
  class MenuAction : public QAction {
 
49
    Q_OBJECT
 
50
  public:
 
51
    MenuAction(const QString &name, int number,
 
52
               const QString &item, const QString &text,
 
53
               QWidget *parent);
 
54
    QString name() const { return iName; }
 
55
    QString itemName() const { return iItemName; }
 
56
    int number() const { return iNumber; }
 
57
 
 
58
  private:
 
59
    QString iName;
 
60
    QString iItemName;
 
61
    int iNumber;
 
62
  };
 
63
 
 
64
  class Timer : public QObject {
 
65
    Q_OBJECT
 
66
  public:
 
67
    Timer(lua_State *L0, int lua_object, const QString &method);
 
68
    ~Timer();
 
69
 
 
70
    int setSingleShot(lua_State *L);
 
71
    int setInterval(lua_State *L);
 
72
    int active(lua_State *L);
 
73
    int start(lua_State *L);
 
74
    int stop(lua_State *L);
 
75
 
 
76
  private slots:
 
77
    void callLua();
 
78
 
 
79
  private:
 
80
    lua_State *L;
 
81
    QTimer *iTimer;
 
82
    int iLuaObject;
 
83
    QString iMethod;
 
84
  };
 
85
 
 
86
  // --------------------------------------------------------------------
 
87
 
 
88
  class Dialog : public QDialog {
 
89
    Q_OBJECT
 
90
 
 
91
    public:
 
92
    Dialog(lua_State *L0, QWidget *parent);
 
93
    ~Dialog();
 
94
 
 
95
    QGridLayout *gridlayout();
 
96
 
 
97
    // Lua methods
 
98
    int add(lua_State *L);
 
99
    int set(lua_State *L);
 
100
    int get(lua_State *L);
 
101
    int setEnabled(lua_State *L);
 
102
    int execute(lua_State *L);
 
103
 
 
104
  private slots:
 
105
    void callLua();
 
106
 
 
107
  private:
 
108
    enum { ELogFile = 0x001, EXml = 0x002 };
 
109
 
 
110
    struct SElement {
 
111
      QString name;
 
112
      QWidget *widget;
 
113
      int lua_method;
 
114
      uint flags;
 
115
    };
 
116
 
 
117
    int findElement(lua_State *L, int index);
 
118
 
 
119
    void addButton(lua_State *L, SElement &m);
 
120
    void addTextEdit(lua_State *L, SElement &m);
 
121
    void addList(lua_State *L, SElement &m);
 
122
    void addLabel(lua_State *L, SElement &m);
 
123
    void addCombo(lua_State *L, SElement &m);
 
124
    void addCheckbox(lua_State *L, SElement &m);
 
125
    void addInput(lua_State *L, SElement &m);
 
126
 
 
127
  private:
 
128
    lua_State *L;
 
129
    std::vector<SElement> iElements;
 
130
    int iLuaDialog;
 
131
  };
 
132
 
 
133
} // namespace
 
134
 
 
135
// --------------------------------------------------------------------
 
136
#endif