1 /* 2 * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, axeld@pinc-software.de 7 * Dario Casalinuovo 8 */ 9 #ifndef NETWORK_STATUS_VIEW_H 10 #define NETWORK_STATUS_VIEW_H 11 12 13 #include <Notification.h> 14 #include <ObjectList.h> 15 #include <View.h> 16 17 #include <map> 18 19 20 class BMessageRunner; 21 class BNetworkInterface; 22 23 24 enum { 25 kStatusUnknown = 0, 26 kStatusNoLink, 27 kStatusLinkNoConfig, 28 kStatusConnecting, 29 kStatusReady, 30 31 kStatusCount 32 }; 33 34 35 class NetworkStatusView : public BView { 36 public: 37 NetworkStatusView(BRect frame, int32 resizingMode, 38 bool inDeskbar = false); 39 NetworkStatusView(BMessage* archive); 40 virtual ~NetworkStatusView(); 41 42 static NetworkStatusView* Instantiate(BMessage* archive); 43 virtual status_t Archive(BMessage* archive, bool deep = true) const; 44 45 virtual void AttachedToWindow(); 46 virtual void DetachedFromWindow(); 47 48 virtual void MessageReceived(BMessage* message); 49 virtual void FrameResized(float width, float height); 50 virtual void MouseDown(BPoint where); 51 virtual void Draw(BRect updateRect); 52 53 private: 54 void _AboutRequested(); 55 void _Quit(); 56 void _Init(); 57 void _UpdateBitmaps(); 58 void _ShowConfiguration(BMessage* message); 59 int32 _DetermineInterfaceStatus( 60 const BNetworkInterface& interface); 61 void _Update(bool force = false); 62 void _OpenNetworksPreferences(); 63 64 std::map<BString, int32> 65 fInterfaceStatuses; 66 bool fInDeskbar; 67 BBitmap* fTrayIcons[kStatusCount]; 68 BBitmap* fNotifyIcons[kStatusCount]; 69 }; 70 71 #endif // NETWORK_STATUS_VIEW_H 72