ROOT logo
#ifndef __TGMrbLabelCombo_h__
#define __TGMrbLabelCombo_h__

//_________________________________________________[C++ CLASS DEFINITION FILE]
//////////////////////////////////////////////////////////////////////////////
// Name:           gutils/inc/TGMrbLabelCombo.h
// Purpose:        Define utilities to be used with the MARaBOU GUI
// Class:          TGMrbLabelCombo     -- a frame containing a label and
//                                        a combo box
// Description:    Graphic utilities for the MARaBOU GUI.
// Author:         R. Lutter
// Revision:       $Id: TGMrbLabelCombo.h,v 1.11 2011-09-28 12:22:02 Marabou Exp $       
// Date:           
// Keywords:
//////////////////////////////////////////////////////////////////////////////

#include "Rtypes.h"
#include "TSystem.h"
#include "TGWindow.h"
#include "TGFrame.h"
#include "TGComboBox.h"

#include "TMrbLofNamedX.h"
#include "TGMrbObject.h"
#include "TGMrbLayout.h"

//______________________________________________________[C++ CLASS DEFINITION]
//////////////////////////////////////////////////////////////////////////////
// Name:           TGMrbLabelCombo
// Purpose:        Define a labelled combo box
// Description:    Defines a label together with a combo box
// Keywords:
//////////////////////////////////////////////////////////////////////////////

class TGMrbLabelCombo: public TGCompositeFrame, public TGMrbObject {

	public:
		enum EGMrbEntryButton	{	kGMrbComboButtonUp,
									kGMrbComboButtonDown,
									kGMrbComboButtonBegin,
									kGMrbComboButtonEnd
								};

	public:
		TGMrbLabelCombo(const TGWindow * Parent, const Char_t * Label,					// ctor
							TMrbLofNamedX * Entries,
							Int_t FrameId, Int_t Selected,
							Int_t Width, Int_t Height, Int_t ComboWidth,
							TGMrbLayout * FrameGC,
							TGMrbLayout * LabelGC = NULL,
							TGMrbLayout * ComboGC = NULL,
							TGMrbLayout * UpDownBtnGC = NULL,
							Bool_t BeginEndBtns = kFALSE,
							UInt_t FrameOptions = kHorizontalFrame,
							UInt_t ComboOptions = kHorizontalFrame|kSunkenFrame|kDoubleBorder);

		~TGMrbLabelCombo() {};														// default dtor

		Bool_t AddEntries(TMrbLofNamedX * Entries); 								// add entries to the box
		
		inline TGComboBox * GetComboBox() const { return(fCombo); };

		inline TGPictureButton * GetUpButton() const { return(fUp); };
		inline TGPictureButton * GetDownButton() const { return(fDown); };
		inline TGPictureButton * GetBeginButton() const { return(fBegin); };
		inline TGPictureButton * GetEndButton() const { return(fEnd); };

		void UpDownButtonEnable(Bool_t Flag = kTRUE);			// enable/disable up/down buttons

		const Char_t * GetText() const;
		void SetText(const Char_t * Text);

		inline void Select(Int_t ItemIdx) { fCombo->Select(ItemIdx, kFALSE); };
		inline Int_t GetSelected() { return(fCombo->GetSelected()); };
		inline TMrbNamedX * GetSelectedNx() { return(fEntries.FindByIndex(fCombo->GetSelected())); };

		inline TMrbNamedX * GetEntry(Int_t Index) { return((TMrbNamedX *) fEntries.FindByIndex(Index)); };

		void BeginButtonPressed();		// slot methods called upon ButtonPressed() signals
		void EndButtonPressed();
		void UpButtonPressed();
		void DownButtonPressed();

		inline void SelectionChanged(Int_t Selection) { this->SelectionChanged(fFrameId, Selection); };
		void SelectionChanged(Int_t FrameId, Int_t Selection); 			// *SIGNAL*

		inline void Help() { gSystem->Exec(Form("mrbHelp %s", this->ClassName())); };

	protected:
		Int_t fFrameId;
		TGComboBox * fCombo;			//!

		TMrbLofNamedX fEntries;			//! entries
		TGPictureButton * fUp; 			//! button ">", increment
		TGPictureButton * fDown;		//! button "<", decrement
		TGPictureButton * fBegin; 		//! button "<<", begin
		TGPictureButton * fEnd; 		//! button ">>", end

	ClassDef(TGMrbLabelCombo, 1)		// [GraphUtils] A labelled combo box
};

