xref: /haiku/src/apps/networkstatus/NetworkStatusView.h (revision 8897f2780d28e1b4d42988d82bf5e190968b6819)
1f01106c3SAxel Dörfler /*
2195981bbSAxel Dörfler  * Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
3f01106c3SAxel Dörfler  * Distributed under the terms of the MIT License.
4f01106c3SAxel Dörfler  *
5f01106c3SAxel Dörfler  * Authors:
6f01106c3SAxel Dörfler  *		Axel Dörfler, axeld@pinc-software.de
73b41ad86SStephan Aßmus  *		Dario Casalinuovo
8f01106c3SAxel Dörfler  */
9f01106c3SAxel Dörfler #ifndef NETWORK_STATUS_VIEW_H
10f01106c3SAxel Dörfler #define NETWORK_STATUS_VIEW_H
11f01106c3SAxel Dörfler 
12f01106c3SAxel Dörfler 
13b44d24c0SAlexander von Gluck IV #include <Notification.h>
14f01106c3SAxel Dörfler #include <ObjectList.h>
15f01106c3SAxel Dörfler #include <View.h>
16f01106c3SAxel Dörfler 
175c46b171SRene Gollent #include <map>
185c46b171SRene Gollent 
19*730a45eeSJohn Scipione 
20f01106c3SAxel Dörfler class BMessageRunner;
215c46b171SRene Gollent class BNetworkInterface;
22f01106c3SAxel Dörfler 
23f01106c3SAxel Dörfler 
24f01106c3SAxel Dörfler enum {
25f01106c3SAxel Dörfler 	kStatusUnknown = 0,
26f01106c3SAxel Dörfler 	kStatusNoLink,
27f01106c3SAxel Dörfler 	kStatusLinkNoConfig,
28f01106c3SAxel Dörfler 	kStatusConnecting,
29f01106c3SAxel Dörfler 	kStatusReady,
30f01106c3SAxel Dörfler 
31f01106c3SAxel Dörfler 	kStatusCount
32f01106c3SAxel Dörfler };
33f01106c3SAxel Dörfler 
345c46b171SRene Gollent 
35f01106c3SAxel Dörfler class NetworkStatusView : public BView {
36f01106c3SAxel Dörfler 	public:
37f01106c3SAxel Dörfler 		NetworkStatusView(BRect frame, int32 resizingMode,
38f01106c3SAxel Dörfler 			bool inDeskbar = false);
39f01106c3SAxel Dörfler 		NetworkStatusView(BMessage* archive);
40f01106c3SAxel Dörfler 		virtual	~NetworkStatusView();
41f01106c3SAxel Dörfler 
42f01106c3SAxel Dörfler 		static	NetworkStatusView* Instantiate(BMessage* archive);
43f01106c3SAxel Dörfler 		virtual	status_t Archive(BMessage* archive, bool deep = true) const;
44f01106c3SAxel Dörfler 
45f01106c3SAxel Dörfler 		virtual	void	AttachedToWindow();
46f01106c3SAxel Dörfler 		virtual	void	DetachedFromWindow();
47f01106c3SAxel Dörfler 
48f01106c3SAxel Dörfler 		virtual	void	MessageReceived(BMessage* message);
49f01106c3SAxel Dörfler 		virtual void	FrameResized(float width, float height);
50f01106c3SAxel Dörfler 		virtual	void	MouseDown(BPoint where);
51f01106c3SAxel Dörfler 		virtual	void	Draw(BRect updateRect);
52f01106c3SAxel Dörfler 
53f01106c3SAxel Dörfler 	private:
54f01106c3SAxel Dörfler 		void			_AboutRequested();
55f01106c3SAxel Dörfler 		void			_Quit();
56f01106c3SAxel Dörfler 		void			_Init();
57f01106c3SAxel Dörfler 		void			_UpdateBitmaps();
58f01106c3SAxel Dörfler 		void			_ShowConfiguration(BMessage* message);
595c46b171SRene Gollent 		int32			_DetermineInterfaceStatus(
605c46b171SRene Gollent 							const BNetworkInterface& interface);
61f01106c3SAxel Dörfler 		void			_Update(bool force = false);
623b41ad86SStephan Aßmus 		void			_OpenNetworksPreferences();
63f01106c3SAxel Dörfler 
645c46b171SRene Gollent 		std::map<BString, int32>
655c46b171SRene Gollent 						fInterfaceStatuses;
66f01106c3SAxel Dörfler 		bool			fInDeskbar;
67e58807edSAlexander von Gluck IV 		BBitmap*		fTrayIcons[kStatusCount];
68e58807edSAlexander von Gluck IV 		BBitmap*		fNotifyIcons[kStatusCount];
69f01106c3SAxel Dörfler };
70f01106c3SAxel Dörfler 
71f01106c3SAxel Dörfler #endif	// NETWORK_STATUS_VIEW_H
72