2 * Copyright (c) 2003-2013, Haiku, Inc. All Rights Reserved.
3 * Copyright (c) 2004 Daniel Furrer <assimil8or@users.sourceforge.net>
4 * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
5 * Copyright (c) 1998,99 Kazuho Okui and Takashi Murai.
7 * Distributed unter the terms of the MIT License.
10 * Kian Duffy, myob@users.sourceforge.net
11 * Daniel Furrer, assimil8or@users.sourceforge.net
12 * Siarzhuk Zharski, zharik@gmx.li
14 #ifndef PREF_HANDLER_H
15 #define PREF_HANDLER_H
18 #include <SupportDefs.h>
19 #include <GraphicsDefs.h>
26 struct pref_defaults
{
31 #define PREF_TRUE "true"
32 #define PREF_FALSE "false"
34 #define PREF_BLOCK_CURSOR "block"
35 #define PREF_IBEAM_CURSOR "ibeam"
36 #define PREF_UNDERLINE_CURSOR "underline"
44 PrefHandler(const PrefHandler
* p
);
45 PrefHandler(bool loadSettings
= true);
48 static PrefHandler
*Default();
49 static void DeleteDefault();
50 static void SetDefault(PrefHandler
*handler
);
52 status_t
OpenText(const char *path
);
53 void SaveDefaultAsText();
54 void SaveAsText(const char *path
, const char *minmtype
= NULL
,
55 const char *signature
= NULL
);
57 int32
getInt32(const char *key
);
58 float getFloat(const char *key
);
59 const char* getString(const char *key
);
60 bool getBool(const char *key
);
61 rgb_color
getRGB(const char *key
);
62 int getCursor(const char *key
);
64 void setInt32(const char *key
, int32 data
);
65 void setFloat(const char *key
, float data
);
66 void setString(const char *key
, const char *data
);
67 void setBool(const char *key
, bool data
);
68 void setRGB(const char *key
, const rgb_color data
);
72 static status_t
GetDefaultPath(BPath
& path
);
75 void _ConfirmFont(const BFont
*fallbackFont
);
76 status_t
_LoadFromDefault(const pref_defaults
* defaults
= NULL
);
77 status_t
_LoadFromTextFile(const char * path
);
81 static PrefHandler
*sPrefHandler
;
84 #endif // PREF_HANDLER_H