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

#ifndef __callback_h__
#define __callback_h__

#include <tcl.h>

class CallBack {
 public:
  enum Type {SELECTCB, UNSELECTCB, 
	     HIGHLITECB, UNHIGHLITECB,
	     EDITBEGINCB, EDITCB, EDITENDCB, 
	     MOVEBEGINCB, MOVECB, MOVEENDCB, 
	     ROTATEBEGINCB, ROTATECB, ROTATEENDCB, 
	     DELETECB, 
	     TEXTCB, COLORCB, LINEWIDTHCB, PROPERTYCB, FONTCB, 
	     KEYCB,
	     UPDATECB};

 private:
  Tcl_Interp* interp_;

  Type type_;
  char proc_[128];
  char arg_[256];

  CallBack* previous_;
  CallBack* next_;

 public:
  CallBack(const CallBack&);
  CallBack(Tcl_Interp*, Type, const char*, const char*);
  CallBack& operator=(const CallBack&);

  int eval(const char*);

  Type type() {return type_;}
  const char* proc() {return proc_;}
  const char* arg() {return arg_;}

  CallBack* previous() {return previous_;}
  void setPrevious(CallBack* cb) {previous_ = cb;}
  CallBack* next() {return next_;}
  void setNext(CallBack* cb) {next_ = cb;}
};

#endif