1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 // 3 // Copyright (c) 2004, Haiku 4 // 5 // This software is part of the Haiku distribution and is covered 6 // by the Haiku license. 7 // 8 // 9 // File: MethodReplicant.h 10 // Authors: Jérôme Duval, 11 // 12 // Description: Input Server 13 // Created: October 13, 2004 14 // 15 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 16 17 #ifndef METHOD_REPLICANT_H_ 18 #define METHOD_REPLICANT_H_ 19 20 #include <PopUpMenu.h> 21 #include <View.h> 22 #include "MethodMenuItem.h" 23 24 #define REPLICANT_CTL_NAME "MethodReplicant" 25 26 class _EXPORT MethodReplicant; 27 28 class MethodReplicant : public BView { 29 public: 30 MethodReplicant(const char* signature); 31 32 MethodReplicant(BMessage *); 33 // BMessage * based constructor needed to support archiving 34 virtual ~MethodReplicant(); 35 36 // archiving overrides 37 static MethodReplicant *Instantiate(BMessage *data); 38 virtual status_t Archive(BMessage *data, bool deep = true) const; 39 40 virtual void AttachedToWindow(); 41 42 // misc BView overrides 43 virtual void MouseDown(BPoint); 44 virtual void MouseUp(BPoint); 45 46 virtual void Draw(BRect); 47 48 virtual void MessageReceived(BMessage *); 49 private: 50 BBitmap *fSegments; 51 char *fSignature; 52 BPopUpMenu fMenu; 53 54 void UpdateMethod(BMessage *); 55 void UpdateMethodIcon(BMessage *); 56 void UpdateMethodMenu(BMessage *); 57 void UpdateMethodName(BMessage *); 58 void AddMethod(BMessage *message); 59 void RemoveMethod(BMessage *message); 60 MethodMenuItem *FindItemByCookie(int32 cookie); 61 }; 62 63 #endif 64