summaryrefslogtreecommitdiffstats
path: root/tksao/colorbar/colortag.h
blob: b2fc8d3538982d191ec5123d27748c2d3e726abf (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
// Copyright (C) 1999-2017
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#ifndef __colortag_h__
#define __colortag_h__

#include "util.h"

class Colorbar;

class ColorTag {
protected:
  int id_;
  Colorbar* parent_;

  const char* colorname_;
  XColor* color_;

  int start_;
  int stop_;

  ColorTag* next_;
  ColorTag* previous_;

public:
  ColorTag(Colorbar*, int, int, const char*);
  virtual ~ColorTag();

  int id() {return id_;}
  Colorbar* parent() {return parent_;}

  int start() {return start_;}
  int stop() {return stop_;}
  const char* colorname() {return colorname_;}
  void move(int,int);
  void set(int,int,const char*);
  void width(int);

  unsigned short colorRed() {return color_ ? color_->red : 0;}
  unsigned short colorGreen() {return color_ ? color_->green : 0;}
  unsigned short colorBlue() {return color_ ? color_->blue : 0;}

  ColorTag* next() {return next_;}
  ColorTag* previous() {return previous_;}
  void setNext(ColorTag* n) {next_ = n;}
  void setPrevious(ColorTag* p) {previous_=p;}
};

#endif