]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuSliderMinMax.cxx
ce4ea2f904c03b4708c0570b88947d299b1e15fe
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuSliderMinMax.cxx
1 #include "bbmaracasvisuSliderMinMax.h"
2 #include "bbcreaMaracasVisuPackage.h"
3
4
5 namespace bbcreaMaracasVisu
6 {
7
8   //------------------------------------------------------------------------------------------------------------------------------------
9   // Event handling auxiliar class
10   //------------------------------------------------------------------------------------------------------------------------------------
11  
12           //--------------------------------------------------------------------------------------------------------------------------------
13           // Constructors ans destructors
14           //--------------------------------------------------------------------------------------------------------------------------------
15                 wxWidgetSliderMinMax :: wxWidgetSliderMinMax(SliderMinMax *bbParent,mBarRange * modelBarRange)//(wxWindow *parent, mBarRange * modelBarRange)
16                 :wxEvtHandler()
17                 {                       
18                         modBarRange = modelBarRange;
19                         mbbtkSliderMinMax = bbParent;
20                         modBarRange->PushEventHandler(this);
21                         Connect(modBarRange->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onBarrange );
22 //                      Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onActualChange_Bar );
23                         Connect(modBarRange->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onActualChange_Bar );
24                         Connect(modBarRange->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onStartChange_Bar );            
25                         Connect(modBarRange->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onEndChange_Bar );
26                         Connect(modBarRange->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onSelectionEnd );
27                         Connect(modBarRange->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxWidgetSliderMinMax::onMovedBar );           
28                 }
29
30                 wxWidgetSliderMinMax ::  ~wxWidgetSliderMinMax()
31                 {
32                 }
33                 
34
35           //--------------------------------------------------------------------------------------------------------------------------------
36           // Min-Max Barrange received events
37           //--------------------------------------------------------------------------------------------------------------------------------
38                 void wxWidgetSliderMinMax :: onBarrange(wxCommandEvent& event)
39                 {
40                 }
41
42                 void wxWidgetSliderMinMax :: onActualChange_Bar(wxCommandEvent& event)
43                 {
44                         mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
45                         mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));
46                 }
47
48                 void wxWidgetSliderMinMax :: onStartChange_Bar(wxCommandEvent& event)
49                 {
50                         mbbtkSliderMinMax->bbSetOutputOutStart(modBarRange->GetStart());
51                         mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutStart"));
52                 }
53                 void wxWidgetSliderMinMax :: onEndChange_Bar(wxCommandEvent& event)
54                 {
55                         mbbtkSliderMinMax->bbSetOutputOutEnd(modBarRange->GetEnd());
56                         mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutEnd"));
57                 }
58                 void wxWidgetSliderMinMax :: onSelectionEnd(wxCommandEvent& event)
59                 {
60                 }
61                 void wxWidgetSliderMinMax :: onMovedBar(wxCommandEvent& event)
62                 {
63                 }
64
65
66   //--------------------------------------------------------------------------
67   //-------------------------------------------------------------------------
68   //--------------------------------------------------------------------------
69   //--------------------------------------------------------------------------
70
71
72 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SliderMinMax)
73 BBTK_BLACK_BOX_IMPLEMENTATION(SliderMinMax,bbtk::WxBlackBox);
74
75 //------------------------------------------------------
76 void SliderMinMax::Process()
77 {
78         if (mwxwidget!=NULL){
79                 bbSetOutputOutStart(mwxwidget->GetStart());
80                 bbSetOutputOutEnd(mwxwidget->GetEnd());
81                 bbSetOutputOutActual(mwxwidget->GetActual());
82         } // mwxwidget
83 }
84
85 //------------------------------------------------------
86 void SliderMinMax::CreateWidget(wxWindow* parent)
87 {
88
89     bbtkDebugMessageInc("Core",9,"SliderMinMax::CreateWidget()"<<std::endl);
90
91                 mwxwidget = new mBarRange(parent ,bbGetInputInW(), bbGetInputInH()); 
92                 mwxwidget -> SetOrientation( bbGetInputOrientation()==1 );
93                 mwxwidget -> setActiveStateTo(true);
94                 mwxwidget -> setVisibleLabels( bbGetInputShowLabels()==1 );
95                 mwxwidget -> setDeviceEndMargin(10);
96             mwxwidget -> setRepresentedValues(bbGetInputInMin(), bbGetInputInMax());
97                 mwxwidget -> setDeviceBlitStart(10,10); 
98                 mwxwidget -> setIfWithActualDrawed(bbGetInputShowActual());
99                 mwxwidget -> SetStart(bbGetInputInMinShow());
100                 mwxwidget -> SetEnd(bbGetInputInMaxShow());  
101                 //wxWidgetSliderMinMax * eventHandler = new wxWidgetSliderMinMax(this, mwxwidget); //JPRx
102                 bbtkDebugDecTab("Core",9);
103
104         bbSetOutputWidget( mwxwidget );
105
106
107 }
108
109 //------------------------------------------------------
110 void SliderMinMax::bbUserSetDefaultValues()
111 {
112                 mwxwidget = NULL;
113                 bbSetInputOrientation(1);
114                 bbSetInputInW(200);
115                 bbSetInputInH(65);
116                 bbSetInputInMax(200);
117                 bbSetInputInMin(1);
118                 bbSetInputInMaxShow(200);
119                 bbSetInputInMinShow(1);
120                 bbSetInputShowLabels(1);
121                 bbSetInputShowActual(true);
122
123                 bbSetOutputOutStart(0);
124                 bbSetOutputOutEnd(0);
125                 bbSetOutputOutActual(0);
126 }
127
128                 
129         //-----------------------------------------------------------------     
130         void SliderMinMax::bbUserInitializeProcessing()
131         {
132         }
133         
134         //-----------------------------------------------------------------     
135         void SliderMinMax::bbUserFinalizeProcessing()
136         {
137         }
138         
139         //-----------------------------------------------------------------     
140
141 }
142 // EO namespace bbcreaMaracasVisu
143
144