]> icculus.org git repositories - taylor/freespace2.git/blob - include/launcher.h
fix issue with looping audio streams
[taylor/freespace2.git] / include / launcher.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 #ifndef LAUNCHER_H
10 #define LAUNCHER_H
11
12 #include "wx/wxprec.h"
13
14 #ifndef WX_PRECOMP
15         #include "wx/wx.h"
16 #endif
17
18 #include "wx/sound.h"
19
20 #include "al.h"
21 #include "alc.h"
22
23
24 class wxBackgroundBitmap : public wxEvtHandler
25 {
26         private:
27                 typedef wxEvtHandler Inherited;
28
29         protected:
30                 wxBitmap Bitmap;
31
32         public:
33                 wxBackgroundBitmap(const wxBitmap &B) : wxEvtHandler(), Bitmap(B) { }
34                 virtual bool ProcessEvent(wxEvent &Event);
35 };
36
37 class wxLauncherButton : public wxStaticBitmap
38 {
39         private:
40                 bool m_in_hover;
41
42                 wxBitmap m_bitmap;
43                 wxBitmap m_bitmap_hover;
44                 wxBitmap m_bitmap_pressed;
45
46                 wxDECLARE_EVENT_TABLE();
47
48         protected:
49
50
51         public:
52                 wxLauncherButton(wxWindow* parent, wxWindowID id, const wxBitmap& label, const wxPoint& pos, const wxSize& size);
53                 ~wxLauncherButton();
54
55                 void onMouseDown(wxMouseEvent& event);
56                 void onMouseUp(wxMouseEvent& event);
57                 void onMouseEnter(wxMouseEvent& event);
58                 void onMouseLeave(wxMouseEvent& event);
59
60                 void SetBitmapHover(const wxBitmap& bitmap)
61                 {
62                         m_bitmap_hover = bitmap;
63                 }
64
65                 void SetBitmapPressed(const wxBitmap& bitmap)
66                 {
67                         m_bitmap_pressed = bitmap;
68                 }
69 };
70
71 class Launcher : public wxDialog
72 {
73         private:
74                 bool use_sound;
75
76                 ALCdevice *al_device;
77                 ALCcontext *al_context;
78
79                 ALuint m_snd_hover_buf_id;
80                 ALuint m_snd_click_buf_id;
81
82                 ALuint m_snd_hover_source_id;
83                 ALuint m_snd_click_source_id;
84
85                 void init_sound();
86                 void close_sound();
87
88                 wxDECLARE_EVENT_TABLE();
89
90         protected:
91
92                 enum {
93                         ID_B_PLAY = 1000,
94                         ID_B_SETUP,
95                         ID_B_README,
96                         ID_B_UPDATE,
97                         ID_B_HELP,
98                         ID_B_UNINSTALL,
99                         ID_B_VOLITION,
100                         ID_B_PXO,
101                         ID_B_QUIT
102                 };
103
104                 wxBackgroundBitmap *p_background;
105
106                 wxPanel* m_panel;
107
108 #ifndef MAKE_FS1
109                 wxLauncherButton* m_btn_Play;
110                 wxLauncherButton* m_btn_Setup;
111                 wxLauncherButton* m_btn_Readme;
112                 wxLauncherButton* m_btn_Update;
113                 wxLauncherButton* m_btn_Help;
114                 wxLauncherButton* m_btn_Uninstall;
115                 wxLauncherButton* m_btn_Volition;
116                 wxLauncherButton* m_btn_PXO;
117                 wxLauncherButton* m_btn_Quit;
118 #else
119                 wxButton* m_btn_Play;
120                 wxButton* m_btn_Setup;
121                 wxButton* m_btn_Readme;
122                 wxButton* m_btn_Update;
123                 wxButton* m_btn_Uninstall;
124                 wxButton* m_btn_Volition;
125                 wxButton* m_btn_Quit;
126 #endif
127
128                 void OnClose(wxCloseEvent& event);
129
130                 void OnPlay(wxCommandEvent& event);
131                 void OnSetup(wxCommandEvent& event);
132                 void OnReadme(wxCommandEvent& event);
133                 void OnUpdate(wxCommandEvent& event);
134                 void OnHelp(wxCommandEvent& event);
135                 void OnUninstall(wxCommandEvent& event);
136                 void OnVolition(wxCommandEvent& event);
137                 void OnPXO(wxCommandEvent& event);
138                 void OnQuit(wxCommandEvent& event);
139
140         public:
141
142                 Launcher( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Launcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
143                 ~Launcher();
144
145                 void JumpToSetup();
146
147                 void SndPlayHover();
148                 void SndPlayPressed();
149                 void SndEnable(bool enabled     = true);
150 };
151
152 #endif // LAUNCHER_H