本文整理汇总了C++中LWindow类的典型用法代码示例。如果您正苦于以下问题:C++ LWindow类的具体用法?C++ LWindow怎么用?C++ LWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ValidateObject_
Boolean
UPropertyInspector::SelectInspectorWindow(
DMElement* inElement)
{
// Validate pointers.
ValidateObject_(inElement);
// See if there's an inspector for this element.
PIInspectorTable* table = (PIInspectorTable*)
inElement->FindUserInterfaceObject(PIInspectorTable::object_ID);
if (table == nil)
return false;
// There's a table. Select its window.
LWindow* window = LWindow::FetchWindowObject(GetWindowFromPort(table->GetMacPort()));
ValidateObject_(window);
window->Select();
return true;
}
示例2: LWindow
//===============
// PUBLIC SLOTS
//===============
void LWindowManager::NewWindow(WId win, bool requested){
//Verify that this window can/should be managed first
//if(DEBUG){ qDebug() << "New Window:" << LWM::SYSTEM->WM_ICCCM_GetClass(win); }
QString wclass = LWM::SYSTEM->WM_ICCCM_GetClass(win);
if( wclass.contains("lumina-wm",Qt::CaseInsensitive) ){ return; } //just in case: prevent recursion
else{
bool ok = (wclass.isEmpty() ? false : LWM::SYSTEM->WM_ManageWindow(win, requested) );
if(!ok){
//See if this window is just a transient pointing to some other window
WId tran = LWM::SYSTEM->WM_ICCCM_GetTransientFor(win);
if(tran!=win && tran!=0){
win = tran;
ok = LWM::SYSTEM->WM_ManageWindow(win);
}
}
if(!ok){ return; }
}
if(DEBUG){ qDebug() << "New Managed Window:" << LWM::SYSTEM->WM_ICCCM_GetClass(win); }
LWindow *lwin = new LWindow(win);
connect(lwin, SIGNAL(Finished(WId)), this, SLOT(FinishedWindow(WId)) );
WINS << lwin;
if(lwin->hasFrame()){
lwin->frame()->windowChanged(LWM::Show); //Make sure to show it right away
}else{
LWM::SYSTEM->WM_ShowWindow(win); //just map the window right now
}
}
示例3: switch
void
PIInspectorTable::ListenToMessage(
MessageT inMessage,
void* ioParam)
{
switch (inMessage) {
// Grow zone: Property inspector is expendable, close it if low on memory.
case msg_GrowZone:
LWindow* window;
window = LWindow::FetchWindowObject(GetWindowFromPort(GetMacPort()));
ValidateObject_(window);
window->DoClose();
break;
// Detach PI button: Detach this inspector from the selection.
case 'DTCH':
DetachFromSelection();
break;
// Other messages: Pass along to table.
default:
OVTable::ListenToMessage(inMessage, ioParam);
}
}
示例4:
void
TutorialBuilderApp::OpenDocument(FSSpec* inMacFSSpec) {
short srcRefNum = ::FSpOpenResFile(inMacFSSpec, fsRdPerm);
LStr255 dstName = "Galactica Tutorial"; //inMacFSSpec->name;
// dstName += ".rsrc";
FSSpec dstSpec;
::FSMakeFSSpec(inMacFSSpec->vRefNum, inMacFSSpec->parID, dstName, &dstSpec);
::FSpCreateResFile(&dstSpec, 'TrŽ5', 'rsrc', 0);
short dstRefNum = ::FSpOpenResFile(&dstSpec, fsWrPerm);
::UseResFile(srcRefNum);
short ppobCount = ::Count1Resources('PPob');
mPrevPageHadButton = false;
for (int i = 1; i <= ppobCount; i++) {
Handle resH = ::Get1IndResource('PPob', i);
ResIDT theID;
ResType theType;
Str255 theResName;
::GetResInfo(resH, &theID, &theType, theResName);
if (theID > 0) { // wouldn't work with many negative numbers anyway
LWindow* wind = LWindow::CreateWindow(theID, this);
wind->SetDescriptor(theResName);
wind->Show();
wind->UpdatePort();
SavePageToResFile(wind, dstRefNum);
delete wind;
}
::ReleaseResource(resH);
}
::CloseResFile(srcRefNum);
::CloseResFile(dstRefNum);
}
示例5: ValidateThis_
void
PIInspectorTable::DetachFromSelection()
{
// Validate pointers.
ValidateThis_();
// Make sure we're currently inspecting an object.
// If not, the detach command is ignored.
if (mElement == nil)
return;
ValidateObject_(mElement.GetObject());
// Disable the detach button.
if (mDetachPIButton != nil) {
ValidateObject_(mDetachPIButton);
mDetachPIButton->Disable();
}
// Disconnect from selection.
mFollowSelection = nil;
mIsDetached = true;
// Retitle the window to match our object's title.
LWindow* window = LWindow::FetchWindowObject(GetWindowFromPort(GetMacPort()));
ValidateObject_(window);
LStr255 displayableName;
mElement->GetDisplayableName(displayableName);
if (displayableName.Length() > 0)
window->SetDescriptor(displayableName);
// Tell the property inspector manager that we're no longer following selection.
LWindow* myWindow = LWindow::FetchWindowObject(GetWindowFromPort(GetMacPort()));
ValidateObject_(myWindow);
UPropertyInspector::ClosingInspectorWindow(myWindow);
}
示例6: dialog
void
RESession::ShowCantOpenDialog()
{
// Show the can't open dialog.
StApplicationContext appContext;
StDialogHandler dialog(PPob_CantOpenResource, 0);
LWindow* window = dialog.GetDialog();
ValidateObject_(dialog.GetDialog());
window->Show();
// Wait until OK is hit.
MessageT message;
do {
message = dialog.DoDialog();
} while (message == msg_Nothing);
}
示例7: theHandler
Boolean CProfileManager::DoNewProfileDialog(char *outName, UInt32 bufSize)
{
Boolean confirmed;
StDialogHandler theHandler(dlog_NewProfile, LCommander::GetTopCommander());
LWindow *theDialog = theHandler.GetDialog();
ThrowIfNil_(theDialog);
LEditText *responseText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Name'));
ThrowIfNil_(responseText);
theDialog->SetLatentSub(responseText);
theDialog->Show();
theDialog->Select();
while (true) // This is our modal dialog event loop
{
MessageT hitMessage = theHandler.DoDialog();
if (hitMessage == msg_OK)
{
Str255 pStr;
UInt32 outLen;
responseText->GetDescriptor(pStr);
outLen = pStr[0] >= bufSize ? bufSize - 1 : pStr[0];
memcpy(outName, &pStr[1], outLen);
outName[outLen] = '\0';
confirmed = PR_TRUE;
break;
}
else if (hitMessage == msg_Cancel)
{
confirmed = PR_FALSE;
break;
}
}
return confirmed;
}
示例8: dialog
void
UMemoryUtils::ShowLowMemoryAlert()
{
if (sShowingAlert)
return;
sShowingAlert = true;
try {
// Consider this a critical section, but make sure
// there's a reasonable amount of memory left.
StCriticalSection crit;
// Show the can't open dialog.
StApplicationContext appContext;
StDialogHandler dialog(PPob_LowMemory, LCommander::GetTopCommander());
LWindow* window = dialog.GetDialog();
ValidateObject_(dialog.GetDialog());
window->Show();
// Wait until OK is hit.
MessageT message;
do {
message = dialog.DoDialog();
} while (message == msg_Nothing);
}
catch(...) { }
sShowingAlert = false;
}
示例9: main
int main( int argc, char* args[] )
{
//Start up SDL and create window
if( !init() )
{
printf( "Failed to initialize!\n" );
}
else
{
//Load media
if( !loadMedia() )
{
printf( "Failed to load media!\n" );
}
else
{
//Main loop flag
bool quit = false;
//Event handler
SDL_Event e;
//While application is running
while( !quit )
{
//Handle events on queue
while( SDL_PollEvent( &e ) != 0 )
{
//User requests quit
if( e.type == SDL_QUIT )
{
quit = true;
}
//Handle window events
gWindow.handleEvent( e );
}
//Only draw when not minimized
if( !gWindow.isMinimized() )
{
//Clear screen
SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
SDL_RenderClear( gRenderer );
//Render text textures
gSceneTexture.render( ( gWindow.getWidth() - gSceneTexture.getWidth() ) / 2, ( gWindow.getHeight() - gSceneTexture.getHeight() ) / 2 );
//Update screen
SDL_RenderPresent( gRenderer );
}
}
}
}
//Free resources and close SDL
close();
return 0;
}
示例10: main
int main(int argc, char* args[])
{
printf("commands: \n");
printf("(i) integrate \n");
printf("(z) zoom \n");
printf("(x) delete \n");
//Start up SDL and create window
if (!init())
{
printf("Failed to initialize!\n");
}
else
{
//Load media
if (!loadMedia())
{
printf("Failed to load media!\n");
}
else
{
//Main loop flag
bool quit = false;
//Event handler
SDL_Event e;
//Spectra spectra("export.txt");
if (!gWindow.isMinimized()){
gWindow.draw();
}
//While application is running
while (!quit){
//Handle events on queue
while (SDL_PollEvent(&e) != 0){
//User requests quit
if (e.type == SDL_QUIT){
quit = true;
}
gWindow.handleEvent(e);
}
}
}
}
//Free resources and close SDL
close();
return 0;
}
示例11: init
bool init()
{
//Initialization flag
bool success = true;
//Initialize SDL
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "SDL could not initialize! SDL Error: %s\n", SDL_GetError() );
success = false;
}
else
{
//Set texture filtering to linear
if( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) )
{
printf( "Warning: Linear texture filtering not enabled!" );
}
//Create window
if( !gWindow.init() )
{
printf( "Window could not be created! SDL Error: %s\n", SDL_GetError() );
success = false;
}
else
{
//Create renderer for window
gRenderer = gWindow.createRenderer();
if( gRenderer == NULL )
{
printf( "Renderer could not be created! SDL Error: %s\n", SDL_GetError() );
success = false;
}
else
{
//Initialize renderer color
SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
//Initialize PNG loading
int imgFlags = IMG_INIT_PNG;
if( !( IMG_Init( imgFlags ) & imgFlags ) )
{
printf( "SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError() );
success = false;
}
}
}
}
return success;
}
示例12: init
bool init()
{
bool success = true;
if (SDL_Init( SDL_INIT_VIDEO) < 0)
{
printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
success = false;
}
else
{
if (!SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1"))
{
printf("Warning: Linear texture filtering not enabled!");
}
if (!gWindow.init())
{
printf("Window could not be created! SDL Error: %s\n",
SDL_GetError());
success = false;
}
else
{
gRenderer = gWindow.createRenderer();
if (gRenderer == NULL)
{
printf("Renderer could not be created! SDL Error: %s\n",
SDL_GetError());
success = false;
}
else
{
SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
int imgFlags = IMG_INIT_PNG;
if (!(IMG_Init(imgFlags) & imgFlags))
{
printf(
"SDL_image could not initialize! SDL_image Error: %s\n",
IMG_GetError());
success = false;
}
if (TTF_Init() == -1)
{
printf("SDL_ttf could not initialize! SDL_ttf Error: %s\n",
TTF_GetError());
success = false;
}
}
}
}
return success;
}
示例13: close
void close()
{
gSceneTexture.free();
gHelp.free();
gPtrHelp = NULL;
board.freeBoard();
for (int i = 0; i < NUMBER_OF_TILE * 4; ++i)
{
gTile[i].freeButton();
}
for (int i = 0; i < NUMBER_OF_BUTTON; ++i)
{
gButton[i].freeButton();
}
TTF_CloseFont(gFont);
gFont = NULL;
SDL_DestroyRenderer(gRenderer);
gRenderer = NULL;
gWindow.free();
TTF_Quit();
IMG_Quit();
SDL_Quit();
}
示例14: main
int main() {
if(!init()) {
printf("Failed to initialize!\n");
return -1;
}
if(!loadMedia()) {
printf("Failed to load media!\n");
return -1;
}
bool quit = false;
SDL_Event e;
//While application is running
while(!quit) {
//Handle events on queue
while(SDL_PollEvent(&e) != 0) {
//User request quit
if(e.type == SDL_QUIT) {
quit = true;
}
//Handle window events
g_window.handleEvent(e);
}
//Only draw when not minimized
if(!g_window.isMinimized()) {
//Clear screen
SDL_SetRenderDrawColor(g_renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(g_renderer);
//Render text textures
g_sceneTexture.render((g_window.getWidth() - g_sceneTexture.getWidth()) / 2,
(g_window.getHeight() - g_sceneTexture.getHeight()) / 2 );
//Update screen
SDL_RenderPresent(g_renderer);
}
}
close();
return 0;
}
示例15: close
void close()
{
//Destroy window
gWindow.free();
//Deallocate bounds
delete[] gDisplayBounds;
gDisplayBounds = NULL;
//Quit SDL subsystems
SDL_Quit();
}