Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSRoundedBorder Class Reference

#include <CSBorder.h>

Inheritance diagram for CSRoundedBorder:

CSBorder

Public Member Functions

virtual std::string getType ()
virtual ~CSRoundedBorder ()
virtual void paint (SDL_Surface *destination, SDL_Rect *parentViewport)
virtual void setCorner (int corner)

Static Public Member Functions

CSRoundedBordergetBorder (int type)

Static Public Attributes

const char * CLASS = "CSRoundedBorder"

Protected Member Functions

 CSRoundedBorder ()

Protected Attributes

int mCorner

Constructor & Destructor Documentation

CSRoundedBorder::CSRoundedBorder  )  [inline, protected]
 

Definition at line 70 of file CSBorder.h.

Referenced by getBorder().

00071         {
00072             mCorner = 0;
00073         }

virtual CSRoundedBorder::~CSRoundedBorder  )  [inline, virtual]
 

Definition at line 78 of file CSBorder.h.

00078 {}


Member Function Documentation

virtual std::string CSRoundedBorder::getType  )  [inline, virtual]
 

Reimplemented from CSBorder.

Definition at line 77 of file CSBorder.h.

References CLASS.

00077 {return (std::string) CLASS;}

CSRoundedBorder * CSRoundedBorder::getBorder int  type  )  [static]
 

Reimplemented from CSBorder.

Definition at line 564 of file CSBorder.cpp.

References BORDER_TYPE_NONE, CSRoundedBorder(), CSBorder::mBorderInnerEdgeWidth, CSBorder::mBorderInterEdgeWidth, CSBorder::mBorderOuterEdgeWidth, and CSBorder::mType.

Referenced by CSLAF::getBorderInternal().

00565 {
00566     CSRoundedBorder *border = new CSRoundedBorder(); 
00567     border->mType = type;
00568     if (border->mType == BORDER_TYPE_NONE)
00569     {
00570         border->mBorderOuterEdgeWidth = 0;
00571         border->mBorderInnerEdgeWidth = 0;
00572         border->mBorderInterEdgeWidth = 0;
00573     }
00574     else
00575     {
00576         border->mBorderOuterEdgeWidth = 1;
00577         border->mBorderInnerEdgeWidth = 1;
00578         border->mBorderInterEdgeWidth = 2;
00579     }
00580     return border;
00581 }

Here is the call graph for this function:

void CSRoundedBorder::paint SDL_Surface *  destination,
SDL_Rect *  parentViewport
[virtual]
 

Reimplemented from CSBorder.

Definition at line 382 of file CSBorder.cpp.

References BORDER_STATE_HOVERING, BORDER_STATE_PRESSED, BORDER_STATE_VISIBLE, BORDER_TYPE_DOUBLE, BORDER_TYPE_HOVER, BORDER_TYPE_INTER, BORDER_TYPE_NONE, BORDER_TYPE_SINGLE_COLOR, BORDER_TYPE_UP, COLOR, CSHelper::colorPercent(), SDLMain::DrawRoundRectEast(), SDLMain::DrawRoundRectNorth(), SDLMain::DrawRoundRectSouth(), SDLMain::DrawRoundRectWest(), CSLAF::getBorderDefaultBrightestColor(), and CSLAF::getCurrentLAF().

