Lines 11-16
Link Here
|
11 |
#include "wmframe.h" |
11 |
#include "wmframe.h" |
12 |
#include "yrect.h" |
12 |
#include "yrect.h" |
13 |
#include "yicon.h" |
13 |
#include "yicon.h" |
|
|
14 |
#include "wmwinlist.h" |
14 |
|
15 |
|
15 |
#include "intl.h" |
16 |
#include "intl.h" |
16 |
|
17 |
|
Lines 42-52
Link Here
|
42 |
|
43 |
|
43 |
WorkspaceButton::WorkspaceButton(long ws, YWindow *parent): ObjectButton(parent, (YAction *)0) |
44 |
WorkspaceButton::WorkspaceButton(long ws, YWindow *parent): ObjectButton(parent, (YAction *)0) |
44 |
{ |
45 |
{ |
|
|
46 |
fText = newstr(itoa(ws+1)); |
45 |
fWorkspace = ws; |
47 |
fWorkspace = ws; |
46 |
//setDND(true); |
48 |
//setDND(true); |
47 |
} |
49 |
} |
48 |
|
50 |
|
49 |
void WorkspaceButton::handleClick(const XButtonEvent &/*up*/, int /*count*/) { |
51 |
void WorkspaceButton::handleClick(const XButtonEvent &up, int /*count*/) { |
|
|
52 |
switch (up.button) { |
53 |
case 2: |
54 |
if (windowList) |
55 |
windowList->showFocused(-1, -1); |
56 |
break; |
57 |
case 3: |
58 |
manager->popupWindowListMenu(this, up.x_root, up.y_root); |
59 |
break; |
60 |
case 4: |
61 |
manager->switchToPrevWorkspace(false); |
62 |
break; |
63 |
case 5: |
64 |
manager->switchToNextWorkspace(false); |
65 |
break; |
66 |
} |
50 |
} |
67 |
} |
51 |
|
68 |
|
52 |
void WorkspaceButton::handleDNDEnter() { |
69 |
void WorkspaceButton::handleDNDEnter() { |
Lines 95-115
Link Here
|
95 |
fWorkspaceButton = 0; |
112 |
fWorkspaceButton = 0; |
96 |
|
113 |
|
97 |
if (fWorkspaceButton) { |
114 |
if (fWorkspaceButton) { |
98 |
YResourcePaths paths("", false); |
|
|
99 |
|
100 |
int ht = 24; |
115 |
int ht = 24; |
101 |
int leftX = 0; |
116 |
int leftX = 0; |
102 |
|
117 |
|
103 |
for (w = 0; w < workspaceCount; w++) { |
118 |
for (w = 0; w < workspaceCount; w++) { |
104 |
WorkspaceButton *wk = new WorkspaceButton(w, this); |
119 |
WorkspaceButton *wk = new WorkspaceButton(w, this); |
105 |
if (wk) { |
120 |
if (wk) { |
106 |
ref<YIconImage> image |
121 |
wk->setSize(ht * desktop->width() / desktop->height(), ht); |
107 |
(paths.loadImage("workspace/", workspaceNames[w])); |
|
|
108 |
|
109 |
if (image != null) |
110 |
wk->setImage(image); |
111 |
else |
112 |
wk->setText(workspaceNames[w]); |
113 |
|
122 |
|
114 |
char * wn(newstr(my_basename(workspaceNames[w]))); |
123 |
char * wn(newstr(my_basename(workspaceNames[w]))); |
115 |
char * ext(strrchr(wn, '.')); |
124 |
char * ext(strrchr(wn, '.')); |
Lines 217-220
Link Here
|
217 |
#endif |
226 |
#endif |
218 |
} |
227 |
} |
219 |
|
228 |
|
|
|
229 |
void WorkspacesPane::repaint() { |
230 |
for (int w = 0; w < workspaceCount; w++) { |
231 |
fWorkspaceButton[w]->repaint(); |
232 |
} |
233 |
} |
234 |
|
235 |
void WorkspaceButton::paint(Graphics &g, const YRect &/*r*/) { |
236 |
int x(0), y(0), w(width()), h(height()); |
237 |
|
238 |
if (w > 1 && h > 1) { |
239 |
YSurface surface(getSurface()); |
240 |
g.setColor(surface.color); |
241 |
g.drawSurface(surface, x, y, w, h); |
242 |
|
243 |
if (taskBarWorkspacesShowBorders) { |
244 |
x += 1; y += 1; w -= 2; h -= 2; |
245 |
} |
246 |
|
247 |
int wx, wy, ww, wh; |
248 |
int sf = desktop->width() / w; |
249 |
|
250 |
YColor *colors[] = { |
251 |
surface.color, |
252 |
surface.color->brighter(), |
253 |
surface.color->darker(), |
254 |
getColor(), |
255 |
getColor()->brighter(), |
256 |
getColor()->darker() |
257 |
}; |
258 |
|
259 |
for (YFrameWindow *yfw = manager->bottomLayer(WinLayerBelow); |
260 |
yfw; yfw = yfw->prevLayer()) { |
261 |
if (yfw->getActiveLayer() > WinLayerDock) |
262 |
break; |
263 |
if (yfw->isHidden() || !yfw->visibleOn(fWorkspace)) |
264 |
continue; |
265 |
wx = yfw->x() / sf + x; |
266 |
wy = yfw->y() / sf + y; |
267 |
ww = yfw->width() / sf; |
268 |
wh = yfw->height() / sf; |
269 |
if (ww < 1 || wh < 1) { |
270 |
if (yfw->isRollup()) wh = 1; |
271 |
else continue; |
272 |
} |
273 |
if (yfw->isMinimized()) { |
274 |
g.setColor(colors[1]); |
275 |
} else { |
276 |
if (ww > 2 && wh > 2) { |
277 |
if (yfw->focused()) |
278 |
g.setColor(colors[1]); |
279 |
else |
280 |
g.setColor(colors[2]); |
281 |
g.fillRect(wx+1, wy+1, ww-2, wh-2); |
282 |
} |
283 |
g.setColor(colors[5]); |
284 |
} |
285 |
g.drawRect(wx, wy, ww-1, wh-1); |
286 |
} |
287 |
|
288 |
if (taskBarWorkspacesShowBorders) { |
289 |
g.setColor(surface.color); |
290 |
g.draw3DRect(x-1, y-1, w+1, h+1, !isPressed()); |
291 |
} |
292 |
|
293 |
if (taskBarWorkspacesShowNumbers) { |
294 |
ref<YFont> font = getFont(); |
295 |
|
296 |
wx = (w - font->textWidth(fText)) / 2 + x; |
297 |
wy = (h - font->height()) / 2 + font->ascent() + y; |
298 |
|
299 |
g.setFont(font); |
300 |
g.setColor(colors[0]); |
301 |
g.drawChars(fText, 0, strlen(fText), wx+1, wy+1); |
302 |
g.setColor(colors[3]); |
303 |
g.drawChars(fText, 0, strlen(fText), wx, wy); |
304 |
} |
305 |
} |
306 |
} |
307 |
|
220 |
#endif |
308 |
#endif |