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

« back to all changes in this revision

Viewing changes to widgets/drange.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: drange.h,v 1.2 2001/11/20 15:19:34 muse Exp $
 
5
//
 
6
//    Copyright (C) 1997  Josef Wilgen
 
7
//      This program is free software; you can redistribute it and/or modify
 
8
//      it under the terms of the GNU General Public License, version 2,
 
9
//      as published by the Free Software Foundation.
 
10
//
 
11
//    (C) Copyright 2000 Werner Schweer (ws@seh.de)
 
12
//=========================================================
 
13
 
 
14
#ifndef __DOUBLE_RANGE_H__
 
15
#define __DOUBLE_RANGE_H__
 
16
 
 
17
#include <qglobal.h>
 
18
 
 
19
class DoubleRange
 
20
      {
 
21
      static const double MinRelStep;
 
22
      static const double DefaultRelStep;
 
23
      static const double MinEps;
 
24
 
 
25
      double d_minValue;
 
26
      double d_maxValue;
 
27
      double d_step;
 
28
      int d_pageSize;
 
29
      double d_value;
 
30
      double d_exactValue;
 
31
      double d_exactPrevValue;
 
32
      double d_prevValue;
 
33
      bool d_periodic;
 
34
 
 
35
      void setNewValue(double x, bool align = false);
 
36
 
 
37
   protected:
 
38
      double exactValue() const { return d_exactValue; }
 
39
      double exactPrevValue() const { return d_exactPrevValue; }
 
40
      double prevValue() const { return d_prevValue; }
 
41
      virtual void valueChange() {}
 
42
      virtual void stepChange()  {}
 
43
      virtual void rangeChange() {}
 
44
 
 
45
   public:
 
46
      DoubleRange();
 
47
      virtual void fitValue(double);
 
48
      virtual void incValue(int);
 
49
      virtual void incPages(int);
 
50
      void setPeriodic(bool tf);
 
51
      void setRange(double vmin, double vmax, double vstep = 0.0,
 
52
         int pagesize = 1);
 
53
      void setStep(double);
 
54
      virtual void setValue(double);
 
55
 
 
56
      double maxValue() const { return d_maxValue; }
 
57
      double minValue() const { return d_minValue; }
 
58
      bool periodic()  const  { return d_periodic; }
 
59
      int pageSize() const    { return d_pageSize; }
 
60
      double value() const    { return d_value; }
 
61
      double step() const;
 
62
      };
 
63
 
 
64
#endif