xref: /haiku/src/apps/networkstatus/NetworkStatusView.h (revision e58807ed85d518c3ccf9e0a7ec77b55a3d3e2701)
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 
17f01106c3SAxel Dörfler class BMessageRunner;
18f01106c3SAxel Dörfler 
19f01106c3SAxel Dörfler 
20f01106c3SAxel Dörfler enum {
21f01106c3SAxel Dörfler 	kStatusUnknown = 0,
22f01106c3SAxel Dörfler 	kStatusNoLink,
23f01106c3SAxel Dörfler 	kStatusLinkNoConfig,
24f01106c3SAxel Dörfler 	kStatusConnecting,
25f01106c3SAxel Dörfler 	kStatusReady,
26f01106c3SAxel Dörfler 
27f01106c3SAxel Dörfler 	kStatusCount
28f01106c3SAxel Dörfler };
29f01106c3SAxel Dörfler 
30f01106c3SAxel Dörfler class NetworkStatusView : public BView {
31f01106c3SAxel Dörfler 	public:
32f01106c3SAxel Dörfler 		NetworkStatusView(BRect frame, int32 resizingMode,
33f01106c3SAxel Dörfler 			bool inDeskbar = false);
34f01106c3SAxel Dörfler 		NetworkStatusView(BMessage* archive);
35f01106c3SAxel Dörfler 		virtual	~NetworkStatusView();
36f01106c3SAxel Dörfler 
37f01106c3SAxel Dörfler 		static	NetworkStatusView* Instantiate(BMessage* archive);
38f01106c3SAxel Dörfler 		virtual	status_t Archive(BMessage* archive, bool deep = true) const;
39f01106c3SAxel Dörfler 
40f01106c3SAxel Dörfler 		virtual	void	AttachedToWindow();
41f01106c3SAxel Dörfler 		virtual	void	DetachedFromWindow();
42f01106c3SAxel Dörfler 
43f01106c3SAxel Dörfler 		virtual	void	MessageReceived(BMessage* message);
44f01106c3SAxel Dörfler 		virtual void	FrameResized(float width, float height);
45f01106c3SAxel Dörfler 		virtual	void	MouseDown(BPoint where);
46f01106c3SAxel Dörfler 		virtual	void	Draw(BRect updateRect);
47f01106c3SAxel Dörfler 
48f01106c3SAxel Dörfler 	private:
49f01106c3SAxel Dörfler 		void			_AboutRequested();
50f01106c3SAxel Dörfler 		void			_Quit();
51f01106c3SAxel Dörfler 		void			_Init();
52f01106c3SAxel Dörfler 		void			_UpdateBitmaps();
53f01106c3SAxel Dörfler 		void			_ShowConfiguration(BMessage* message);
54f01106c3SAxel Dörfler 		bool			_PrepareRequest(struct ifreq& request,
55f01106c3SAxel Dörfler 							const char* name);
56f01106c3SAxel Dörfler 		int32			_DetermineInterfaceStatus(const char* name);
57f01106c3SAxel Dörfler 		void			_Update(bool force = false);
583b41ad86SStephan Aßmus 		void			_OpenNetworksPreferences();
59f01106c3SAxel Dörfler 
60f01106c3SAxel Dörfler 		BObjectList<BString> fInterfaces;
61f01106c3SAxel Dörfler 		bool			fInDeskbar;
62*e58807edSAlexander von Gluck IV 		BBitmap*		fTrayIcons[kStatusCount];
63*e58807edSAlexander von Gluck IV 		BBitmap*		fNotifyIcons[kStatusCount];
64f01106c3SAxel Dörfler 		int32			fStatus;
65f01106c3SAxel Dörfler };
66f01106c3SAxel Dörfler 
67f01106c3SAxel Dörfler #endif	// NETWORK_STATUS_VIEW_H
68