vfs: check userland buffers before reading them.
[haiku.git] / src / preferences / virtualmemory / SettingsWindow.h
blob437876e8a03f9bb24c99280ed5c476c6a9d0d348
1 /*
2 * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de
3 * All rights reserved. Distributed under the terms of the MIT License.
5 * Copyright 2010-2012 Haiku, Inc. All rights reserved.
6 * Distributed under the terms of the MIT License.
8 * Authors:
9 * Hamish Morrison, hamish@lavabit.com
10 * Alexander von Gluck, kallisti5@unixzen.com
12 #ifndef SETTINGS_WINDOW_H
13 #define SETTINGS_WINDOW_H
16 #include <MenuItem.h>
17 #include <Slider.h>
18 #include <StatusBar.h>
19 #include <Volume.h>
20 #include <Window.h>
22 #include "Settings.h"
25 class BStringView;
26 class BCheckBox;
27 class BSlider;
28 class BButton;
29 class BMenuField;
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);
37 virtual ~SizeSlider() {};
39 virtual const char* UpdateText() const;
41 private:
42 mutable char fText[128];
46 class VolumeMenuItem : public BMenuItem, public BHandler {
47 public:
48 VolumeMenuItem(BVolume volume, BMessage* message);
49 virtual ~VolumeMenuItem() {}
51 virtual BVolume Volume() { return fVolume; }
52 virtual void MessageReceived(BMessage* message);
53 virtual void GenerateLabel();
55 private:
56 BVolume fVolume;
60 class SettingsWindow : public BWindow {
61 public:
62 SettingsWindow();
63 virtual ~SettingsWindow() {};
65 virtual void MessageReceived(BMessage* message);
66 virtual bool QuitRequested();
68 private:
69 status_t _AddVolumeMenuItem(dev_t device);
70 status_t _RemoveVolumeMenuItem(dev_t device);
71 VolumeMenuItem* _FindVolumeMenuItem(dev_t device);
73 void _RecordChoices();
74 void _Update();
75 void _UpdateSwapInfo();
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;
89 #endif /* SETTINGS_WINDOW_H */