usb_ecm: Use the current configuration instead of a fixed one.
[haiku.git] / src / preferences / media / MediaViews.h
blob486677235a8f438e283f241decdd283f432ecf6b
1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
2 //
3 // Copyright (c) 2003, OpenBeOS
4 //
5 // This software is part of the OpenBeOS distribution and is covered
6 // by the OpenBeOS license.
7 //
8 //
9 // File: MediaViews.h
10 // Author: Sikosis, Jérôme Duval
11 // Description: Media Preferences
12 // Created : June 25, 2003
13 //
14 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
15 #ifndef __MEDIAVIEWS_H__
16 #define __MEDIAVIEWS_H__
17 #include <GroupView.h>
18 #include <MediaAddOn.h>
19 #include <MenuItem.h>
21 #include <ObjectList.h>
24 class BBox;
25 class BButton;
26 class BCheckBox;
27 class BMenu;
28 class BMenuField;
29 class BString;
30 class BStringView;
32 class MediaWindow;
35 const uint32 ML_RESTART_MEDIA_SERVER = 'resr';
36 const uint32 ML_DEFAULT_CHANNEL_CHANGED = 'chch';
39 class NodeMenuItem : public BMenuItem
41 public:
42 NodeMenuItem(const dormant_node_info* info,
43 BMessage* message, char shortcut = 0,
44 uint32 modifiers = 0);
45 virtual status_t Invoke(BMessage* message = NULL);
47 const dormant_node_info* NodeInfo() const {return fInfo;}
48 private:
50 const dormant_node_info* fInfo;
54 class ChannelMenuItem : public BMenuItem
56 public:
57 ChannelMenuItem(media_input* input,
58 BMessage* message, char shortcut = 0,
59 uint32 modifiers = 0);
60 virtual ~ChannelMenuItem();
62 int32 DestinationID();
63 media_input* Input();
65 virtual status_t Invoke(BMessage* message = NULL);
67 private:
68 media_input* fInput;
72 class SettingsView : public BGroupView
74 public:
75 typedef BObjectList<dormant_node_info> NodeList;
77 SettingsView();
78 void AddInputNodes(NodeList& nodes);
79 void AddOutputNodes(NodeList& nodes);
81 virtual void SetDefaultInput(const dormant_node_info* info);
82 virtual void SetDefaultOutput(const dormant_node_info* info);
84 virtual void MessageReceived(BMessage* message);
85 virtual void AttachedToWindow();
88 protected:
90 BMenu* InputMenu() {return fInputMenu;}
91 BMenu* OutputMenu() {return fOutputMenu;}
93 BButton* MakeRestartButton();
95 void _EmptyMenu(BMenu* menu);
96 MediaWindow* _MediaWindow() const;
98 private:
99 void _PopulateMenu(BMenu* menu, NodeList& nodes,
100 const BMessage& message);
101 NodeMenuItem* _FindNodeItem(BMenu* menu,
102 const dormant_node_info* nodeInfo);
103 void _ClearMenuSelection(BMenu* menu);
105 BMenu* fInputMenu;
106 BMenu* fOutputMenu;
110 class AudioSettingsView : public SettingsView
112 public:
113 AudioSettingsView();
115 void SetDefaultChannel(int32 channelID);
117 virtual void SetDefaultInput(const dormant_node_info* info);
118 virtual void SetDefaultOutput(const dormant_node_info* info);
120 virtual void MessageReceived(BMessage* message);
121 virtual void AttachedToWindow();
123 private:
124 BMenuField* _MakeChannelMenu();
125 BCheckBox* _MakeVolumeCheckBox();
126 void _FillChannelMenu(const dormant_node_info* info);
128 void _ShowDeskbarVolumeControl();
129 void _HideDeskbarVolumeControl();
131 ChannelMenuItem* _ChannelMenuItemAt(int32 index);
133 BMenu* fChannelMenu;
134 BCheckBox* fVolumeCheckBox;
138 class VideoSettingsView : public SettingsView
140 public:
141 VideoSettingsView();
143 virtual void SetDefaultInput(const dormant_node_info* info);
144 virtual void SetDefaultOutput(const dormant_node_info* info);
147 #endif