1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 * Ingo Weinhold <bonefish@cs.tu-berlin.de> 8 */ 9 10 #ifndef POPUP_CONTROL_H 11 #define POPUP_CONTROL_H 12 13 #include <View.h> 14 15 #include <layout.h> 16 17 class PopupView; 18 class PopupWindow; 19 20 class PopupControl : public MView, public BView { 21 public: 22 PopupControl(const char* name, 23 PopupView* child); 24 virtual ~PopupControl(); 25 26 // MView 27 virtual minimax layoutprefs() = 0; 28 virtual BRect layout(BRect frame) = 0; 29 30 // BHandler 31 virtual void MessageReceived(BMessage* message); 32 33 // PopupControl 34 void SetPopupAlignment(float hPopupAlignment, 35 float vPopupAlignment); 36 void SetPopupLocation(BPoint leftTop); 37 38 // "offset" will be modified if the popup 39 // window had to be moved in order to 40 // show entirely on screen 41 virtual void ShowPopup(BPoint* offset = NULL); 42 virtual void HidePopup(); 43 44 virtual void PopupShown(); 45 virtual void PopupHidden(bool canceled); 46 47 private: 48 PopupWindow* fPopupWindow; 49 PopupView* fPopupChild; 50 float fHPopupAlignment; 51 float fVPopupAlignment; 52 BPoint fPopupLeftTop; 53 }; 54 55 56 #endif // POPUP_CONTROL_H 57