summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-06-02 17:43:18 (GMT)
committerjoye <joye>2014-06-02 17:43:18 (GMT)
commitc7f69dceaed915906668278c317c592721b938f9 (patch)
tree0d2493f93ea7c917b7d9255f59e79a72653885c4
parentf8a01906e319c1d68d96f6bf20510cf771f6e7e3 (diff)
downloadblt-c7f69dceaed915906668278c317c592721b938f9.zip
blt-c7f69dceaed915906668278c317c592721b938f9.tar.gz
blt-c7f69dceaed915906668278c317c592721b938f9.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrBind.C9
-rw-r--r--src/bltGrBind.h5
-rw-r--r--src/bltGrLegd.C2
-rw-r--r--src/bltGrLegd.h3
-rw-r--r--src/bltGraph.C2
-rw-r--r--src/bltGraph.h7
6 files changed, 16 insertions, 12 deletions
diff --git a/src/bltGrBind.C b/src/bltGrBind.C
index a06eb44..58088ab 100644
--- a/src/bltGrBind.C
+++ b/src/bltGrBind.C
@@ -40,9 +40,10 @@ using namespace std;
static Tk_EventProc BindProc;
-BindTable::BindTable(Graph* graphPtr, int which)
+BindTable::BindTable(Graph* graphPtr, Pick* pickPtr)
{
graphPtr_ = graphPtr;
+ pickPtr_ = pickPtr;
flags_ =0;
table_ = Tk_CreateBindingTable(graphPtr->interp_);
currentItem_ =NULL;
@@ -53,7 +54,6 @@ BindTable::BindTable(Graph* graphPtr, int which)
focusContext_ =CID_NONE;
// pickEvent =NULL;
state_ =0;
- which_ = which;
unsigned int mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
@@ -224,10 +224,7 @@ void BindTable::pickItem(XEvent* eventPtr)
if (pickEvent_.type != LeaveNotify) {
int x = pickEvent_.xcrossing.x;
int y = pickEvent_.xcrossing.y;
- if (which_)
- newItem_ = graphPtr_->legend_->pickEntry(x, y, &newContext_);
- else
- newItem_ = graphPtr_->pickEntry(x, y, &newContext_);
+ newItem_ = pickPtr_->pickEntry(x, y, &newContext_);
}
// Nothing to do: the current item hasn't changed.
diff --git a/src/bltGrBind.h b/src/bltGrBind.h
index e50c64d..cf98c0f 100644
--- a/src/bltGrBind.h
+++ b/src/bltGrBind.h
@@ -35,6 +35,7 @@
#include "bltGrMisc.h"
class BindTable;
+class Pick;
class Graph;
class BindTable {
@@ -43,7 +44,7 @@ class BindTable {
unsigned int flags_;
ClientData newItem_;
ClassId newContext_;
- int which_;
+ Pick* pickPtr_;
public:
Graph* graphPtr_;
@@ -55,7 +56,7 @@ class BindTable {
XEvent pickEvent_;
public:
- BindTable(Graph*, int);
+ BindTable(Graph*, Pick*);
virtual ~BindTable();
int configure(ClientData, int, Tcl_Obj *const []);
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index 5c6a607..73abd34 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -193,7 +193,7 @@ Legend::Legend(Graph* graphPtr)
ops->titleStyle.angle =0;
ops->titleStyle.justify =TK_JUSTIFY_LEFT;
- bindTable_ = new BindTable(graphPtr, 1);
+ bindTable_ = new BindTable(graphPtr, this);
Tcl_InitHashTable(&selectTable_, TCL_ONE_WORD_KEYS);
diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h
index 0cbb39a..30fc6a6 100644
--- a/src/bltGrLegd.h
+++ b/src/bltGrLegd.h
@@ -39,6 +39,7 @@
#include "bltGrText.h"
class Graph;
+class Pick;
class Element;
class Legend;
@@ -101,7 +102,7 @@ typedef struct {
TextStyleOptions titleStyle;
} LegendOptions;
-class Legend {
+class Legend : public Pick {
public:
enum Position {RIGHT, LEFT, TOP, BOTTOM, PLOT, XY};
diff --git a/src/bltGraph.C b/src/bltGraph.C
index e5fae53..0d07dda 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -118,7 +118,7 @@ Graph::Graph(ClientData clientData, Tcl_Interp* interp,
axes_.displayList = Blt_Chain_Create();
elements_.displayList = Blt_Chain_Create();
markers_.displayList = Blt_Chain_Create();
- bindTable_ = new BindTable(this, 0);
+ bindTable_ = new BindTable(this, this);
if (createAxes() != TCL_OK) {
valid_ =0;
diff --git a/src/bltGraph.h b/src/bltGraph.h
index a63f796..0184f91 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -50,6 +50,11 @@ class Legend;
class Pen;
class PageSetup;
+class Pick {
+ public:
+ virtual ClientData pickEntry(int, int, ClassId*) =0;
+};
+
namespace Blt {
class Marker;
};
@@ -129,7 +134,7 @@ typedef struct {
int reqPlotHeight;
} GraphOptions;
-class Graph {
+class Graph : public Pick {
public:
Tcl_Interp* interp_;
Tk_Window tkwin_;