本文整理汇总了C++中PlatformWindow类的典型用法代码示例。如果您正苦于以下问题:C++ PlatformWindow类的具体用法?C++ PlatformWindow怎么用?C++ PlatformWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlatformWindow类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRoot
void EditTSCtrl::onMiddleMouseDown(const GuiEvent & event)
{
mMiddleMouseDown = true;
mMiddleMouseTriggered = false;
mLastBorderMoveTime = 0;
if(!mLeftMouseDown && !mRightMouseDown && mMiddleMousePassThru && mProfile->mCanKeyFocus)
{
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return;
// ok, gotta disable the mouse
// script functions are lockMouse(true); Canvas.cursorOff();
pWindow->setMouseLocked(true);
pCanvas->setCursorON( false );
// Trigger 2 is used by the camera
MoveManager::mTriggerCount[2]++;
mMiddleMouseTriggered = true;
setFirstResponder();
}
}
示例2: getRoot
void GuiDecalEditorCtrl::get3DCursor( GuiCursor *&cursor,
bool &visible,
const Gui3DMouseEvent &event_ )
{
cursor = NULL;
visible = false;
GuiCanvas *root = getRoot();
if ( !root )
return;
S32 currCursor = PlatformCursorController::curArrow;
if ( root->mCursorChanged == currCursor )
return;
PlatformWindow *window = root->getPlatformWindow();
PlatformCursorController *controller = window->getCursorController();
// We've already changed the cursor,
// so set it back before we change it again.
if( root->mCursorChanged != -1)
controller->popCursor();
// Now change the cursor shape
controller->pushCursor(currCursor);
root->mCursorChanged = currCursor;
}
示例3: attachToCanvas
void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos)
{
if(owner == NULL || isAttachedToCanvas())
return;
// This is set for popup menus in the onAttachToMenuBar() callback
mCanvas = owner;
PlatformWindow* pWindow = owner->getPlatformWindow();
if(pWindow == NULL)
return;
// Setup the native menu bar
GuiMenuBar *hWindowMenu = static_cast<GuiMenuBar*>( pWindow->getPortableMenuHandle() );
if( hWindowMenu == NULL && !Journal::IsPlaying() )
hWindowMenu = _FindMenuBarCtrl();
if(hWindowMenu)
{
pWindow->setPortableMenuHandle( hWindowMenu );
GuiControl *base = hWindowMenu->getParent();
while( base->getParent() )
{
base = base->getParent();
}
mCanvas->setMenuBar( base );
}
}
示例4: getWin32WindowHandle
HWND getWin32WindowHandle()
{
PlatformWindow* window = WindowManager->getFocusedWindow();
if( !window )
{
window = WindowManager->getFirstWindow();
if( !window )
return NULL;
}
return (HWND)window->getSystemWindow( PlatformWindow::WindowSystem_Windows );
}
示例5: getRoot
void ForestEditorCtrl::onSleep()
{
// Pop our default cursor off.
GuiCanvas *root = getRoot();
if ( root )
{
PlatformWindow *window = root->getPlatformWindow();
PlatformCursorController *controller = window->getCursorController();
controller->popCursor();
}
Parent::onSleep();
}
示例6: getRoot
void GuiSplitContainer::getCursor( GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent )
{
GuiCanvas *rootCtrl = getRoot();
if ( !rootCtrl )
return;
S32 desiredCursor = 0;
RectI splitRect = getSplitRect();
// Figure out which cursor we want if we need one
if ( mOrientation == Horizontal )
desiredCursor = PlatformCursorController::curResizeHorz;
else if ( mOrientation == Vertical )
desiredCursor = PlatformCursorController::curResizeVert;
PlatformWindow *platformWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
AssertFatal( platformWindow != NULL,"GuiControl without owning platform window! This should not be possible." );
PlatformCursorController *cusrorController = platformWindow->getCursorController();
AssertFatal( cusrorController != NULL,"PlatformWindow without an owned CursorController!" );
// Check to see if we need one or just the default...
Point2I localPoint = Point2I( globalToLocalCoord( lastGuiEvent.mousePoint ) );
if ( splitRect.pointInRect( localPoint ) || mDragging )
{
// Do we need to change it or is it already set?
if ( rootCtrl->mCursorChanged != desiredCursor )
{
// We've already changed the cursor, so set it back
if ( rootCtrl->mCursorChanged != -1 )
cusrorController->popCursor();
// Now change the cursor shape
cusrorController->pushCursor( desiredCursor );
rootCtrl->mCursorChanged = desiredCursor;
}
}
else if ( rootCtrl->mCursorChanged != -1 )
{
// Just the default
cusrorController->popCursor();
rootCtrl->mCursorChanged = -1;
}
}
示例7: messageBox
S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons, MBIcons icon)
{
PlatformWindow *pWindow = WindowManager->getFirstWindow();
// Get us rendering while we're blocking.
winState.renderThreadBlocked = true;
// We don't keep a locked mouse or else we're going
// to end up possibly locking our mouse out of the
// message box area
bool cursorLocked = pWindow && pWindow->isMouseLocked();
if( cursorLocked )
pWindow->setMouseLocked( false );
// Need a visible cursor to click stuff accurately
bool cursorVisible = !pWindow || pWindow->isCursorVisible();
if( !cursorVisible )
pWindow->setCursorVisible(true);
#ifdef UNICODE
const UTF16 *msg = createUTF16string(message);
const UTF16 *t = createUTF16string(title);
#else
const UTF8 *msg = message;
const UTF8 *t = title;
#endif
HWND parent = pWindow ? static_cast<Win32Window*>(pWindow)->getHWND() : NULL;
S32 ret = ::MessageBox( parent, msg, t, getMaskFromID(sgButtonMap, buttons) | getMaskFromID(sgIconMap, icon));
#ifdef UNICODE
delete [] msg;
delete [] t;
#endif
// Dialog is gone.
winState.renderThreadBlocked = false;
if( cursorVisible == false )
pWindow->setCursorVisible( false );
if( cursorLocked == true )
pWindow->setMouseLocked( true );
return getMaskFromID(sgMsgBoxRetMap, ret);
}
示例8: pasteWithCtrlV
bool pasteWithCtrlV(PlatformWindow &window)
{
const QRegExp re( QSettings().value(optionName).toString() );
if (re.isEmpty())
return false;
if (!re.isValid()) {
log(QString("Invalid regular expression in option \"%1\": %2")
.arg(optionName, re.errorString()), LogWarning);
return false;
}
const QString windowTitle = window.getTitle();
if (re.indexIn(windowTitle) == -1) {
COPYQ_LOG(QString("Paste with standard shortcut to window \"%1\".")
.arg(windowTitle));
return false;
}
COPYQ_LOG(QString("Paste with Ctrl+V requested with option \"%1\" for window \"%2\".")
.arg(optionName, windowTitle));
return true;
}
示例9: make3DMouseEvent
void EditTSCtrl::onRightMouseDown(const GuiEvent & event)
{
// always process the right mouse event first...
mRightMouseDown = true;
mLastBorderMoveTime = 0;
make3DMouseEvent(mLastEvent, event);
on3DRightMouseDown(mLastEvent);
if(!mLeftMouseDown && mRightMousePassThru && mProfile->mCanKeyFocus)
{
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return;
// ok, gotta disable the mouse
// script functions are lockMouse(true); Canvas.cursorOff();
pWindow->setMouseLocked(true);
pCanvas->setCursorON( false );
if(mDisplayType != DisplayTypePerspective)
{
mouseLock();
mLastMousePos = event.mousePoint;
pCanvas->setForceMouseToGUI(true);
mLastMouseClamping = pCanvas->getClampTorqueCursor();
pCanvas->setClampTorqueCursor(false);
}
if(mDisplayType == DisplayTypeIsometric)
{
// Store the screen center point on the terrain for a possible rotation
TerrainBlock* activeTerrain = getActiveTerrain();
if( activeTerrain )
{
F32 extx, exty;
if(event.modifier & SI_SHIFT)
{
extx = F32(event.mousePoint.x);
exty = F32(event.mousePoint.y);
}
else
{
extx = getExtent().x * 0.5;
exty = getExtent().y * 0.5;
}
Point3F sp(extx, exty, 0.0f); // Near plane projection
Point3F start;
unproject(sp, &start);
Point3F end = start + mLastEvent.vec * 4000.0f;
Point3F tStartPnt, tEndPnt;
activeTerrain->getTransform().mulP(start, &tStartPnt);
activeTerrain->getTransform().mulP(end, &tEndPnt);
RayInfo info;
bool result = activeTerrain->castRay(tStartPnt, tEndPnt, &info);
if(result)
{
info.point.interpolate(start, end, info.t);
mIsoCamRotCenter = info.point;
}
else
{
mIsoCamRotCenter = start;
}
}
else
{
F32 extx = getExtent().x * 0.5;
F32 exty = getExtent().y * 0.5;
Point3F sp(extx, exty, 0.0f); // Near plane projection
unproject(sp, &mIsoCamRotCenter);
}
}
setFirstResponder();
}
}
示例10: main
//The following is the entry point for the command-line version
int main(int argc, char **argv)
{
//This sets the video driver
setenv("SDL_VIDEODRIVER", "dga",1);
setenv("SDL_VIDEODRIVER", "x11",1);
//Make a few new colors.
cout << "Creating new colors\n";
PColor red = PColor("red");
PColor grey = PColor("grey");
grey.SetAlpha(150);
PlatformEnvironment * myEnv = new PlatformEnvironment();
myEnv->Initialize();
PlatformWindow * myWindow = new PlatformWindow();
myWindow->Initialize();
myWindow->SetBackgroundColor(grey);
PKeyboard * myKeyboard = new PlatformKeyboard();
//Add window to environment.
myEnv->AddWindow(myWindow);
//Now make an Image Widget.
PlatformImageBox * myImage1 = new PlatformImageBox;
if(!myImage1->LoadImage("media/images/pebl.bmp"))
cout << "Loading image1 failed\n" ;
//Make another image, just for kicks.
PlatformImageBox * myImage2 = new PlatformImageBox;
if(!myImage2->LoadImage("media/images/pebl.png"))
cout << "Loading image2 failed\n" ;
//Make a font.
cout << "Creating a font\n";
PlatformFont * myFont1 = new PlatformFont("media/fonts/VeraSe.ttf", PFS_Normal, 22, red, grey, true );
PlatformFont * myFont2 = new PlatformFont("media/fonts/VeraSe.ttf", PFS_Normal, 22, red, grey, false );
cout << "Creating PlatformWord object\n";
//Now, make a 'word object.
PlatformWord * myWord1 = new PlatformWord("Hello World: anti-aliased", myFont1);
myWord1->SetPosition(30,30);
PlatformWord * myWord2 = new PlatformWord("Hello World:aliased", myFont2);
myWord2->SetPosition(30,50);
myWindow->AddSubWidget(myImage1);
myWindow->AddSubWidget(myImage2);
myWindow->AddSubWidget(myWord1);
myWindow->AddSubWidget(myWord2);
myEnv->Draw();
myKeyboard->WaitForAnyKeyDown();
myKeyboard->WaitForAllKeysUp();
myImage1->SetPosition(10,10);
myImage2->SetPosition(10,200);
myEnv->Draw();
myKeyboard->WaitForAnyKeyDown();
myKeyboard->WaitForAllKeysUp();
myImage1->SetPosition(100,20);
myImage2->SetPosition(100,300);
myEnv->Draw();
myKeyboard->WaitForAllKeysUp();
myKeyboard->WaitForAnyKeyDown();
myImage1->SetPosition(200,200);
myImage2->SetPosition(200,400);
myEnv->Draw();
myKeyboard->WaitForAllKeysUp();
myKeyboard->WaitForAnyKeyDown();
for(int i= 0; i<500;i+=10){
myImage1->SetPosition(i,400);
myEnv->Draw();
}
myKeyboard->WaitForAllKeysUp();
//.........这里部分代码省略.........
示例11: setWindowLocked
void Platform::setWindowLocked(bool locked)
{
PlatformWindow* window = WindowManager->getFirstWindow();
if( window )
window->setMouseLocked( locked );
}