00383 {
00384     static char *functionName="paint";
00385     CSLAF *laf = CSLAF::getCurrentLAF(); 
00386     int type = mType;
00387     if ((!(mState & BORDER_STATE_VISIBLE)) || (type == BORDER_TYPE_NONE))
00388     {
00389         return;
00390     }
00391 
00392     mShadeBrighter = CSHelper::colorPercent(laf->getBorderDefaultBrightestColor(), 100);
00393     mShadeBright = CSHelper::colorPercent(laf->getBorderDefaultBrightestColor(), 70);
00394     mShadeDark = CSHelper::colorPercent(laf->getBorderDefaultBrightestColor(), 50);
00395     mShadeDarker = CSHelper::colorPercent(laf->getBorderDefaultBrightestColor(), 20);
00396 
00397     // if type up
00398     if (type & BORDER_TYPE_UP)
00399     {
00400         // and pressed
00401         if (mState & BORDER_STATE_PRESSED)
00402         {
00403             // draw pressed border
00404             type = type & (~BORDER_TYPE_UP);
00405         }
00406         else
00407         {
00408             // if hovering enabled 
00409             if (mState & BORDER_STATE_HOVERING)
00410             {
00411                 // and hovering happens
00412                 if (type & BORDER_TYPE_HOVER)
00413                 {
00414                     // draw on hovering Type up
00415                     type = type | BORDER_TYPE_UP;
00416                 }
00417                 else
00418                 {
00419                     // if overing enabeld and not hovering, draw nothing
00420                     return;
00421                     //type = type & (~BORDER_TYPE_UP);
00422                 }
00423             }
00424             else // if hovering disabled
00425             {
00426                 // and not pressed, than draw border up on pressed
00427                 type = type | BORDER_TYPE_UP;
00428             }
00429         }
00430     }
00431     else
00432     {
00433     }
00434 
00435 
00436     SDL_Rect copy;
00437     int o = 0;
00438     if (type & BORDER_TYPE_UP)
00439     {
00440         if (mBorderOuterEdgeWidth)
00441         {
00442             SDL_Rect a = *area;
00443             a.x += o;
00444             a.y += o;
00445             a.h = area->h;//mBorderOuterEdgeWidth;
00446             a.w = a.w - 2*o;
00447             if (a.w > 60000) a.w = 0;
00448             copy = a;
00449             if (mType & BORDER_TYPE_SINGLE_COLOR)
00450             {
00451                 SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00452                 SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00453                 SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00454                 SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00455             }
00456             else
00457             {
00458                 SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBrighter), mCorner, mBorderOuterEdgeWidth);
00459                 SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00460                 SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00461                 SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBrighter), mCorner, mBorderOuterEdgeWidth);
00462             }
00463         }   
00464         o+=mBorderOuterEdgeWidth;
00465         if (type & BORDER_TYPE_DOUBLE)
00466         {
00467             if (mBorderInnerEdgeWidth)
00468             {
00469                 SDL_Rect a = *area;
00470                 a.x += o;
00471                 a.y += o;
00472                 a.h = a.h - 2*o;
00473                 a.w = a.w - 2*o;
00474                 if (a.w > 60000) a.w = 0;
00475                 copy = a;
00476                 if (mType & BORDER_TYPE_SINGLE_COLOR)
00477                 {
00478                     SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00479                     SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00480                     SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00481                     SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00482                 }
00483                 else
00484                 {
00485                     SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBright), mCorner, mBorderInnerEdgeWidth);
00486                     SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00487                     SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderInnerEdgeWidth);
00488                     SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBright), mCorner, mBorderInnerEdgeWidth);
00489                 }
00490             }   
00491         }
00492 
00493         o+=mBorderInnerEdgeWidth;
00494         if (type & BORDER_TYPE_INTER)
00495         {
00496             SDL_Rect a = *area;
00497             a.x += o + mBorderInterEdgeWidth;
00498             a.y += o + mBorderInterEdgeWidth;
00499             a.w = a.w - 2*o - (2*mBorderInterEdgeWidth);
00500             a.h = a.h - 2*o - (2*mBorderInterEdgeWidth);
00501             if (a.w > 60000) a.w = 0;
00502             if (a.h > 60000) a.h = 0;
00503             
00504             int typeSave = type;
00505             type = type - BORDER_TYPE_INTER - BORDER_TYPE_UP;
00506             paint(destination, &a);
00507             type = typeSave;
00508         }
00509     }   
00510     else // down
00511     {
00512         if (mBorderOuterEdgeWidth)
00513         {
00514             SDL_Rect a = *area;
00515             a.x += o;
00516             a.y += o;
00517             a.h = area->h;//mBorderOuterEdgeWidth;
00518             a.w = a.w - 2*o;
00519             if (a.w > 60000) a.w = 0;
00520             copy = a;
00521             SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00522             SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBrighter), mCorner, mBorderOuterEdgeWidth);
00523             SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBrighter), mCorner, mBorderOuterEdgeWidth);
00524             SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDarker), mCorner, mBorderOuterEdgeWidth);
00525         }   
00526         o+=mBorderOuterEdgeWidth;
00527         if (type & BORDER_TYPE_DOUBLE)
00528         {
00529             if (mBorderInnerEdgeWidth)
00530             {
00531                 SDL_Rect a = *area;
00532                 a.x += o;
00533                 a.y += o;
00534                 a.h = a.h - 2*o;
00535                 a.w = a.w - 2*o;
00536                 if (a.w > 60000) a.w = 0;
00537                 copy = a;
00538                 SDLMain::DrawRoundRectNorth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderOuterEdgeWidth);
00539                 SDLMain::DrawRoundRectSouth(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBright), mCorner, mBorderOuterEdgeWidth);
00540                 SDLMain::DrawRoundRectWest(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeBright), mCorner, mBorderOuterEdgeWidth);
00541                 SDLMain::DrawRoundRectEast(destination, copy.x, copy.y, copy.w, copy.h, COLOR(destination, mShadeDark), mCorner, mBorderOuterEdgeWidth);
00542             }
00543         }
00544         if (type & BORDER_TYPE_INTER)
00545         {
00546             SDL_Rect a = *area;
00547             a.x += o + mBorderInterEdgeWidth;
00548             a.y += o + mBorderInterEdgeWidth;
00549             a.w = a.w - 2*o - (2*mBorderInterEdgeWidth);
00550             a.h = a.h - 2*o - (2*mBorderInterEdgeWidth);
00551             if (a.w > 60000) a.w = 0;
00552             if (a.h > 60000) a.h = 0;
00553 
00554             int typeSave = type;
00555             type = type - BORDER_TYPE_INTER - BORDER_TYPE_UP;
00556             paint(destination, &a);
00557             type = typeSave;
00558         }
00559         o+=mBorderInnerEdgeWidth;
00560     }
00561 }

Here is the call graph for this function:

virtual void CSRoundedBorder::setCorner int  corner  )  [inline, virtual]
 

Definition at line 81 of file CSBorder.h.

Referenced by CSLAF::getBorderInternal().

00081 {mCorner = corner;}


Field Documentation

int CSRoundedBorder::mCorner [protected]
 

Definition at line 69 of file CSBorder.h.

const char * CSRoundedBorder::CLASS = "CSRoundedBorder" [static]
 

Reimplemented from CSBorder.

Definition at line 11 of file CSBorder.cpp.

Referenced by getType().


Generated on Wed Jul 14 00:45:00 2004 for CSLib by doxygen 1.3.6