#endif
 TGMrbLabelCombo.h:1
 TGMrbLabelCombo.h:2
 TGMrbLabelCombo.h:3
 TGMrbLabelCombo.h:4
 TGMrbLabelCombo.h:5
 TGMrbLabelCombo.h:6
 TGMrbLabelCombo.h:7
 TGMrbLabelCombo.h:8
 TGMrbLabelCombo.h:9
 TGMrbLabelCombo.h:10
 TGMrbLabelCombo.h:11
 TGMrbLabelCombo.h:12
 TGMrbLabelCombo.h:13
 TGMrbLabelCombo.h:14
 TGMrbLabelCombo.h:15
 TGMrbLabelCombo.h:16
 TGMrbLabelCombo.h:17
 TGMrbLabelCombo.h:18
 TGMrbLabelCombo.h:19
 TGMrbLabelCombo.h:20
 TGMrbLabelCombo.h:21
 TGMrbLabelCombo.h:22
 TGMrbLabelCombo.h:23
 TGMrbLabelCombo.h:24
 TGMrbLabelCombo.h:25
 TGMrbLabelCombo.h:26
 TGMrbLabelCombo.h:27
 TGMrbLabelCombo.h:28
 TGMrbLabelCombo.h:29
 TGMrbLabelCombo.h:30
 TGMrbLabelCombo.h:31
 TGMrbLabelCombo.h:32
 TGMrbLabelCombo.h:33
 TGMrbLabelCombo.h:34
 TGMrbLabelCombo.h:35
 TGMrbLabelCombo.h:36
 TGMrbLabelCombo.h:37
 TGMrbLabelCombo.h:38
 TGMrbLabelCombo.h:39
 TGMrbLabelCombo.h:40
 TGMrbLabelCombo.h:41
 TGMrbLabelCombo.h:42
 TGMrbLabelCombo.h:43
 TGMrbLabelCombo.h:44
 TGMrbLabelCombo.h:45
 TGMrbLabelCombo.h:46
 TGMrbLabelCombo.h:47
 TGMrbLabelCombo.h:48
 TGMrbLabelCombo.h:49
 TGMrbLabelCombo.h:50
 TGMrbLabelCombo.h:51
 TGMrbLabelCombo.h:52
 TGMrbLabelCombo.h:53
 TGMrbLabelCombo.h:54
 TGMrbLabelCombo.h:55
 TGMrbLabelCombo.h:56
 TGMrbLabelCombo.h:57
 TGMrbLabelCombo.h:58
 TGMrbLabelCombo.h:59
 TGMrbLabelCombo.h:60
 TGMrbLabelCombo.h:61
 TGMrbLabelCombo.h:62
 TGMrbLabelCombo.h:63
 TGMrbLabelCombo.h:64
 TGMrbLabelCombo.h:65
 TGMrbLabelCombo.h:66
 TGMrbLabelCombo.h:67
 TGMrbLabelCombo.h:68
 TGMrbLabelCombo.h:69
 TGMrbLabelCombo.h:70
 TGMrbLabelCombo.h:71
 TGMrbLabelCombo.h:72
 TGMrbLabelCombo.h:73
 TGMrbLabelCombo.h:74
 TGMrbLabelCombo.h:75
 TGMrbLabelCombo.h:76
 TGMrbLabelCombo.h:77
 TGMrbLabelCombo.h:78
 TGMrbLabelCombo.h:79
 TGMrbLabelCombo.h:80
 TGMrbLabelCombo.h:81
 TGMrbLabelCombo.h:82
 TGMrbLabelCombo.h:83
 TGMrbLabelCombo.h:84
 TGMrbLabelCombo.h:85
 TGMrbLabelCombo.h:86
 TGMrbLabelCombo.h:87
 TGMrbLabelCombo.h:88
 TGMrbLabelCombo.h:89
 TGMrbLabelCombo.h:90
 TGMrbLabelCombo.h:91
 TGMrbLabelCombo.h:92
 TGMrbLabelCombo.h:93
 TGMrbLabelCombo.h:94
 TGMrbLabelCombo.h:95
 TGMrbLabelCombo.h:96
 TGMrbLabelCombo.h:97
 TGMrbLabelCombo.h:98
 TGMrbLabelCombo.h:99
 TGMrbLabelCombo.h:100
 TGMrbLabelCombo.h:101
 TGMrbLabelCombo.h:102