src/draw.cpp

Go to the documentation of this file.
00001 // Copyright (c) 2003 - 2004 Anselm R. Garbe <anselmg at t-online.de>
00002 // See ../LICENSE.txt for license details.
00003 //
00004 // $Id: draw.cpp 2 2007-05-16 10:38:27Z eg $
00005 
00006 #include <iostream>
00007 
00008 #include "draw.h"
00009 
00010 #include "../config.h"
00011 #include "kernel.h"
00012 #include "rectangle.h"
00013 #include "xcore.h"
00014 
00015 #define XCORE XCore::instance()
00016 #define FIGURE_DISTANCE 3
00017 
00018 void Draw::drawDetachButton(Window window, GC gc,
00019         Rectangle *rect, unsigned long background,
00020         unsigned long shineBorder, unsigned long shadowBorder,
00021         unsigned long shineFigure, unsigned long shadowFigure)
00022 {
00023 
00024     XCORE->setForeground(gc, background);
00025     XCORE->fillRectangle(window, gc, rect);
00026 
00027     XPoint shineButtonPoints[3];
00028     shineButtonPoints[0].x = rect->x() + FIGURE_DISTANCE;
00029     shineButtonPoints[0].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00030     shineButtonPoints[1].x = rect->x() + FIGURE_DISTANCE;
00031     shineButtonPoints[1].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00032     shineButtonPoints[2].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00033     shineButtonPoints[2].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00034     XCORE->setForeground(gc, shineFigure);
00035     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00036 
00037     XPoint shadowButtonPoints[3];
00038     shadowButtonPoints[0].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00039     shadowButtonPoints[0].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00040     shadowButtonPoints[1].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00041     shadowButtonPoints[1].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00042     shadowButtonPoints[2].x = rect->x() + FIGURE_DISTANCE;
00043     shadowButtonPoints[2].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00044     XCORE->setForeground(gc, shadowFigure);
00045     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00046 
00047     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00048 }
00049 
00050 void Draw::drawMaxButton(Window window, GC gc,
00051         Rectangle *rect, unsigned long background,
00052         unsigned long shineBorder, unsigned long shadowBorder,
00053         unsigned long shineFigure, unsigned long shadowFigure,
00054         bool fill)
00055 
00056 {
00057     XCORE->setForeground(gc, background);
00058     XCORE->fillRectangle(window, gc, rect);
00059 
00060     XPoint shadowButtonPoints[3];
00061     shadowButtonPoints[0].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00062     shadowButtonPoints[0].y = rect->y() + FIGURE_DISTANCE;
00063     shadowButtonPoints[1].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00064     shadowButtonPoints[1].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00065     shadowButtonPoints[2].x = rect->x() + FIGURE_DISTANCE;
00066     shadowButtonPoints[2].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00067     XCORE->setForeground(gc, shadowFigure);
00068     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00069 
00070     XPoint shineButtonPoints[3];
00071     shineButtonPoints[0].x = rect->x() + FIGURE_DISTANCE;
00072     shineButtonPoints[0].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00073     shineButtonPoints[1].x = rect->x() + FIGURE_DISTANCE;
00074     shineButtonPoints[1].y = rect->y() + FIGURE_DISTANCE;
00075     shineButtonPoints[2].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00076     shineButtonPoints[2].y = rect->y() + FIGURE_DISTANCE;
00077     XCORE->setForeground(gc, shineFigure);
00078     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00079 
00080     if (fill) {
00081         XCORE->setForeground(gc, shineFigure);
00082         XCORE->fillRectangle(window, gc,
00083                              rect->x() + FIGURE_DISTANCE + 1,
00084                              rect->y() + FIGURE_DISTANCE + 1,
00085                              rect->width() - 2 * FIGURE_DISTANCE - 2,
00086                              rect->height() - 2 * FIGURE_DISTANCE - 2);
00087     }
00088 
00089     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00090 }
00091 
00092 void Draw::drawMenuButton(Window window, GC gc,
00093         Rectangle *rect, unsigned long background,
00094         unsigned long shineBorder, unsigned long shadowBorder,
00095         unsigned long shineFigure, unsigned long shadowFigure)
00096 {
00097     XCORE->setForeground(gc, background);
00098     XCORE->fillRectangle(window, gc, rect);
00099 
00100     // shine lines
00101     XCORE->setForeground(gc, shineFigure);
00102     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00103                                 rect->y() + FIGURE_DISTANCE,
00104                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00105                                 rect->y() + FIGURE_DISTANCE);
00106     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00107                                 rect->y() + rect->height() / 2,
00108                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00109                                 rect->y() + rect->height() / 2);
00110     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00111                                 rect->y() + rect->height() - FIGURE_DISTANCE - 1,
00112                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00113                                 rect->y() + rect->height() - FIGURE_DISTANCE - 1);
00114 
00115     // shadow lines
00116     XCORE->setForeground(gc, shadowFigure);
00117     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00118                                 rect->y() + FIGURE_DISTANCE + 1,
00119                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00120                                 rect->y() + FIGURE_DISTANCE + 1);
00121     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00122                                 rect->y() + rect->height() / 2 + 1,
00123                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00124                                 rect->y() + rect->height() / 2 + 1);
00125     XCORE->drawLine(window, gc, rect->x() + FIGURE_DISTANCE,
00126                                 rect->y() + rect->height() - FIGURE_DISTANCE,
00127                                 rect->x() + rect->width() - FIGURE_DISTANCE,
00128                                 rect->y() + rect->height() - FIGURE_DISTANCE);
00129 
00130     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00131 }
00132 
00133 void Draw::drawFloatButton(Window window, GC gc,
00134         Rectangle *rect, unsigned long background,
00135         unsigned long shineBorder, unsigned long shadowBorder,
00136         unsigned long shineFigure, unsigned long shadowFigure,
00137         bool fill)
00138 {
00139     XCORE->setForeground(gc, background);
00140     XCORE->fillRectangle(window, gc, rect);
00141 
00142     XPoint shadowButtonPoints[3];
00143     shadowButtonPoints[0].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00144     shadowButtonPoints[0].y = rect->y() + FIGURE_DISTANCE;
00145     shadowButtonPoints[1].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00146     shadowButtonPoints[1].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00147     shadowButtonPoints[2].x = rect->x() + FIGURE_DISTANCE;
00148     shadowButtonPoints[2].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00149     XCORE->setForeground(gc, shadowFigure);
00150     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00151 
00152     shadowButtonPoints[0].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00153     shadowButtonPoints[0].y = rect->y() + 2 * FIGURE_DISTANCE;
00154     shadowButtonPoints[1].x = rect->x() + rect->width() -  FIGURE_DISTANCE - 1;
00155     shadowButtonPoints[1].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00156     shadowButtonPoints[2].x = rect->x() + 2 * FIGURE_DISTANCE;
00157     shadowButtonPoints[2].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00158     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00159 
00160     XPoint shineButtonPoints[3];
00161     shineButtonPoints[0].x = rect->x() + FIGURE_DISTANCE;
00162     shineButtonPoints[0].y = rect->y() + rect->height() - 2 * FIGURE_DISTANCE - 1;
00163     shineButtonPoints[1].x = rect->x() + FIGURE_DISTANCE;
00164     shineButtonPoints[1].y = rect->y() + FIGURE_DISTANCE;
00165     shineButtonPoints[2].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00166     shineButtonPoints[2].y = rect->y() + FIGURE_DISTANCE;
00167     XCORE->setForeground(gc, shineFigure);
00168     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00169 
00170     shineButtonPoints[0].x = rect->x() + 2 * FIGURE_DISTANCE;
00171     shineButtonPoints[0].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00172     shineButtonPoints[1].x = rect->x() + 2 * FIGURE_DISTANCE;
00173     shineButtonPoints[1].y = rect->y() + 2 * FIGURE_DISTANCE;
00174     shineButtonPoints[2].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00175     shineButtonPoints[2].y = rect->y() + 2 * FIGURE_DISTANCE;
00176     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00177 
00178     if (fill) {
00179         XCORE->setForeground(gc, shineFigure);
00180         XCORE->fillRectangle(window, gc,
00181                              rect->x() + FIGURE_DISTANCE + 1,
00182                              rect->y() + FIGURE_DISTANCE + 1,
00183                              rect->width() - 3 * FIGURE_DISTANCE - 2,
00184                              rect->height() - 3 * FIGURE_DISTANCE - 2);
00185 
00186         XCORE->fillRectangle(window, gc,
00187                              rect->x() + 2 * FIGURE_DISTANCE + 1,
00188                              rect->y() + 2 * FIGURE_DISTANCE + 1,
00189                              rect->width() - 3 * FIGURE_DISTANCE - 2,
00190                              rect->height() - 3 * FIGURE_DISTANCE - 2);
00191     }
00192 
00193     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00194 }
00195 
00196 void Draw::drawCloseButton(Window window, GC gc,
00197         Rectangle *rect, unsigned long background,
00198         unsigned long shineBorder, unsigned long shadowBorder,
00199         unsigned long shineFigure, unsigned long shadowFigure)
00200 {
00201     XCORE->setForeground(gc, background);
00202     XCORE->fillRectangle(window, gc, rect);
00203 
00204     int mx = rect->x() + rect->width() / 2;
00205     int my = rect->y() + rect->height() / 2;
00206     int md = FIGURE_DISTANCE / 2 + 1;
00207     XPoint shineButtonPoints[3];
00208     shineButtonPoints[0].x = mx - md;
00209     shineButtonPoints[0].y = my + md;
00210     shineButtonPoints[1].x = shineButtonPoints[0].x;
00211     shineButtonPoints[1].y = my - md;
00212     shineButtonPoints[2].x = mx + md;
00213     shineButtonPoints[2].y = shineButtonPoints[1].y;
00214     XCORE->setForeground(gc, shineFigure);
00215     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00216 
00217     XPoint shadowButtonPoints[3];
00218     shadowButtonPoints[0].x = mx + md;
00219     shadowButtonPoints[0].y = my - md;
00220     shadowButtonPoints[1].x = shadowButtonPoints[0].x;
00221     shadowButtonPoints[1].y = my + md;
00222     shadowButtonPoints[2].x = mx - md;
00223     shadowButtonPoints[2].y = my + md;
00224     XCORE->setForeground(gc, shadowFigure);
00225     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00226 
00227     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00228 }
00229 
00230 void Draw::drawInputModeButton(Window window, GC gc, Rectangle *rect,
00231         unsigned long background,
00232         unsigned long shineBorder, unsigned long shadowBorder,
00233         unsigned long shineFigure, unsigned long shadowFigure)
00234 {
00235     XCORE->setForeground(gc, background);
00236     XCORE->fillRectangle(window, gc, rect);
00237 
00238     XPoint shadowButtonPoints[2];
00239     shadowButtonPoints[0].x = rect->x() + 2 * FIGURE_DISTANCE;
00240     shadowButtonPoints[0].y = rect->y() + FIGURE_DISTANCE;
00241     shadowButtonPoints[1].x = rect->x() + 2 * FIGURE_DISTANCE;
00242     shadowButtonPoints[1].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00243     shadowButtonPoints[2].x = rect->x() + FIGURE_DISTANCE;
00244     shadowButtonPoints[2].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00245     XCORE->setForeground(gc, shadowFigure);
00246     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00247 
00248     shadowButtonPoints[0].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00249     shadowButtonPoints[0].y = rect->y() + FIGURE_DISTANCE;
00250     shadowButtonPoints[1].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00251     shadowButtonPoints[1].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00252     shadowButtonPoints[2].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00253     shadowButtonPoints[2].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00254     XCORE->drawLines(window, gc, shadowButtonPoints, 3);
00255 
00256     XPoint shineButtonPoints[3];
00257     shineButtonPoints[0].x = rect->x() + FIGURE_DISTANCE;
00258     shineButtonPoints[0].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00259     shineButtonPoints[1].x = rect->x() + FIGURE_DISTANCE;
00260     shineButtonPoints[1].y = rect->y() + FIGURE_DISTANCE;
00261     shineButtonPoints[2].x = rect->x() + 2 * FIGURE_DISTANCE;
00262     shineButtonPoints[2].y = rect->y() + FIGURE_DISTANCE;
00263     XCORE->setForeground(gc, shineFigure);
00264     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00265 
00266     shineButtonPoints[0].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00267     shineButtonPoints[0].y = rect->y() + rect->height() - FIGURE_DISTANCE - 1;
00268     shineButtonPoints[1].x = rect->x() + rect->width() - 2 * FIGURE_DISTANCE - 1;
00269     shineButtonPoints[1].y = rect->y() + FIGURE_DISTANCE;
00270     shineButtonPoints[2].x = rect->x() + rect->width() - FIGURE_DISTANCE - 1;
00271     shineButtonPoints[2].y = rect->y() + FIGURE_DISTANCE;
00272     XCORE->drawLines(window, gc, shineButtonPoints, 3);
00273 
00274     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00275 }
00276 
00277 void Draw::drawMeter(Window window, GC gc, Rectangle *rect,
00278                      unsigned int percentage, unsigned long background,
00279                      unsigned long highFigure, unsigned long normalFigure,
00280                      unsigned long lowFigure, unsigned long shineBorder,
00281                      unsigned long shadowBorder)
00282 {
00283     XCORE->setForeground(gc, background);
00284     XCORE->fillRectangle(window, gc, rect);
00285 
00286     unsigned int pHeight  = (rect->height() * percentage) / 100;
00287     unsigned long figure = lowFigure;
00288     if (percentage > 66) {
00289         figure = highFigure;
00290     }
00291     else if (percentage > 33) {
00292         figure = normalFigure;
00293     }
00294     XCORE->setForeground(gc, figure);
00295     XCORE->fillRectangle(window, gc,
00296                          rect->x() + 1, rect->y() + (rect->height() - 1 - pHeight),
00297                          rect->width() - 2, pHeight);
00298 
00299     drawRectBorder(window, gc, rect, shineBorder, shadowBorder);
00300 }
00301 
00302 void Draw::drawBorder(Window window, GC commonGC,
00303         GC borderGC, Rectangle *rect,
00304         unsigned long background, unsigned long shine,
00305         unsigned long shadow, unsigned int titleBarHeight,
00306         unsigned int borderWidth)
00307 {
00308     // titlebar 1px separator
00309     XCORE->setForeground(commonGC, background);
00310     if (titleBarHeight > 0 && borderWidth > 0) {
00311         XPoint titleBorderPoints[2];
00312         titleBorderPoints[0].x = borderWidth;
00313         titleBorderPoints[0].y = titleBarHeight;
00314         titleBorderPoints[1].x = rect->width() - borderWidth;
00315         titleBorderPoints[1].y = titleBarHeight;
00316         XCORE->drawLines(window, commonGC, titleBorderPoints, 2);
00317     }
00318 
00319     if (borderWidth == 0) {
00320         return;
00321     }
00322 
00323     // background border
00324     XCORE->setForeground(borderGC, background);
00325     XCORE->drawRectangle(window, borderGC,
00326             borderWidth / 2, borderWidth / 2,
00327             rect->width() - borderWidth,
00328             rect->height() - borderWidth);
00329 
00330     // shadow border
00331     XPoint shadowBorderPoints[3];
00332     shadowBorderPoints[0].x = rect->width() - 1;
00333     shadowBorderPoints[0].y = 0;
00334     shadowBorderPoints[1].x = rect->width() - 1;
00335     shadowBorderPoints[1].y = rect->height() - 1;
00336     shadowBorderPoints[2].x = 0;
00337     shadowBorderPoints[2].y = rect->height() - 1;
00338 
00339     XCORE->setForeground(commonGC, shadow);
00340     XCORE->drawLines(window, commonGC, shadowBorderPoints, 3);
00341 
00342     // shine border
00343     XPoint shineBorderPoints[3];
00344     shineBorderPoints[0].x = 0;
00345     shineBorderPoints[0].y = rect->height() - 1;
00346     shineBorderPoints[1].x = 0;
00347     shineBorderPoints[1].y = 0;
00348     shineBorderPoints[2].x = rect->width() - 1;
00349     shineBorderPoints[2].y = 0;
00350 
00351     XCORE->setForeground(commonGC, shine);
00352     XCORE->drawLines(window, commonGC, shineBorderPoints, 3);
00353 }
00354 
00355 void Draw::drawFloatBorderAnchors(Window window, GC gc, Rectangle *rect,
00356                                 unsigned long shine, unsigned long shadow,
00357                                 unsigned int titleBarHeight, unsigned int borderWidth)
00358 {
00359     XCORE->setForeground(gc, shadow);
00360     XCORE->drawLine(window, gc, titleBarHeight, 0, titleBarHeight, borderWidth);
00361     XCORE->drawLine(window, gc, 0, titleBarHeight, borderWidth, titleBarHeight);
00362     XCORE->drawLine(window, gc, 0, rect->height() - titleBarHeight - 1,
00363                      borderWidth, rect->height() - titleBarHeight);
00364     XCORE->drawLine(window, gc, titleBarHeight, rect->height() - borderWidth,
00365                      titleBarHeight, rect->height());
00366     XCORE->drawLine(window, gc, rect->width() - titleBarHeight - 1, 0,
00367                      rect->width() - titleBarHeight - 1, borderWidth);
00368     XCORE->drawLine(window, gc, rect->width() - borderWidth, titleBarHeight,
00369                      rect->width(), titleBarHeight);
00370     XCORE->drawLine(window, gc, rect->width() - borderWidth, rect->height()
00371                      - titleBarHeight - 1, rect->width(), rect->height()
00372                      - titleBarHeight - 1);
00373     XCORE->drawLine(window, gc, rect->width() - titleBarHeight - 1,
00374                      rect->height() - borderWidth,
00375                      rect->width() - titleBarHeight - 1,
00376                      rect->height());
00377 
00378     XCORE->setForeground(gc, shine);
00379     XCORE->drawLine(window, gc, titleBarHeight + 1, 0,
00380                     titleBarHeight + 1, borderWidth);
00381     XCORE->drawLine(window, gc, 0, titleBarHeight + 1, borderWidth,
00382                     titleBarHeight + 1);
00383     XCORE->drawLine(window, gc, 0, rect->height() - titleBarHeight,
00384                     borderWidth, rect->height() - titleBarHeight);
00385     XCORE->drawLine(window, gc, titleBarHeight + 1,
00386                     rect->height() - borderWidth,
00387                     titleBarHeight + 1, rect->height());
00388     XCORE->drawLine(window, gc, rect->width() - titleBarHeight, 0,
00389                      rect->width() - titleBarHeight, borderWidth);
00390     XCORE->drawLine(window, gc, rect->width() - borderWidth,
00391                     titleBarHeight + 1,
00392                     rect->width(), titleBarHeight + 1);
00393     XCORE->drawLine(window, gc, rect->width() - borderWidth,
00394                     rect->height() - titleBarHeight,
00395                     rect->width(), rect->height() - titleBarHeight);
00396     XCORE->drawLine(window, gc, rect->width() - titleBarHeight,
00397                      rect->height() - borderWidth,
00398                      rect->width() - titleBarHeight,
00399                      rect->height());
00400 }
00401 
00402 void Draw::drawShineBorder(Window window, GC gc, Rectangle *rect,
00403                            unsigned long shine)
00404 {
00405     XPoint shineBorderPoints[3];
00406     shineBorderPoints[0].x = rect->x();
00407     shineBorderPoints[0].y = rect->y() + rect->height() - 1;
00408     shineBorderPoints[1].x = rect->x();
00409     shineBorderPoints[1].y = rect->y();
00410     shineBorderPoints[2].x = rect->x() + rect->width() - 1;
00411     shineBorderPoints[2].y = rect->y();
00412 
00413     XCORE->setForeground(gc, shine);
00414     XCORE->drawLines(window, gc, shineBorderPoints, 3);
00415 }
00416 
00417 void Draw::drawShadowBorder(Window window, GC gc, Rectangle *rect,
00418                                  unsigned long shadow)
00419 {
00420     XPoint shadowBorderPoints[3];
00421     shadowBorderPoints[0].x = rect->x() + rect->width() - 1;
00422     shadowBorderPoints[0].y = rect->y();
00423     shadowBorderPoints[1].x = rect->x() + rect->width() - 1;
00424     shadowBorderPoints[1].y = rect->y() + rect->height() - 1;
00425     shadowBorderPoints[2].x = rect->x();
00426     shadowBorderPoints[2].y = rect->y() + rect->height() - 1;
00427 
00428     XCORE->setForeground(gc, shadow);
00429     XCORE->drawLines(window, gc, shadowBorderPoints, 3);
00430 }
00431 
00432 void Draw::drawRectBorder(Window window, GC gc, Rectangle *rect,
00433                          unsigned long shine, unsigned long shadow)
00434 {
00435     drawShadowBorder(window, gc, rect, shadow);
00436     drawShineBorder(window, gc, rect, shine);
00437 }
00438 
00439 void Draw::drawStickyNotifier(Window window, GC gc, Rectangle *rect,
00440                               unsigned long shine, unsigned long shadow,
00441                               unsigned int textWidth)
00442 {
00443     // We assume that the text is centered!
00444     XCORE->setForeground(gc, shadow);
00445     XCORE->drawLine(window, gc,
00446                     rect->x() + FIGURE_DISTANCE + 1,
00447                     rect->y() + FIGURE_DISTANCE + 2,
00448                     rect->x() + rect->width() / 2 - textWidth / 2 - FIGURE_DISTANCE - 1,
00449                     rect->y() + FIGURE_DISTANCE + 2);
00450 
00451     XCORE->drawLine(window, gc,
00452                     rect->x() + FIGURE_DISTANCE + rect->width() / 2 + textWidth / 2 + FIGURE_DISTANCE,
00453                     rect->y() + FIGURE_DISTANCE + 2,
00454                     rect->x() + rect->width() - FIGURE_DISTANCE - 1,
00455                     rect->y() + FIGURE_DISTANCE + 2);
00456 
00457     XCORE->drawLine(window, gc,
00458                     rect->x() + FIGURE_DISTANCE + 1,
00459                     rect->y() + rect->height() - FIGURE_DISTANCE - 1,
00460                     rect->x() + rect->width() / 2 - textWidth / 2 - FIGURE_DISTANCE - 1,
00461                     rect->y() + rect->height() - FIGURE_DISTANCE - 1);
00462 
00463     XCORE->drawLine(window, gc,
00464                     rect->x() + FIGURE_DISTANCE + rect->width() / 2 + textWidth / 2 + FIGURE_DISTANCE,
00465                     rect->y() + rect->height() - FIGURE_DISTANCE - 1,
00466                     rect->x() + rect->width() - FIGURE_DISTANCE - 1,
00467                     rect->y() + rect->height() - FIGURE_DISTANCE - 1);
00468 
00469     XCORE->setForeground(gc, shine);
00470     XCORE->drawLine(window, gc,
00471                     rect->x() + FIGURE_DISTANCE + 1,
00472                     rect->y() + FIGURE_DISTANCE + 1,
00473                     rect->x() + rect->width() / 2 - textWidth / 2 - FIGURE_DISTANCE - 1,
00474                     rect->y() + FIGURE_DISTANCE + 1);
00475 
00476     XCORE->drawLine(window, gc,
00477                     rect->x() + FIGURE_DISTANCE + rect->width() / 2 + textWidth / 2 + FIGURE_DISTANCE,
00478                     rect->y() + FIGURE_DISTANCE + 1,
00479                     rect->x() + rect->width() - FIGURE_DISTANCE - 1,
00480                     rect->y() + FIGURE_DISTANCE + 1);
00481 
00482     XCORE->drawLine(window, gc,
00483                     rect->x() + FIGURE_DISTANCE + 1,
00484                     rect->y() + rect->height() - FIGURE_DISTANCE - 2,
00485                     rect->x() + rect->width() / 2 - textWidth / 2 - FIGURE_DISTANCE - 1,
00486                     rect->y() + rect->height() - FIGURE_DISTANCE - 2);
00487 
00488     XCORE->drawLine(window, gc,
00489                     rect->x() + FIGURE_DISTANCE + rect->width() / 2 + textWidth / 2 + FIGURE_DISTANCE,
00490                     rect->y() + rect->height() - FIGURE_DISTANCE - 2,
00491                     rect->x() + rect->width() - FIGURE_DISTANCE - 1,
00492                     rect->y() + rect->height() - FIGURE_DISTANCE - 2);
00493 }
00494 
00495 void Draw::drawTransRectangle(Window window, GC gc,
00496                           Rectangle *rect, unsigned int barHeight,
00497                           unsigned int borderWidth)
00498 {
00499     XCORE->drawRectangle(window, gc,
00500                    rect->x(), rect->y(),
00501                    rect->width(), rect->height());
00502 
00503     unsigned int offsetY = borderWidth;
00504     if (barHeight > 0) {
00505         XCORE->drawLine(window, gc,
00506                   rect->x() + borderWidth / 2,
00507                   rect->y() + barHeight +
00508                       borderWidth,
00509                   rect->x() + rect->width() -
00510                       borderWidth / 2,
00511                   rect->y() + barHeight +
00512                       borderWidth);
00513         offsetY += barHeight + borderWidth;
00514     }
00515 #if DIAMOND_BOX
00516     XPoint orthRectPoints[3];
00517 
00518     orthRectPoints[0].x = rect->x() + rect->width() / 3;
00519     orthRectPoints[0].y = rect->y() + rect->height() - borderWidth;
00520     orthRectPoints[1].x = rect->x() + borderWidth;
00521     orthRectPoints[1].y = rect->y() + rect->height() / 2 + offsetY / 2;
00522     orthRectPoints[2].x = orthRectPoints[0].x;
00523     orthRectPoints[2].y = rect->y() + offsetY;
00524     XCORE->drawLines(window, gc, orthRectPoints, 3);
00525 
00526     orthRectPoints[0].x = rect->x() + (2 * rect->width()) / 3;
00527     orthRectPoints[0].y = rect->y() + offsetY;
00528     orthRectPoints[1].x = rect->x() + rect->width() - borderWidth;
00529     // same as above
00530     //orthRectPoints[1].y = rect->y() + rect->height() / 2 + offsetY / 2;
00531     orthRectPoints[2].x = orthRectPoints[0].x;
00532     orthRectPoints[2].y = rect->y() + rect->height() - borderWidth;
00533     XCORE->drawLines(window, gc, orthRectPoints, 3);
00534 #endif
00535 }

Generated on Thu May 24 15:19:31 2007 for ncwm by  doxygen 1.5.1