| 1 |
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- |
| 2 |
// ScreenResource.hh for Blackbox - an X11 Window manager |
| 3 |
// Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <[email protected]> |
| 4 |
// Copyright (c) 1997 - 2000, 2002 - 2005 |
| 5 |
// Bradley T Hughes <bhughes at trolltech.com> |
| 6 |
// |
| 7 |
// Permission is hereby granted, free of charge, to any person obtaining a |
| 8 |
// copy of this software and associated documentation files (the "Software"), |
| 9 |
// to deal in the Software without restriction, including without limitation |
| 10 |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 |
// and/or sell copies of the Software, and to permit persons to whom the |
| 12 |
// Software is furnished to do so, subject to the following conditions: |
| 13 |
// |
| 14 |
// The above copyright notice and this permission notice shall be included in |
| 15 |
// all copies or substantial portions of the Software. |
| 16 |
// |
| 17 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 |
// DEALINGS IN THE SOFTWARE. |
| 24 |
|
| 25 |
#ifndef __ScreenResource_hh |
| 26 |
#define __ScreenResource_hh |
| 27 |
|
| 28 |
#include <Bitmap.hh> |
| 29 |
#include <Color.hh> |
| 30 |
#include <Font.hh> |
| 31 |
#include <Texture.hh> |
| 32 |
#include <Util.hh> |
| 33 |
|
| 34 |
#include <vector> |
| 35 |
|
| 36 |
class BScreen; |
| 37 |
|
| 38 |
struct ToolbarOptions { |
| 39 |
bool enabled; |
| 40 |
int placement; |
| 41 |
bool always_on_top, auto_hide; |
| 42 |
int width_percent; |
| 43 |
std::string strftime_format; |
| 44 |
}; |
| 45 |
|
| 46 |
struct SlitOptions { |
| 47 |
int direction; |
| 48 |
int placement; |
| 49 |
bool always_on_top, auto_hide; |
| 50 |
}; |
| 51 |
|
| 52 |
struct WindowStyle { |
| 53 |
struct { |
| 54 |
bt::Color text, foreground, frame_border; |
| 55 |
bt::Texture title, label, button, handle, grip; |
| 56 |
} focus, unfocus; |
| 57 |
bt::Alignment alignment; |
| 58 |
bt::Bitmap iconify, maximize, restore, close; |
| 59 |
bt::Font font; |
| 60 |
bt::Texture pressed; |
| 61 |
unsigned int title_margin, label_margin, button_margin, |
| 62 |
frame_border_width, handle_height; |
| 63 |
|
| 64 |
// calculated |
| 65 |
unsigned int title_height, label_height, button_width, grip_width; |
| 66 |
}; |
| 67 |
|
| 68 |
struct ToolbarStyle { |
| 69 |
bt::Bitmap left, right; |
| 70 |
bt::Color slabel_text, wlabel_text, clock_text, foreground; |
| 71 |
bt::Texture toolbar, slabel, wlabel, clock, button, pressed; |
| 72 |
bt::Font font; |
| 73 |
bt::Alignment alignment; |
| 74 |
unsigned int frame_margin, label_margin, button_margin; |
| 75 |
|
| 76 |
// calculated extents |
| 77 |
unsigned int toolbar_height, label_height, button_width, hidden_height; |
| 78 |
}; |
| 79 |
|
| 80 |
struct SlitStyle { |
| 81 |
bt::Texture slit; |
| 82 |
unsigned int margin; |
| 83 |
}; |
| 84 |
|
| 85 |
|
| 86 |
class ScreenResource : public bt::NoCopy { |
| 87 |
public: |
| 88 |
void loadStyle(BScreen* screen, const std::string& style); |
| 89 |
void load(bt::Resource& res, unsigned int screen); |
| 90 |
void save(bt::Resource& res, BScreen* screen); |
| 91 |
|
| 92 |
inline const ToolbarOptions &toolbarOptions(void) const |
| 93 |
{ return _toolbarOptions; } |
| 94 |
inline const SlitOptions &slitOptions(void) const |
| 95 |
{ return _slitOptions; } |
| 96 |
|
| 97 |
inline const WindowStyle &windowStyle(void) const |
| 98 |
{ return _windowStyle; } |
| 99 |
inline const ToolbarStyle &toolbarStyle(void) const |
| 100 |
{ return _toolbarStyle; } |
| 101 |
inline const SlitStyle &slitStyle(void) const |
| 102 |
{ return _slitStyle; } |
| 103 |
|
| 104 |
inline unsigned int workspaceCount(void) const |
| 105 |
{ return workspace_count; } |
| 106 |
inline void setWorkspaceCount(unsigned int w) |
| 107 |
{ workspace_count = w; } |
| 108 |
|
| 109 |
const bt::ustring workspaceName(unsigned int i) const; |
| 110 |
void setWorkspaceName(unsigned int w, const bt::ustring &name); |
| 111 |
|
| 112 |
inline const std::string& rootCommand(void) const |
| 113 |
{ return root_command; } |
| 114 |
|
| 115 |
private: |
| 116 |
ToolbarOptions _toolbarOptions; |
| 117 |
SlitOptions _slitOptions; |
| 118 |
|
| 119 |
WindowStyle _windowStyle; |
| 120 |
ToolbarStyle _toolbarStyle; |
| 121 |
SlitStyle _slitStyle; |
| 122 |
|
| 123 |
unsigned int workspace_count; |
| 124 |
std::vector<bt::ustring> workspace_names; |
| 125 |
std::string root_command; |
| 126 |
}; |
| 127 |
|
| 128 |
#endif // __ScreenResource_hh |