ROOT logo
// @(#)root/gui:$Id: TGObject.cxx 41206 2011-10-06 12:43:57Z bellenot $
// Author: Fons Rademakers   27/12/97

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
/**************************************************************************

    This source is based on Xclass95, a Win95-looking GUI toolkit.
    Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.

    Xclass95 is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

**************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGObject                                                             //
//                                                                      //
// This class is the baseclass for all ROOT GUI widgets.                //
// The ROOT GUI components emulate the Win95 look and feel and the code //
// is based on the XClass'95 code (see Copyleft in source).             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TGObject.h"
#include "TVirtualX.h"
#include "TImage.h"

ClassImp(TGObject)

void TGObject::SaveAs(const char* filename /*= ""*/, Option_t* option /*= ""*/) const
{
   // Write this TGObject to a file using TImage, if filename's extension signals 
   // a valid TImage::EImageFileType, as defined by TImage::GetImageFileTypeFromFilename().
   // Otherwise forward to TObject::SaveAs().

   TImage::EImageFileTypes type = TImage::GetImageFileTypeFromFilename(filename);
   if (type != TImage::kUnknown) {
      WindowAttributes_t wattr;
      gVirtualX->GetWindowAttributes(GetId(), wattr);
      TImage* img = TImage::Create();
      if (img) {
         img->FromWindow(GetId(), 0, 0, wattr.fWidth, wattr.fHeight);
         img->WriteImage(filename, type);
         delete img;
      }
      return;
   }

   TObject::SaveAs(filename, option);
}
 TGObject.cxx:1
 TGObject.cxx:2
 TGObject.cxx:3
 TGObject.cxx:4
 TGObject.cxx:5
 TGObject.cxx:6
 TGObject.cxx:7
 TGObject.cxx:8
 TGObject.cxx:9
 TGObject.cxx:10
 TGObject.cxx:11
 TGObject.cxx:12
 TGObject.cxx:13
 TGObject.cxx:14
 TGObject.cxx:15
 TGObject.cxx:16
 TGObject.cxx:17
 TGObject.cxx:18
 TGObject.cxx:19
 TGObject.cxx:20
 TGObject.cxx:21
 TGObject.cxx:22
 TGObject.cxx:23
 TGObject.cxx:24
 TGObject.cxx:25
 TGObject.cxx:26
 TGObject.cxx:27
 TGObject.cxx:28
 TGObject.cxx:29
 TGObject.cxx:30
 TGObject.cxx:31
 TGObject.cxx:32
 TGObject.cxx:33
 TGObject.cxx:34
 TGObject.cxx:35
 TGObject.cxx:36
 TGObject.cxx:37
 TGObject.cxx:38
 TGObject.cxx:39
 TGObject.cxx:40
 TGObject.cxx:41
 TGObject.cxx:42
 TGObject.cxx:43
 TGObject.cxx:44
 TGObject.cxx:45
 TGObject.cxx:46
 TGObject.cxx:47
 TGObject.cxx:48
 TGObject.cxx:49
 TGObject.cxx:50
 TGObject.cxx:51
 TGObject.cxx:52
 TGObject.cxx:53
 TGObject.cxx:54
 TGObject.cxx:55
 TGObject.cxx:56
 TGObject.cxx:57
 TGObject.cxx:58
 TGObject.cxx:59