edelib 2.0.0
|
00001 /* 00002 * $Id: XSettingsClient.h 2839 2009-09-28 11:36:20Z karijes $ 00003 * 00004 * Client part of XSETTINGS protocol 00005 * Based on implementation from Owen Tylor, copyright (c) 2001 Red Hat, inc. 00006 * Copyright (c) 2005-2007 edelib authors 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef __EDELIB_XSETTINGSCLIENT_H__ 00023 #define __EDELIB_XSETTINGSCLIENT_H__ 00024 00025 #include "XSettingsCommon.h" 00026 00027 EDELIB_NS_BEGIN 00028 00033 enum XSettingsAction { 00034 XSETTINGS_ACTION_NEW = 0, 00035 XSETTINGS_ACTION_CHANGED, 00036 XSETTINGS_ACTION_DELETED 00037 }; 00038 00039 #ifndef SKIP_DOCS 00040 typedef void (*XSettingsCallback)(const char* name, XSettingsAction action, XSettingsSetting* setting, void* data); 00041 #endif 00042 00109 class EDELIB_API XSettingsClient { 00110 private: 00111 XSettingsData* client_data; 00112 XSettingsCallback settings_cb; 00113 void* settings_cb_data; 00114 00115 void check_manager_window(void); 00116 void read_settings(void); 00117 00118 E_DISABLE_CLASS_COPY(XSettingsClient) 00119 public: 00123 XSettingsClient(); 00124 00128 ~XSettingsClient(); 00129 00138 bool init(Display* dpy, int screen, XSettingsCallback cb = 0, void* data = 0); 00139 00144 void clear(void); 00145 00152 static bool manager_running(Display* dpy, int screen); 00153 00159 void callback(XSettingsCallback cb, void* data = 0); 00160 00164 int process_xevent(const XEvent* xev); 00165 00171 void set(const char* name, int val); 00172 00178 void set(const char* name, const char* val); 00179 00188 void set(const char* name, unsigned short red, unsigned short green, unsigned short blue, unsigned short alpha); 00189 00193 void manager_notify(void); 00194 }; 00195 00196 EDELIB_NS_END 00197 #endif