aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Theme.cc19
-rw-r--r--src/FbTk/Theme.hh2
2 files changed, 18 insertions, 3 deletions
diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index e6a07d0..8978e11 100644
--- a/src/FbTk/Theme.cc
+++ b/src/FbTk/Theme.cc
@@ -83,7 +83,8 @@ bool ThemeManager::unregisterTheme(Theme &tm) {
83 return true; 83 return true;
84} 84}
85 85
86bool ThemeManager::load(const std::string &filename, int screen_num) { 86bool ThemeManager::load(const std::string &filename,
87 const std::string &overlay_filename, int screen_num) {
87 std::string location = FbTk::StringUtil::expandFilename(filename); 88 std::string location = FbTk::StringUtil::expandFilename(filename);
88 std::string prefix = ""; 89 std::string prefix = "";
89 90
@@ -107,6 +108,20 @@ bool ThemeManager::load(const std::string &filename, int screen_num) {
107 if (!m_database.load(location.c_str())) 108 if (!m_database.load(location.c_str()))
108 return false; 109 return false;
109 110
111
112 if (!overlay_filename.empty()) {
113 std::string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename);
114 if (FileUtil::isRegularFile(overlay_location.c_str())) {
115 XrmDatabaseHelper overlay_db;
116 if (overlay_db.load(overlay_location.c_str())) {
117 // after a merge the src_db is destroyed
118 // so, make sure XrmDatabaseHelper::m_database == 0
119 XrmMergeDatabases(*overlay_db, &(*m_database));
120 *overlay_db = 0;
121 }
122 }
123 }
124
110 // relies on the fact that load_rc clears search paths each time 125 // relies on the fact that load_rc clears search paths each time
111 if (m_themelocation != "") { 126 if (m_themelocation != "") {
112 Image::removeSearchPath(m_themelocation); 127 Image::removeSearchPath(m_themelocation);
@@ -129,8 +144,8 @@ bool ThemeManager::load(const std::string &filename, int screen_num) {
129 loadTheme(**theme_it); 144 loadTheme(**theme_it);
130 else if (screen_num == (*theme_it)->screenNum()) // specified screen 145 else if (screen_num == (*theme_it)->screenNum()) // specified screen
131 loadTheme(**theme_it); 146 loadTheme(**theme_it);
132
133 } 147 }
148
134 // notify all themes that we reconfigured 149 // notify all themes that we reconfigured
135 theme_it = m_themelist.begin(); 150 theme_it = m_themelist.begin();
136 for (; theme_it != theme_it_end; ++theme_it) { 151 for (; theme_it != theme_it_end; ++theme_it) {
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh
index 18348c2..c5d8e36 100644
--- a/src/FbTk/Theme.hh
+++ b/src/FbTk/Theme.hh
@@ -127,7 +127,7 @@ class ThemeManager {
127public: 127public:
128 static ThemeManager &instance(); 128 static ThemeManager &instance();
129 /// load style file "filename" to screen 129 /// load style file "filename" to screen
130 bool load(const std::string &filename, int screen_num = -1); 130 bool load(const std::string &filename, const std::string &overlay_filename, int screen_num = -1);
131 std::string resourceValue(const std::string &name, const std::string &altname); 131 std::string resourceValue(const std::string &name, const std::string &altname);
132 void loadTheme(Theme &tm); 132 void loadTheme(Theme &tm);
133 bool loadItem(ThemeItem_base &resource); 133 bool loadItem(ThemeItem_base &resource);