~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to widgets/nentry.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//=========================================================
 
2
//  MusE
 
3
//  Linux Music Editor
 
4
//    $Id: nentry.h,v 1.2 2001/11/20 15:19:35 muse Exp $
 
5
//  (C) Copyright 1999 Werner Schweer (ws@seh.de)
 
6
//=========================================================
 
7
 
 
8
#ifndef __NENTRY_H__
 
9
#define __NENTRY_H__
 
10
 
 
11
#include <qframe.h>
 
12
#include <qlineedit.h>
 
13
#include <qstring.h>
 
14
 
 
15
class QTimer;
 
16
class QHBoxLayout;
 
17
class QLabel;
 
18
 
 
19
class NentryFilter : public QObject {
 
20
   protected:
 
21
      bool eventFilter(QObject* object, QEvent* event);
 
22
   public:
 
23
      NentryFilter(QObject* parent);
 
24
      };
 
25
 
 
26
//---------------------------------------------------------
 
27
//   Nentry
 
28
//    numerical entry widget with optional label
 
29
//---------------------------------------------------------
 
30
 
 
31
class Nentry : public QFrame {
 
32
      int button;
 
33
      int starty;
 
34
      bool drawFrame;
 
35
      QTimer* timer;
 
36
      int evx;
 
37
      int timecount;
 
38
      QHBoxLayout* layout;
 
39
      QObject* filter;
 
40
      QLabel* label;
 
41
      int lPos;   // label Position 0 - left, 1 - right
 
42
      QWidget* focusW;
 
43
      Q_OBJECT
 
44
 
 
45
   protected:
 
46
      QLineEdit* edit;
 
47
      int val;
 
48
      virtual void incValue(int x) = 0;
 
49
      virtual void decValue(int x) = 0;
 
50
      virtual bool setString(int, bool editable = false) = 0;
 
51
      virtual bool setSValue(const QString&) = 0;
 
52
 
 
53
   private slots:
 
54
      void repeat();
 
55
 
 
56
   protected slots:
 
57
      void endEdit();
 
58
 
 
59
   signals:
 
60
      void valueChanged(int);
 
61
 
 
62
   public slots:
 
63
      virtual void setValue(int);
 
64
 
 
65
   public:
 
66
      Nentry(QWidget* parent, const QString& txt = "",
 
67
         int lPos = 0, bool dark=false);
 
68
 
 
69
      int value() const { return val; }
 
70
      void setFrame(bool);
 
71
      void setAlignment(int flag)    { edit->setAlignment(flag); }
 
72
      void setText(const QString& s);
 
73
      void setSize(int n);
 
74
      void setDark();
 
75
 
 
76
      void mousePress(QMouseEvent*);
 
77
      void mouseMove(QMouseEvent*);
 
78
      void mouseDoubleClick(QMouseEvent*);
 
79
      void mouseRelease(QMouseEvent*);
 
80
      void wheel(QWheelEvent*);
 
81
      bool keyPress(QKeyEvent*);
 
82
      void setFocusPolicy(FocusPolicy);
 
83
      };
 
84
#endif