xref: /haiku/src/apps/showimage/ShowImageSettings.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  * Copyright 2003-2009 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer, laplace@haiku-os.org
7  */
8 #ifndef SHOW_IMAGE_SETTINGS_H
9 #define SHOW_IMAGE_SETTINGS_H
10 
11 
12 #include <File.h>
13 #include <Message.h>
14 #include <Locker.h>
15 
16 
17 class ShowImageSettings {
18 public:
19 					ShowImageSettings();
20 					~ShowImageSettings();
21 
22 	bool			Lock();
23 	bool			GetBool(const char* name, bool defaultValue);
24 	int32			GetInt32(const char* name, int32 defaultValue);
25 	float			GetFloat(const char* name, float defaultValue);
26 	BRect			GetRect(const char* name, BRect defaultValue);
27 	const char* 	GetString(const char* name, const char* defaultValue);
28 	void			SetBool(const char* name, bool value);
29 	void			SetInt32(const char* name, int32 value);
30 	void			SetFloat(const char* name, float value);
31 	void			SetRect(const char* name, BRect value);
32 	void			SetString(const char* name, const char* value);
33 	void			Unlock();
34 
35 private:
36 	bool			OpenSettingsFile(BFile* file, bool forReading);
37 	void			Load();
38 	void			Save();
39 
40 	BLocker			fLock;
41 	BMessage		fSettings;
42 };
43 
44 
45 #endif	// SHOW_IMAGE_SETTINGS_H
46