1 /* 2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef TABVIEW_H 6 #define TABVIEW_H 7 8 9 #include <Messenger.h> 10 #include <TabView.h> 11 12 13 class TabView : public BTabView { 14 public: 15 TabView(const BMessenger& target, const BMessage& message, 16 const char* name = "tab view") 17 : 18 BTabView(name, B_WIDTH_FROM_WIDEST), 19 fTarget(target), 20 fMessage(message) 21 { 22 } 23 24 virtual void Select(int32 tabIndex) 25 { 26 BTabView::Select(tabIndex); 27 28 BMessage message(fMessage); 29 message.AddInt32("tab index", tabIndex); 30 fTarget.SendMessage(&message); 31 } 32 33 private: 34 BMessenger fTarget; 35 BMessage fMessage; 36 }; 37 38 39 #endif // TABVIEW_H 40