//------------------------------------------------------------------------------ // gui_Panel class -- // (C) Piero Giubilato 2008, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "gui_Panel.cpp" // [Author] "Piero Giubilato" // [Version] "1.0" // [Modified by] "Piero Giubilato" // [Last revision] "20 Jul 2009" // [Language] "C++" // [Compiler] "Visual C++ 8.x 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "Source for the gui_Panel class" // [Key documentation] // "Visual C++ Reference Help" // "Root reference guide" // {Trace} //______________________________________________________________________________ // Standard component // Root Component #include "TSystem.h" // Application component #include "global.h" #include "gui_Panel.h" // CINT Preprocessor class import definition ClassImp(gui_Panel) //______________________________________________________________________________ gui_Panel::gui_Panel(UInt_t left, UInt_t top, UInt_t width, UInt_t height, UInt_t color, bool fill, Float_t thickness): gui_Object(0) { // Default constructor. gui_Panels simply draw a 3D style border object // to visually group a rectangular area of the desktop. The thick parameter // defines the thickness of the bevel. // gui_Panel is a container object, i.e. it can be passed as a parent object // when creating a new gui_Object, which will belong to the panel since its // creation. The destruction of the panel will destroy all the embedded // objects too. // Debug dbg_Print("gui_Panel::gui_Panel:()", DBG_LVL_ZERO); // Sets up the panel frame = new gso_Frame(Parent()->Window(), width, height, 13, thickness, gso_Frame::ks_Notch, color, Parent()->backColor(), fill); frame->Move(left, top); // Initialize obj_foreColor = color; // Defines the object as transparent gui_Object::obj_Transparent = true; } //______________________________________________________________________________ gui_Panel::gui_Panel(gui_Object* parent, UInt_t left, UInt_t top, UInt_t width, UInt_t height, UInt_t color, bool fill, Float_t thickness): gui_Object(parent) { // Parent constructor. Puts the panel inside the parent object. // Debug dbg_Print("gui_Panel::gui_Panel:(gui_Object*)", DBG_LVL_ZERO); // Sets up the panel frame = new gso_Frame(Parent()->Window(), width, height, 7, thickness, gso_Frame::ks_Notch, color, Parent()->backColor(), fill); frame->Move(left, top); // Initialize obj_foreColor = color; // Defines the object as transparent gui_Object::obj_Transparent = true; } /* //______________________________________________________________________________ gui_Panel(const gui_Panel&) { // Copy Constructor dbg_Print("gui_Panel::gui_Panel: copy constructor", DBG_LVL_ZERO); } //______________________________________________________________________________ const gui_Panel& operator=(const gui_Panel&) { // Operator= dbg_Print("gui_Panel::operator=: copy operator", DBG_LVL_ZERO); } */ //______________________________________________________________________________ gui_Panel::~gui_Panel() { // Default destructor. dbg_Print("gui_Panel::~gui_Panel:()", DBG_LVL_ZERO); // Removes the root object from the root graphical server Parent()->Window()->RemoveFrame(frame); frame->DestroyWindow(); delete frame; } //______________________________________________________________________________ TGCompositeFrame* gui_Panel::Window() const { // Overload the original gui_Object one as the panel // provides container capabilities return frame; } //______________________________________________________________________________ void gui_Panel::MoveResize(UInt_t left, UInt_t top, UInt_t width, UInt_t height) { // Moves and resizes the button frame->MoveResize(left, top, width, height); // Stores the new datas obj_Left = left; obj_Top = top; obj_Width = width; obj_Height = height; // Paint Update(); } //______________________________________________________________________________ void gui_Panel::color_Set(UInt_t foreColor, UInt_t backColor) { // Moves and resizes the button //frame->SetForegroundColor(foreColor); //frame->SetBackgroundColor(backColor); frame->SetColor(foreColor, backColor); // Stores the new datas obj_foreColor = foreColor; obj_backColor = backColor; // Refresh the graphical container //Update(); } //______________________________________________________________________________ void gui_Panel::backColor(UInt_t color) { // Overloaded gui_Object function, sets the back color of the panel, // the shaded version. dbg_Print("gso_Panel::backColor:()", DBG_LVL_FLOW); // Sets the new panel backcolor frame->SetBackgroundColor(color); } //______________________________________________________________________________ UInt_t gui_Panel::backColor() const { // Overloaded gui_Object function, returns the pure color // of the panel backcolor. dbg_Print("gui_Panel::backColor:()", DBG_LVL_FLOW); // Returns the pure color if (frame->FrmFill()) return obj_foreColor; else return obj_backColor; } //______________________________________________________________________________ UInt_t gui_Panel::shadedColor() const { // Overloaded gui_Object function, returns the shaded color // of the panel backcolor. dbg_Print("gui_Panel::shadedColor:()", DBG_LVL_FLOW); // Returns the displayed color return frame->GetShadedColor(); }