#include <CSDesktop.h>
Inheritance diagram for CSDesktop:
Public Member Functions | |
virtual std::string | getType () |
CSDesktop () | |
CSDesktop (SDL_Rect area) | |
~CSDesktop () | |
virtual void | paint (SDL_Surface *destination, SDL_Rect *parentViewport) |
void | setFocusedComponent (CSGrafikElement *element) |
CSGrafikElement * | getFocusedComponent () |
void | focusedNextComponent () |
void | addElementNorth (CSGrafikElement *element) |
void | addElementSouth (CSGrafikElement *element) |
void | addElementEast (CSGrafikElement *element) |
void | addElementWest (CSGrafikElement *element) |
virtual void | layoutSetup () |
void | correctElementHandling (CSGrafikElement *element) |
Static Public Attributes | |
const char * | CLASS = "CSDesktop" |
static element, name of this class (introsepection) | |
Protected Member Functions | |
void | layoutSetupDesktop () |
|
Definition at line 21 of file CSDesktop.cpp. References CSGrafikElement::addElement(), CSGrafikElement::addMainElement(), SDLMain::getScreenHeight(), SDLMain::getScreenWidth(), CSGrafikElement::init(), LOG_ENTER, LOG_EXIT, POSITION_CENTER, POSITION_EAST, POSITION_NORTH, POSITION_ORDER_TOP, POSITION_SOUTH, POSITION_WEST, CSGrafikElement::setLayoutData(), CSGrafikElement::setLayoutManager(), CSGrafikElement::setMainElement(), CSGrafikElement::setMainLayoutManager(), CSLayoutData::setPackedHorizontal(), CSLayoutData::setPackedVertical(), CSLayoutData::setPosition(), CSLayoutData::setStretchedHorizontal(), and CSLayoutData::setStretchedVertical().
00021 : CSGrafikElement(0, 0) 00022 { 00023 static char *functionName="CSDesktop"; 00024 LOG_ENTER 00025 mHeight = SDLMain::getScreenHeight(); 00026 mWidth = SDLMain::getScreenWidth(); 00027 mScreenArea.x = 0; 00028 mScreenArea.y = 0; 00029 mScreenArea.h = mHeight; 00030 mScreenArea.w = mWidth; 00031 mFocusedComponent = 0; 00032 mCurrentUnderMouseComponent = 0; 00033 mStartDown = 0; 00034 init(mHeight, mWidth); 00035 00036 mNorth = 0; 00037 mWest = 0; 00038 mSouth = 0; 00039 mEast = 0; 00040 mCenter = 0; 00041 setMainLayoutManager(new CSLayoutManagerBorder()); 00042 00043 mNorth = new CSPanel(); 00044 mNorth->setLayoutManager(new CSLayoutManagerStackVertical()); 00045 mWest = new CSPanel(); 00046 mWest->setLayoutManager(new CSLayoutManagerStackHorizontal()); 00047 mSouth = new CSPanel(); 00048 mSouth->setLayoutManager(new CSLayoutManagerStackVertical()); 00049 mEast = new CSPanel(); 00050 mEast->setLayoutManager(new CSLayoutManagerStackHorizontal()); 00051 mCenter = new CSPanel(); 00052 00053 CSLayoutData layout = CSLayoutData(POSITION_NORTH); 00054 layout.setStretchedHorizontal(true); 00055 layout.setPackedVertical(true); 00056 mNorth->setLayoutData(layout); 00057 addMainElement(mNorth); 00058 00059 layout.setPosition(POSITION_SOUTH); 00060 mSouth->setLayoutData(layout); 00061 addMainElement(mSouth); 00062 00063 layout.setPosition(POSITION_CENTER); 00064 layout.setStretchedVertical(true); 00065 mCenter->setLayoutData(layout); 00066 addMainElement(mCenter); 00067 setMainElement(mCenter); 00068 00069 layout.setPackedHorizontal(true); 00070 layout.setPosition(POSITION_WEST); 00071 mWest->setLayoutData(layout); 00072 addMainElement(mWest); 00073 00074 layout.setPosition(POSITION_EAST); 00075 mEast->setLayoutData(layout); 00076 addMainElement(mEast); 00077 00078 mLastTimePainted = -1; 00079 mLastCursorX = -1; 00080 mLastCursorY = -1; 00081 mModalComponent = 0; 00082 mTooltipPanel = new CSPanel(0, 0); 00083 mTooltipPanel->setLayoutManager(new CSLayoutManagerStackVertical()); 00084 layout = CSLayoutData(0,0); 00085 layout.setPackedVertical(true); 00086 layout.setPackedHorizontal(true); 00087 mTooltipPanel->setLayoutData(layout); 00088 mTooltipLabel = new CSLabel(""); 00089 mTooltipLabel->setLayoutData(CSLayoutData(POSITION_ORDER_TOP)); 00090 mTooltipPanel->addElement(mTooltipLabel); 00091 addMainElement(mTooltipPanel); 00092 LOG_EXIT 00093 } |
Here is the call graph for this function:
|
Definition at line 95 of file CSDesktop.cpp. References LOG_ENTER, and LOG_EXIT.
00095 : CSGrafikElement(area.h, area.w) 00096 { 00097 static char *functionName="CSDesktop"; 00098 LOG_ENTER 00099 mX = area.x; 00100 mY = area.y; 00101 mViewportX = area.x; 00102 mViewportY = area.y; 00103 00104 mFocusedComponent = 0; 00105 mCurrentUnderMouseComponent = 0; 00106 mStartDown = 0; 00107 LOG_EXIT 00108 } |
|
Definition at line 110 of file CSDesktop.cpp. References LOG_ENTER, and LOG_EXIT.
|
|
Definition at line 642 of file CSDesktop.cpp. References LOG_ENTER, and LOG_EXIT. Referenced by layoutSetup().
|
|
Reimplemented from CSGrafikElement. Definition at line 64 of file CSDesktop.h. References CLASS.
00064 {return (std::string) CLASS;} |
|
Reimplemented from CSGrafikElement. Definition at line 134 of file CSDesktop.cpp. References CSGrafikElement::doLayout(), CSLAF::getCurrentLAF(), CSGrafikElement::getCursor(), CSGrafikElement::getFont(), CSGrafikElement::getType(), CSMouseCursor::paint(), CSGrafikElement::paintChildren(), CSFont::putString(), CSMouseCursor::setPosition(), CSFont::setSolid(), CSGrafikElement::setVisible(), and CSLAF::tooltipThreshold. Referenced by CSGame::run().
00135 { 00136 static char *functionName="paint"; 00137 CSLAF *laf = CSLAF::getCurrentLAF(); 00138 long mCurrentTime = SDL_GetTicks(); 00139 doLayout(); 00140 00141 if (getFont()) 00142 { 00143 getFont()->setSolid(true); 00144 std::string type=""; 00145 if (mFocusedComponent) 00146 { 00147 type = mFocusedComponent->getType().c_str(); 00148 } 00149 char str[100]; 00150 sprintf(str, "%s ",type.c_str()); 00151 getFont()->putString(SDLMain::getScreen(), 0, 320, str); 00152 } 00153 00154 00155 if ((mLastCursorX == mCursorX) && (mLastCursorY == mCursorY)) 00156 { 00157 long t = mCurrentTime - mLastTimePainted; 00158 if (t >= laf->tooltipThreshold) 00159 { 00160 showToolTip(); 00161 } 00162 } 00163 else 00164 { 00165 mTooltipPanel->setVisible(false); 00166 mLastTimePainted = mCurrentTime; 00167 } 00168 mLastCursorX = mCursorX; 00169 mLastCursorY = mCursorY; 00170 00171 SDL_Rect thisArea = mElementArea; 00172 if (parentViewport) 00173 { 00174 thisArea.x += parentViewport->x; 00175 thisArea.y += parentViewport->y; 00176 } 00177 00178 SDL_Rect thisAreaCopy = thisArea; 00179 00180 SDL_SetClipRect(destination, &thisAreaCopy); 00181 if (parentViewport) 00182 { 00183 paintChildren(destination, parentViewport); 00184 } 00185 else 00186 { 00187 paintChildren(destination, &mScreenArea); 00188 } 00189 00190 int receiverX, receiverY; 00191 CSGrafikElement *receiver = getElement(mCursorX, mCursorY, &mScreenArea, receiverX, receiverY); 00192 if (receiver) 00193 { 00194 receiver->getCursor()->setPosition(mCursorX, mCursorY); 00195 receiver->getCursor()->paint(destination, &thisArea); 00196 } 00197 else 00198 { 00199 getCursor()->setPosition(mCursorX, mCursorY); 00200 getCursor()->paint(destination, &thisArea); 00201 } 00202 SDL_SetClipRect(destination, 0); 00203 } |
Here is the call graph for this function:
|
Definition at line 388 of file CSDesktop.cpp. References CSGrafikElement::getFocusable(), CSGrafikElement::getParent(), LOG_ENTER, LOG_EXIT, CSMessage::mIsHandled, GuiMessage::receiver, GuiMessage::screenX, GuiMessage::screenY, GuiMessage::sender, CSMessageDispatchable::sendMessage(), and CSGrafikElement::setFocused(). Referenced by focusedNextComponent(), CSMenu::openMenu(), CSCombobox::reactOnMessageCombobox(), and CSMenuItem::reactOnMessageMenuItem().
00389 { 00390 static char *functionName="setFocusedComponent"; 00391 LOG_ENTER 00392 if (mFocusedComponent == element) 00393 { 00394 return; 00395 } 00396 if (mFocusedComponent) 00397 { 00398 MESSAGE_FOCUS_LOST.screenX = 0; 00399 MESSAGE_FOCUS_LOST.screenY = 0; 00400 MESSAGE_FOCUS_LOST.sender = this; 00401 MESSAGE_FOCUS_LOST.mIsHandled = false; 00402 MESSAGE_FOCUS_LOST.receiver = mFocusedComponent; 00403 mFocusedComponent->setFocused(false); 00404 00405 CSGrafikElement *component = mFocusedComponent; 00406 while ((!MESSAGE_FOCUS_LOST.mIsHandled) && (component != 0)) 00407 { 00408 component->sendMessage(MESSAGE_FOCUS_LOST); 00409 component = component->getParent(); 00410 } 00411 } 00412 00413 if (element) 00414 { 00415 if (element->getFocusable()) 00416 { 00417 MESSAGE_FOCUS_GAINED.screenX = 0; 00418 MESSAGE_FOCUS_GAINED.screenY = 0; 00419 MESSAGE_FOCUS_GAINED.sender = this; 00420 MESSAGE_FOCUS_GAINED.mIsHandled = false; 00421 MESSAGE_FOCUS_GAINED.receiver = element; 00422 mFocusedComponent = element; 00423 mFocusedComponent->setFocused(true); 00424 mFocusedComponent->sendMessage(MESSAGE_FOCUS_GAINED); 00425 } 00426 else 00427 { 00428 mFocusedComponent = 0; 00429 } 00430 } 00431 else 00432 { 00433 mFocusedComponent = element; 00434 } 00435 LOG_EXIT 00436 } |
Here is the call graph for this function:
|
Definition at line 70 of file CSDesktop.h.
00070 {return mFocusedComponent;}
|
|
Definition at line 438 of file CSDesktop.cpp. References LOG_ENTER, LOG_EXIT, and setFocusedComponent(). Referenced by CSCombobox::reactOnMessageCombobox(), CSTextarea::reactOnMessageTextarea(), and CSTextfield::reactOnMessageTextField().
00439 { 00440 static char *functionName="focusedNextComponent"; 00441 LOG_ENTER 00442 if (mFocusedComponent == 0) 00443 { 00444 LOG_EXIT 00445 return; 00446 } 00447 CSGrafikElement *component = 0; 00448 // todo seek next component 00449 setFocusedComponent(component); 00450 LOG_EXIT 00451 } |
Here is the call graph for this function:
|
Definition at line 205 of file CSDesktop.cpp. References CSGrafikElement::addElement().
00206 { 00207 mNorth->addElement(element); 00208 } |
Here is the call graph for this function:
|
Definition at line 210 of file CSDesktop.cpp. References CSGrafikElement::addElement().
00211 { 00212 mSouth->addElement(element); 00213 } |
Here is the call graph for this function:
|
Definition at line 215 of file CSDesktop.cpp. References CSGrafikElement::addElement().
00216 { 00217 mEast->addElement(element); 00218 } |
Here is the call graph for this function:
|
Definition at line 220 of file CSDesktop.cpp. References CSGrafikElement::addElement().
00221 { 00222 mWest->addElement(element); 00223 } |
Here is the call graph for this function:
|
Reimplemented from CSGrafikElement. Definition at line 76 of file CSDesktop.h. References layoutSetupDesktop().
00076 {layoutSetupDesktop();} |
Here is the call graph for this function:
|
Definition at line 649 of file CSDesktop.cpp. Referenced by CSGrafikElement::removeMainElement().
00650 { 00651 if (mFocusedComponent == element) 00652 { 00653 mFocusedComponent = 0; 00654 } 00655 if (mStartDown == element) 00656 { 00657 mStartDown = 0; 00658 } 00659 if (mCurrentUnderMouseComponent == element) 00660 { 00661 mCurrentUnderMouseComponent = 0; 00662 } 00663 if (mModalComponent == element) 00664 { 00665 mModalComponent = 0; 00666 } 00667 } |
|
static element, name of this class (introsepection)
Reimplemented from CSGrafikElement. Definition at line 19 of file CSDesktop.cpp. Referenced by getType(). |