00001 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef TGCONTROLLIST_H 00019 #define TGCONTROLLIST_H 00020 00021 #include <TGListTree.h> 00022 #include <TGMenu.h> 00023 00028 class TGControlListItemUserData { 00029 00030 TGPopupMenu *fContextMenu; 00031 void *fObject; 00032 00033 public: 00034 00035 TGControlListItemUserData() { 00036 fContextMenu=NULL; 00037 fObject=NULL; 00038 }; 00039 ~TGControlListItemUserData(){}; 00040 00041 TGPopupMenu *GetContextMenu() { return fContextMenu; }; 00042 void SetContextMenu(TGPopupMenu *p) { fContextMenu=p; }; 00043 00044 void *GetObject() { return fObject; }; 00045 void SetObject(void *o) { fObject = o;}; 00046 00047 }; 00048 00049 00050 class TGControlList : public TGListTree { 00051 00052 Event_t *fEvent; 00053 00054 public: 00055 00056 // Event Handling 00057 Bool_t HandleButton(Event_t*); 00058 00059 // Slots 00060 void ToggleItem(TGListTreeItem*,Int_t); 00061 void ClickItem(TGListTreeItem*,Int_t); 00062 00063 void OpenContextMenu(TGListTreeItem*); 00064 00065 TGControlList(TGWindow *parent, 00066 UInt_t w = 300, 00067 UInt_t h = 150, 00068 UInt_t o = 0); 00069 ~TGControlList(); 00070 00071 TGControlListItemUserData* UserData(TGListTreeItem* item); 00072 void ContextMenu(TGListTreeItem*,TGPopupMenu*); 00073 void SetObject(TGListTreeItem*,void*); 00074 void* GetObject(TGListTreeItem* i) {return UserData(i)->GetObject(); }; 00075 00076 TGClient* GetClient() { return fClient; }; 00077 00078 ClassDef(TGControlList,0) 00079 00080 }; 00081 00082 #endif
1.3.2