00001 // @(#)root/qt:$Id: TQtUtil.h 29951 2009-08-28 04:48:12Z brun $ 00002 // Author: Valeri Fine 21/01/2002 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * Copyright (C) 2002 by Valeri Fine. * 00007 * All rights reserved. * 00008 * * 00009 * For the licensing terms see $ROOTSYS/LICENSE. * 00010 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00011 *************************************************************************/ 00012 00013 #ifndef ROOT_TQtUTIL 00014 #define ROOT_TQtUTIL 00015 00016 #include "TGQt.h" 00017 #include "TVirtualPad.h" 00018 #include "TCanvasImp.h" 00019 00020 #include <QtGui/QPixmap> 00021 #include <QtGui/QWidget> 00022 00023 //---------------------------------------- 00024 // Q: How to get Qt pointer: 00025 //---------------------------------------- 00026 namespace TQtUtil { 00027 /// 00028 /// Returns QPixmap backend for the given TVirtualPad 00029 /// 00030 //_______________________________________ 00031 inline QPixmap *padPixmap(TVirtualPad *pad) 00032 { return (QPixmap *)TGQt::iwid(pad->GetPixmapID()); } 00033 00034 /// 00035 /// Returns QWidget backend for the given TCanvas 00036 /// if "c" is not a TCanvas returns zero 00037 /// 00038 //_______________________________________ 00039 inline QWidget *canvasWidget(TVirtualPad *c) 00040 { return (QWidget *)TGQt::iwid(c->GetCanvasID()) ; } 00041 //---------------------------------------- 00042 // Q: Get WIN32/X11 handles: 00043 // (see function above and Qt manual also) 00044 //---------------------------------------- 00045 /// 00046 /// Returns system depended backend handle 00047 /// for the given TVirtualPad 00048 /// 00049 //_______________________________________ 00050 inline unsigned long wigdetHdc(TVirtualPad *pad) 00051 { return padPixmap(pad)->handle(); } 00052 00053 /// 00054 /// Returns system depended backend handle 00055 /// for the given TCanvas 00056 /// if "c" is not a TCanvas returns zero 00057 00058 //_______________________________________ 00059 inline unsigned long hwndWin32(TVirtualPad *c) 00060 { return canvasWidget(c)->winId(); } 00061 }; 00062 #endif 00063