1/*
2 * Copyright 2003-2011 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 <Locker.h>
13#include <Message.h>
14
15
16class BFile;
17
18
19class ShowImageSettings {
20public:
21								ShowImageSettings();
22	virtual						~ShowImageSettings();
23
24			bool				Lock();
25			void				Unlock();
26
27			bool				GetBool(const char* name, bool defaultValue);
28			int32				GetInt32(const char* name, int32 defaultValue);
29			float				GetFloat(const char* name, float defaultValue);
30			BRect				GetRect(const char* name, BRect defaultValue);
31			bigtime_t			GetTime(const char* name,
32									bigtime_t defaultValue);
33			const char* 		GetString(const char* name,
34									const char* defaultValue);
35
36			void				SetBool(const char* name, bool value);
37			void				SetInt32(const char* name, int32 value);
38			void				SetFloat(const char* name, float value);
39			void				SetRect(const char* name, BRect value);
40			void				SetTime(const char* name, bigtime_t value);
41			void				SetString(const char* name, const char* value);
42
43private:
44			bool				_OpenSettingsFile(BFile* file, bool forReading);
45			void				_Load();
46			void				_Save();
47
48private:
49			BLocker				fLock;
50			BMessage			fSettings;
51			bool				fUpdated;
52};
53
54
55#endif	// SHOW_IMAGE_SETTINGS_H
56