1 /* 2 * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de 3 * All rights reserved. Distributed under the terms of the MIT License. 4 * 5 * Copyright 2010-2012 Haiku, Inc. All rights reserved. 6 * Distributed under the terms of the MIT License. 7 * 8 * Authors: 9 * Hamish Morrison, hamish@lavabit.com 10 * Alexander von Gluck, kallisti5@unixzen.com 11 */ 12 #ifndef SETTINGS_WINDOW_H 13 #define SETTINGS_WINDOW_H 14 15 16 #include <MenuItem.h> 17 #include <Slider.h> 18 #include <StatusBar.h> 19 #include <Volume.h> 20 #include <Window.h> 21 22 #include "Settings.h" 23 24 25 class BStringView; 26 class BCheckBox; 27 class BSlider; 28 class BButton; 29 class BMenuField; 30 31 32 class SizeSlider : public BSlider { 33 public: 34 SizeSlider(const char* name, const char* label, 35 BMessage* message, int32 min, int32 max, 36 uint32 flags); ~SizeSlider()37 virtual ~SizeSlider() {}; 38 39 virtual const char* UpdateText() const; 40 41 private: 42 mutable char fText[128]; 43 }; 44 45 46 class VolumeMenuItem : public BMenuItem, public BHandler { 47 public: 48 VolumeMenuItem(BVolume volume, BMessage* message); ~VolumeMenuItem()49 virtual ~VolumeMenuItem() {} 50 Volume()51 virtual BVolume Volume() { return fVolume; } 52 virtual void MessageReceived(BMessage* message); 53 virtual void GenerateLabel(); 54 55 private: 56 BVolume fVolume; 57 }; 58 59 60 class SettingsWindow : public BWindow { 61 public: 62 SettingsWindow(); ~SettingsWindow()63 virtual ~SettingsWindow() {}; 64 65 virtual void MessageReceived(BMessage* message); 66 virtual bool QuitRequested(); 67 68 private: 69 status_t _AddVolumeMenuItem(dev_t device); 70 status_t _RemoveVolumeMenuItem(dev_t device); 71 VolumeMenuItem* _FindVolumeMenuItem(dev_t device); 72 73 void _RecordChoices(); 74 void _Update(); 75 void _UpdateSwapInfo(); 76 77 BCheckBox* fSwapEnabledCheckBox; 78 BCheckBox* fSwapAutomaticCheckBox; 79 BSlider* fSizeSlider; 80 BButton* fDefaultsButton; 81 BButton* fRevertButton; 82 BStringView* fWarningStringView; 83 BMenuField* fVolumeMenuField; 84 BStatusBar* fSwapUsageBar; 85 Settings fSettings; 86 bool fSetupComplete; 87 }; 88 89 #endif /* SETTINGS_WINDOW_H */ 90