wxObject *wxScrolledWindowXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(control, wxScrolledWindow) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style"), wxHSCROLL | wxVSCROLL), GetName()); SetupWindow(control); CreateChildren(control); if ( HasParam(wxT("scrollrate")) ) { wxSize rate = GetSize(wxT("scrollrate")); control->SetScrollRate(rate.x, rate.y); } return control; }
wxObject* wxsSplitterWindow::OnBuildPreview(wxWindow* Parent,long Flags) { wxSplitterWindow* Splitter = new wxSplitterWindow(Parent,GetId(),Pos(Parent),Size(Parent),Style()); SetupWindow(Splitter,Flags); if ( MinSize != -1 ) { Splitter->SetMinimumPaneSize(MinSize); } AddChildrenPreview(Splitter,Flags); if ( GetChildCount() == 0 ) { } else if ( GetChildCount() == 1 ) { Splitter->Initialize(wxDynamicCast(GetChild(0)->GetLastPreview(),wxWindow)); } else { if ( Orientation == wxHORIZONTAL ) { Splitter->SplitHorizontally( wxDynamicCast(GetChild(0)->GetLastPreview(),wxWindow), wxDynamicCast(GetChild(1)->GetLastPreview(),wxWindow), SashPos); } else { Splitter->SplitVertically( wxDynamicCast(GetChild(0)->GetLastPreview(),wxWindow), wxDynamicCast(GetChild(1)->GetLastPreview(),wxWindow), SashPos); } Splitter->SetSashGravity(SashGravity); // Some trick to faster relayout splitter window Splitter->OnInternalIdle(); } return Splitter; }
bool GameWindow::AutoSetupWindow(Application* _parent) { Parent = _parent; glfwSetErrorCallback(glfwError); // todo: enum modes if (!glfwInit()) { Log::Logf("Failure to initialize glfw.\n"); return false; // std::exception("glfw failed initialization!"); // don't do shit } AssignSize(); matrixSize.x = ScreenWidth; matrixSize.y = ScreenHeight; IsFullscreen = Configuration::GetConfigf("Fullscreen") != 0; doFlush = Configuration::GetConfigf("VideoFlush") != 0; VSync = Configuration::GetConfigf("VSync") != 0; if (!(wnd = glfwCreateWindow(size.x, size.y, RAINDROP_WINDOWTITLE RAINDROP_VERSIONTEXT, IsFullscreen ? glfwGetPrimaryMonitor() : NULL, NULL))) { Log::Logf("Failure to initialize window.\n"); return false; } #ifdef DARWIN // This is a temporary hack for OS X where our size isn't getting initialized to the correct values. int outx = 0; int outy = 0; glfwGetWindowSize(wnd, &outx, &outy); ResizeFunc(wnd, outx, outy); #endif SetVisibleCursor(Configuration::GetSkinConfigf("ShowCursor") != 0); return SetupWindow(); }
wxObject *wxHtmlWindowXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(control, wxHtmlWindow) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO), GetName()); if (HasParam(wxT("borders"))) { control->SetBorders(GetDimension(wxT("borders"))); } if (HasParam(wxT("url"))) { wxString url = GetParamValue(wxT("url")); wxFileSystem& fsys = GetCurFileSystem(); wxFSFile *f = fsys.OpenFile(url); if (f) { control->LoadPage(f->GetLocation()); delete f; } else control->LoadPage(url); } else if (HasParam(wxT("htmlcode"))) { control->SetPage(GetText(wxT("htmlcode"))); } SetupWindow(control); return control; }
int CARDT2Window::Init(void) { if(webCamNum != 1) return(0); webCamNum = 2; webCamList = new CWebCam*[webCamNum]; webCamList[0] = new CVirtualWebCam(); webCamList[1] = new CMainWebCam2(); scale = 1.0; const char* cparamNames[] = { "", "Data/camera_para.dat", }; char* vconfs[] = { "", "Data/WDM_camera_flipV_0.xml", }; for(int i = 0; i < webCamNum; i++) { if(!webCamList[i]->SetupWebCam(cparamNames[i], vconfs[i])) return(0); } webCamList[1]->dispImage = false; width = webCamList[1]->ARTCparam.xsize; height = webCamList[1]->ARTCparam.ysize; aspectRatio = (double) width / (double) height; Reshape(width, height); vpX = 0; vpY = 0; SetupWindow(); return(1); }
wxObject *wxSpinCtrlXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(control, wxSpinCtrl) control->Create(m_parentAsWindow, GetID(), GetText(wxT("value")), GetPosition(), GetSize(), GetStyle(wxT("style"), wxSP_ARROW_KEYS | wxALIGN_RIGHT), GetLong(wxT("min"), DEFAULT_MIN), GetLong(wxT("max"), DEFAULT_MAX), GetLong(wxT("value"), DEFAULT_VALUE), GetName()); const long base = GetLong(wxS("base"), 10); if ( base != 10 ) control->SetBase(base); SetupWindow(control); return control; }
wxObject* wxsSashWindow::OnBuildPreview(wxWindow* Parent,long Flags) { // make a thing to display wxSashWindow *swin = new wxSashWindow(Parent,GetId(),Pos(Parent),Size(Parent),Style()); SetupWindow(swin, Flags); // for now, a sash on all edges swin->SetSashVisible(wxSASH_TOP, mTop); swin->SetSashVisible(wxSASH_BOTTOM, mBottom); swin->SetSashVisible(wxSASH_LEFT, mLeft); swin->SetSashVisible(wxSASH_RIGHT, mRight); // don't forget the kids AddChildrenPreview(swin, Flags); // done return swin; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { MSG msg; // message bool done; // flag for when app is done // create our window and set up OpenGL SetupWindow("CS447-Textures", 800, 600, 32, FALSE); done = false; // init for loop // main message loop. note to use PeekMessage not GetMessage while (!done) { // use Peek because GetMessage halts app if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // check for a message { if (msg.message == WM_QUIT) { done = true; // if receive quit then quit } else { TranslateMessage(&msg); // translate to event queue DispatchMessage(&msg); // dispatch to event queue } } else { DisplayScene(); // render current scene SwapBuffers(g_HDC); // bring back buffer to front } } KillWindow(); // cleanup return msg.wParam; }
wxObject *kwxLinearMeterHandler::DoCreateResource() { // the following macro will init a pointer named "control" // with a new instance of the MyControl class, but will NOT // Create() it! XRC_MAKE_INSTANCE(control, kwxLinearMeter) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize()); control->ShowCurrent(GetBool(wxT("show_value"), true)); control->SetRangeVal(GetLong(wxT("range_min"), 0), GetLong(wxT("range_max"), 100)); control->ShowLimits(GetBool(wxT("show_limit_value"), true)); control->SetOrizDirection(GetBool(wxT("horizontal"), true)); control->SetActiveBarColour(GetColour(wxT("bar_colour"), *wxLIGHT_GREY)); control->SetPassiveBarColour(GetColour(wxT("background_colour"), *wxLIGHT_GREY)); control->SetBorderColour(GetColour(wxT("border_colour"), *wxBLACK)); control->SetTxtLimitColour(GetColour(wxT("range_text_colour"), *wxLIGHT_GREY)); control->SetTxtValueColour(GetColour(wxT("value_text_colour"), *wxBLACK)); control->SetTagsColour(GetColour(wxT("tag_colour"), *wxBLACK)); int i = 1; while(1){ wxString s = wxString::Format(wxT("tag_%d_value"), i); if(!HasParam(s)){ break; } control->AddTag(GetLong(s)); i++; } // Avoid error if the font node isn't present. if(HasParam(wxT("font"))){ wxFont font = GetFont(); control->SetTxtFont(font); } control->SetValue(GetLong(wxT("value"), 0)); SetupWindow(control); return control; }
wxObject *wxGridXmlHandler::DoCreateResource() { wxGrid* grid = new wxGrid(m_parentAsWindow, GetID(), wxDefaultPosition, wxDefaultSize, GetStyle(wxT("style"), wxWANTS_CHARS), GetName()); long cols = GetLong (wxT("numcols"), 0); long rows = GetLong (wxT("numrows"), 0); if (cols && rows) grid->CreateGrid(cols, rows, (wxGrid::wxGridSelectionModes)GetLong (wxT("selmode"), 0)); if (HasParam(wxT("size"))) grid->SetSize(GetSize()); if (HasParam(wxT("pos"))) grid->Move(GetPosition()); SetupWindow(grid); return grid; }
wxObject *wxWizardXmlHandler::DoCreateResource() { if (m_class == wxT("wxWizard")) { XRC_MAKE_INSTANCE(wiz, wxWizard) long style = GetStyle(wxT("exstyle"), 0); if (style != 0) wiz->SetExtraStyle(style); wiz->Create(m_parentAsWindow, GetID(), GetText(wxT("title")), GetBitmap(), GetPosition()); SetupWindow(wiz); wxWizard *old = m_wizard; m_wizard = wiz; m_lastSimplePage = NULL; CreateChildren(wiz, true /*this handler only*/); m_wizard = old; return wiz; }
bool CMainWindow::LoadFile(LPCTSTR filename) { InitEditor(); FILE *fp = NULL; _tfopen_s(&fp, filename, L"rb"); if (!fp) return false; //SetTitle(); char data[4096] = { 0 }; size_t lenFile = fread(data, 1, sizeof(data), fp); bool bUTF8 = IsUTF8(data, lenFile); while (lenFile > 0) { SendEditor(SCI_ADDTEXT, lenFile, reinterpret_cast<LPARAM>(static_cast<char *>(data))); lenFile = fread(data, 1, sizeof(data), fp); } fclose(fp); SetupWindow(bUTF8); m_filename = filename; return true; }
wxObject* wxsMathPlot::OnBuildPreview(wxWindow* Parent, long Flags) { mpWindow *mp; // make a panel mp = new mpWindow(Parent, GetId(), Pos(Parent), Size(Parent), Style()); if (mp == NULL) return NULL; SetupWindow(mp, Flags); // add kids AddChildrenPreview(mp, Flags); // and update the display mp->UpdateAll(); mp->Fit(); // done return mp; }
wxObject * MaxAnimationCtrlXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(ctrl, MaxAnimationCtrl) wxScopedPtr<wxAnimation> animation(GetAnimation(wxT("animation"))); ctrl->Create(m_parentAsWindow, GetID(), animation ? *animation : wxNullAnimation, GetPosition(), GetSize(), GetStyle(wxT("style"), wxAC_DEFAULT_STYLE), GetName()); ctrl->MaxBind(_wx_wxanimationctrl_wxAnimationCtrl__xrcNew(ctrl)); // if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap // which just tells wxAnimationCtrl to use the default for inactive status ctrl->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap"))); SetupWindow(ctrl); return ctrl; }
wxObject * MaxScrollBarXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(control, MaxScrollBar) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName()); control->SetScrollbar(GetLong( wxT("value"), 0), GetLong( wxT("thumbsize"),1), GetLong( wxT("range"), 10), GetLong( wxT("pagesize"),1)); control->MaxBind(_wx_wxscrollbar_wxScrollBar__xrcNew(control)); SetupWindow(control); CreateChildren(control); return control; }
wxObject *kwxAngularMeterHandler::DoCreateResource() { // the following macro will init a pointer named "control" // with a new instance of the MyControl class, but will NOT // Create() it! XRC_MAKE_INSTANCE(control, kwxAngularMeter) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize()); control->SetNumTick(GetLong(wxT("num_ticks"))); control->SetRange(GetLong(wxT("range_min"), 0), GetLong(wxT("range_max"), 220)); control->SetAngle(GetLong(wxT("angle_min"), -20), GetLong(wxT("angle_max"), 200)); int i = 1; while(1){ wxString s = wxString::Format(wxT("sector_%d_colour"), i); if(!HasParam(s)){ break; } // Setting the number of sectors each time around is not ideal but the alternative is to pre-process the XML. control->SetNumSectors(i); control->SetSectorColor(i - 1, GetColour(s, *wxWHITE)); i++; } control->DrawCurrent(GetBool(wxT("show_value"), true)); control->SetNeedleColour(GetColour(wxT("needle_colour"), *wxRED)); control->SetBackColour(GetColour(wxT("background_colour"), control->GetBackgroundColour())); control->SetBorderColour(GetColour(wxT("border_colour"), control->GetBackgroundColour())); // Avoid error if the font node isn't present. if(HasParam(wxT("font"))){ wxFont font = GetFont(); control->SetTxtFont(font); } control->SetValue(GetLong(wxT("value"), 0)); SetupWindow(control); return control; }
wxObject *wxRadioButtonXmlHandler::DoCreateResource() { /* BOBM - implementation note. * once the wxBitmapRadioButton is implemented. * look for a bitmap property. If not null, * make it a wxBitmapRadioButton instead of the * normal radio button. */ XRC_MAKE_INSTANCE(control, wxRadioButton) control->Create(m_parentAsWindow, GetID(), GetText(wxT("label")), GetPosition(), GetSize(), GetStyle(), wxDefaultValidator, GetName()); control->SetValue(GetBool(wxT("value"), 0)); SetupWindow(control); return control; }
wxObject *wxMdiXmlHandler::DoCreateResource() { wxWindow *frame = CreateFrame(); if (HasParam(wxT("size"))) frame->SetClientSize(GetSize()); if (HasParam(wxT("pos"))) frame->Move(GetPosition()); if (HasParam(wxT("icon"))) { wxFrame* f = wxDynamicCast(frame, wxFrame); if (f) f->SetIcon(GetIcon(wxT("icon"), wxART_FRAME_ICON)); } SetupWindow(frame); CreateChildren(frame); if (GetBool(wxT("centered"), false)) frame->Centre(); return frame; }
BOOL MDIChild::Create() { if (!Register()) return FALSE; MDICREATESTRUCT mcs= { GetClassName(),Title,App::hInstance,x,y,w,h,Style,NULL }; if (Style & (WS_HSCROLL | WS_VSCROLL)) Flags|=W_SCROLLBARS; CreationWindow=this; #ifdef WIN32 hWnd = (HWND) SendMessage( ((MDIFrame*)Parent)->hClient, WM_MDICREATE, 0, (LPARAM)(&mcs)); #else hWnd = LOWORD(SendMessage( ((MDIFrame*)Parent)->hClient, WM_MDICREATE, 0, (LPARAM)(&mcs))); #endif if (!hWnd) return FALSE; // user may not want child to save its position?? if (Name) GetWindowState(W_SAVESTATE | W_SAVEMIN); return SetupWindow(); }
wxObject *wxCalendarBoxXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(calendar, wxCalendarBox); #if pgUSE_WX_CAL calendar->Create(m_parentAsWindow, GetID(), wxDefaultDateTime, GetPosition(), GetSize(), wxDP_DEFAULT | wxDP_SHOWCENTURY | wxDP_ALLOWNONE, wxDefaultValidator, GetName()); #else // pgUSE_WX_CAL #if !defined(wxUSE_DATEPICKCTRL) || !wxUSE_DATEPICKCTRL calendar->Create(m_parentAsWindow, GetID(), wxDefaultDateTime, GetPosition(), GetSize(), GetStyle(), GetName()); #else // !defined(wxUSE_DATEPICKCTRL) || !wxUSE_DATEPICKCTRL calendar->Create(m_parentAsWindow, (wxWindowID)GetID(), wxDefaultDateTime, GetPosition(), GetSize(), (long int)GetStyle(), wxDefaultValidator, GetName()); #endif // !defined(wxUSE_DATEPICKCTRL) || !wxUSE_DATEPICKCTRL #endif // pgUSE_WX_CAL SetupWindow(calendar); return calendar; }
wxObject* wxsGLCanvas::OnBuildPreview(wxWindow* Parent, long Flags) { // there is a problem importing the OpenGL DLL into this designer DLL // so ... // for the visual designer, just use a wxPanel to show where the // canvas will be located /* wxGLCanvas *gc; gc = new wxGLCanvas(Parent, GetId(), Pos(Parent), Size(Parent)); SetupWindow(gc, Flags); return gc; */ wxPanel* gc = new wxPanel(Parent, GetId(),Pos(Parent),Size(Parent),Style()); SetupWindow(gc, Flags); return gc; }
wxObject *wxBitmapButtonXmlHandler::DoCreateResource() { XRC_MAKE_INSTANCE(button, wxBitmapButton) button->Create(m_parentAsWindow, GetID(), GetBitmap(wxT("bitmap"), wxART_BUTTON), GetPosition(), GetSize(), GetStyle(wxT("style"), wxBU_AUTODRAW), wxDefaultValidator, GetName()); if (GetBool(wxT("default"), 0)) button->SetDefault(); SetupWindow(button); if (!GetParamValue(wxT("selected")).IsEmpty()) button->SetBitmapSelected(GetBitmap(wxT("selected"))); if (!GetParamValue(wxT("focus")).IsEmpty()) button->SetBitmapFocus(GetBitmap(wxT("focus"))); if (!GetParamValue(wxT("disabled")).IsEmpty()) button->SetBitmapDisabled(GetBitmap(wxT("disabled"))); return button; }
wxObject *wxToolBarXmlHandler::DoCreateResource() { if (m_class == wxT("tool")) { wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XRC resource: tool not within a toolbar!")); if (GetPosition() != wxDefaultPosition) { m_toolbar->AddTool(GetID(), GetBitmap(wxT("bitmap"), wxART_TOOLBAR), GetBitmap(wxT("bitmap2"), wxART_TOOLBAR), GetBool(wxT("toggle")), GetPosition().x, GetPosition().y, NULL, GetText(wxT("tooltip")), GetText(wxT("longhelp"))); } else { wxItemKind kind = wxITEM_NORMAL; if (GetBool(wxT("radio"))) kind = wxITEM_RADIO; if (GetBool(wxT("toggle"))) { wxASSERT_MSG( kind == wxITEM_NORMAL, _T("can't have both toggleable and radion button at once") ); kind = wxITEM_CHECK; } m_toolbar->AddTool(GetID(), GetText(wxT("label")), GetBitmap(wxT("bitmap"), wxART_TOOLBAR), GetBitmap(wxT("bitmap2"), wxART_TOOLBAR), kind, GetText(wxT("tooltip")), GetText(wxT("longhelp"))); if ( GetBool(wxT("disabled")) ) m_toolbar->EnableTool(GetID(), false); } return m_toolbar; // must return non-NULL } else if (m_class == wxT("separator")) { wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XRC resource: separator not within a toolbar!")); m_toolbar->AddSeparator(); return m_toolbar; // must return non-NULL } else /*<object class="wxToolBar">*/ { int style = GetStyle(wxT("style"), wxNO_BORDER | wxTB_HORIZONTAL); #ifdef __WXMSW__ if (!(style & wxNO_BORDER)) style |= wxNO_BORDER; #endif XRC_MAKE_INSTANCE(toolbar, wxToolBar) toolbar->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), style, GetName()); SetupWindow(toolbar); wxSize bmpsize = GetSize(wxT("bitmapsize")); if (!(bmpsize == wxDefaultSize)) toolbar->SetToolBitmapSize(bmpsize); wxSize margins = GetSize(wxT("margins")); if (!(margins == wxDefaultSize)) toolbar->SetMargins(margins.x, margins.y); long packing = GetLong(wxT("packing"), -1); if (packing != -1) toolbar->SetToolPacking(packing); long separation = GetLong(wxT("separation"), -1); if (separation != -1) toolbar->SetToolSeparation(separation); wxXmlNode *children_node = GetParamNode(wxT("object")); if (!children_node) children_node = GetParamNode(wxT("object_ref")); if (children_node == NULL) return toolbar; m_isInside = true; m_toolbar = toolbar; wxXmlNode *n = children_node; while (n) { if ((n->GetType() == wxXML_ELEMENT_NODE) && (n->GetName() == wxT("object") || n->GetName() == wxT("object_ref"))) { wxObject *created = CreateResFromNode(n, toolbar, NULL); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxT("tool")) && !IsOfClass(n, wxT("separator")) && control != NULL) toolbar->AddControl(control); } n = n->GetNext(); } m_isInside = false; m_toolbar = NULL; toolbar->Realize(); if (m_parentAsWindow && !GetBool(wxT("dontattachtoframe"))) { wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame); if (parentFrame) parentFrame->SetToolBar(toolbar); } return toolbar; } }
wxObject *wxNotebookXmlHandler::DoCreateResource() { if (m_class == wxT("notebookpage")) { wxXmlNode *n = GetParamNode(wxT("object")); if ( !n ) n = GetParamNode(wxT("object_ref")); if (n) { bool old_ins = m_isInside; m_isInside = false; wxObject *item = CreateResFromNode(n, m_notebook, NULL); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); if (wnd) { m_notebook->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected"))); if ( HasParam(wxT("bitmap")) ) { wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); wxImageList *imgList = m_notebook->GetImageList(); if ( imgList == NULL ) { imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); m_notebook->AssignImageList( imgList ); } int imgIndex = imgList->Add(bmp); m_notebook->SetPageImage(m_notebook->GetPageCount()-1, imgIndex ); } } else wxLogError(wxT("Error in resource.")); return wnd; } else { wxLogError(wxT("Error in resource: no control within notebook's <page> tag.")); return NULL; } } else { XRC_MAKE_INSTANCE(nb, wxNotebook) nb->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style")), GetName()); SetupWindow(nb); wxNotebook *old_par = m_notebook; m_notebook = nb; bool old_ins = m_isInside; m_isInside = true; CreateChildren(m_notebook, true/*only this handler*/); m_isInside = old_ins; m_notebook = old_par; return nb; } }
// Called from main()/WindMain() after settings are initialized to execute // most of the program logic. Responsible for setting up the window, // loading movies and containing the playback/message loop. int FxPlayerTiny::Run() { if (!SetupWindow(GString(FXPLAYER_APP_TITLE " ") + FileName)) return 1; // Show the window. ShowWindow(hWnd, SW_SHOWDEFAULT); UpdateWindow(hWnd); // Create and Configure GFxLoader. GFxLoader loader; // Developers set states on the loader to modify loading and playback behavior. // If you need to load files from a custom package, for example, you can // create a GFxFileOpener derived class that loads files in a custom way. // Here GFxFileOpener and GFxFSCommandHandler are set for sample purposes. GPtr<GFxFileOpener> pfileOpener = *new GFxFileOpener; loader.SetFileOpener(pfileOpener); GPtr<GFxFSCommandHandler> pcommandHandler = *new FxPlayerFSCommandHandler; loader.SetFSCommandHandler(pcommandHandler); // For D3D, it is good to override image creator to keep image data, // so that it can be restored in case of a lost device. GPtr<GFxImageCreator> pimageCreator = *new GFxImageCreator(1); loader.SetImageCreator(pimageCreator); // Load the movie file and create its instance. if (!(pMovieDef = *loader.CreateMovie(FileName))) { GString errorString = "Unable to load file: "; errorString += FileName; MessageBox(NULL, errorString.ToCStr(), "Error", MB_OK | MB_ICONEXCLAMATION); return 1; } if (!(pMovie = *pMovieDef->CreateInstance())) return 1; // Create renderer. if (!(pRenderer = *GRendererD3D9::CreateRenderer())) return 1; // Configure renderer in "Dependent mode", honoring externally // configured device settings. if (!pRenderer->SetDependentVideoMode(pDevice, &PresentParams, 0, hWnd)) return 1; // Set renderer on loader so that it is also applied to all children. pRenderConfig = *new GFxRenderConfig(pRenderer, GFxRenderConfig::RF_EdgeAA | GFxRenderConfig::RF_StrokeNormal); loader.SetRenderConfig(pRenderConfig); // Set playback view to span the entire window. pMovie->SetViewport(Width, Height, 0,0, Width, Height); // If you wanted to use the movie as a transparent HUD overlay, you would // set Background Alpha to 0. We don't need to do this for player sample. // pMovie->SetBackgroundAlpha(0.0f); // Store initial timing, so that we can determine // how much to advance Flash playback. MovieLastTime = timeGetTime(); // Application / Player message loop. MSG msg; ZeroMemory(&msg, sizeof(msg)); // KevinJ: 1/3 functions, Init() // Path to current exe is used to the patcher can restart itself if needed RakNet::Lobby2ClientGFx3Impl sampleImpl; GPtr<FxDelegate> pDelegate = *new FxDelegate; pMovie->SetExternalInterface(pDelegate); RakNet::Lobby2Client lobby2Client; RakNet::Lobby2MessageFactory messageFactory; RakNet::RakPeerInterface *rakPeer = RakNet::RakPeerInterface::GetInstance(); RakNet::SocketDescriptor sd; rakPeer->Startup(1,&sd, 1); rakPeer->AttachPlugin(&lobby2Client); rakPeer->AttachPlugin(&sampleImpl); lobby2Client.SetMessageFactory(&messageFactory); lobby2Client.SetCallbackInterface(&sampleImpl); sampleImpl.Init(&lobby2Client, &messageFactory, rakPeer, pDelegate, pMovie); while(msg.message != WM_QUIT) { if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { // Check for lost D3D Devices. if (pRenderer) { GRendererD3D9::DisplayStatus status = pRenderer->CheckDisplayStatus(); if (status == GRendererD3D9::DisplayStatus_Unavailable) { ::Sleep(10); continue; } if (status == GRendererD3D9::DisplayStatus_NeedsReset) { if (!SUCCEEDED(ResetD3D())) continue; } } // Advance movie animation and render it to screen. AdvanceAndDisplay(); } // KevinJ: 2/3 functions, periodic update RakNet::Packet *p; for (p=rakPeer->Receive(); p; rakPeer->DeallocatePacket(p), p=rakPeer->Receive()) { } } // KevinJ: 3/3 functions, Shutdown() sampleImpl.Shutdown(); RakNet::RakPeerInterface::DestroyInstance(rakPeer); return 0; }
wxObject* wxsButton::OnBuildPreview(wxWindow* Parent,long Flags) { wxButton* Preview = new wxButton(Parent,GetId(),Label,Pos(Parent),Size(Parent),Style()); if ( IsDefault ) Preview->SetDefault(); return SetupWindow(Preview,Flags); }
int FxPlayerTiny::Run() { // Windows conf if (!SetupWindow(GString(FXPLAYER_APP_TITLE " "))) return 1; ShowWindow(hWnd, SW_SHOWDEFAULT); UpdateWindow(hWnd); // Gfx conf GFxLoader loader; GPtr<GFxFileOpener> pfileOpener = *new GFxFileOpener; loader.SetFileOpener(pfileOpener); // Register FsCommandHander GPtr<GFxFSCommandHandler> pcommandHandler = *new FxPlayerFSCommandHandler; loader.SetFSCommandHandler(pcommandHandler); // Register FsDelegate pGameDelegate = *new FxDelegate(); loader.SetExternalInterface(pGameDelegate); pGameDelegate->RegisterHandler(this); GPtr<GFxImageCreator> pimageCreator = *new GFxImageCreator(1); loader.SetImageCreator(pimageCreator); // Login flash if (!(pMovieDef = *loader.CreateMovie(FXPLAYER_FILENAME))) { GString errorString = "Unable to load file: "; MessageBox(NULL, errorString.ToCStr(), "Error", MB_OK | MB_ICONEXCLAMATION); return 1; } if (!(pMovie = *pMovieDef->CreateInstance())) return 1; pMovie->SetViewport(Width, Height, 0,0, Width, Height); // HUD flash if (!(pHUDDef = *loader.CreateMovie(CONFIG_FILENAME))) { GString errorString = "Unable to load file: "; MessageBox(NULL, errorString.ToCStr(), "Error", MB_OK | MB_ICONEXCLAMATION); return 1; } if (!(pHUD = *pHUDDef->CreateInstance())) return 1; pHUD->SetBackgroundAlpha(0.0f); pHUD->SetViewport(Width, Height, 0,0, Width, Height); // render config if (!(pRenderer = *GRendererD3D9::CreateRenderer())) return 1; if (!pRenderer->SetDependentVideoMode(pDevice, &PresentParams, 0, hWnd)) return 1; pRenderConfig = *new GFxRenderConfig(pRenderer, GFxRenderConfig::RF_EdgeAA | GFxRenderConfig::RF_StrokeNormal); loader.SetRenderConfig(pRenderConfig); // how much to advance Flash playback. MovieLastTime = timeGetTime(); // Application / Player message loop. MSG msg; ZeroMemory(&msg, sizeof(msg)); while(msg.message != WM_QUIT && g_gamestate != GAME_STATE::QUIT) { if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { // Check for lost D3D Devices. if (pRenderer) { GRendererD3D9::DisplayStatus status = pRenderer->CheckDisplayStatus(); if (status == GRendererD3D9::DisplayStatus_Unavailable) { ::Sleep(10); continue; } if (status == GRendererD3D9::DisplayStatus_NeedsReset) { if (!SUCCEEDED(ResetD3D())) continue; } } switch (g_gamestate) { case GAME_STATE::LOGIN_SCREEN: DisplayLoginScreen(); break; case GAME_STATE::LOGINED: DisplayGameScreen(); break; default: break; } } } return 0; }
wxObject *wxCheckListBoxXmlHandler::DoCreateResource() { if (m_class == wxT("wxCheckListBox") #if WXWIN_COMPATIBILITY_2_4 || m_class == wxT("wxCheckList") #endif ) { #if WXWIN_COMPATIBILITY_2_4 if (m_class == wxT("wxCheckList")) wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead.")); #endif // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); wxString *strings = (wxString *) NULL; if (strList.GetCount() > 0) { strings = new wxString[strList.GetCount()]; int count = strList.GetCount(); for(int i = 0; i < count; i++) strings[i] = strList[i]; } XRC_MAKE_INSTANCE(control, wxCheckListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList.GetCount(), strings, GetStyle(), wxDefaultValidator, GetName()); // step through children myself (again.) wxXmlNode *n = GetParamNode(wxT("content")); if (n) n = n->GetChildren(); int i = 0; while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || n->GetName() != wxT("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) wxString v = n->GetPropVal(wxT("checked"), wxEmptyString); v.MakeLower(); if (v && v == wxT("1")) control->Check( i, true ); i++; n = n->GetNext(); } SetupWindow(control); if (strings != NULL) delete[] strings; strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item checked="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str); strList.Add(str); return NULL; } }
wxObject *wxRadioBoxXmlHandler::DoCreateResource() { if ( m_class == wxT("wxRadioBox")) { // find the selection long selection = GetLong( wxT("selection"), -1 ); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxRadioBox) control->Create(m_parentAsWindow, GetID(), GetText(wxT("label")), GetPosition(), GetSize(), m_labels, GetLong(wxT("dimension"), 1), GetStyle(), wxDefaultValidator, GetName()); if (selection != -1) control->SetSelection(selection); SetupWindow(control); const unsigned count = m_labels.size(); for( unsigned i = 0; i < count; i++ ) { #if wxUSE_TOOLTIPS if ( !m_tooltips[i].empty() ) control->SetItemToolTip(i, m_tooltips[i]); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP if ( m_helptextSpecified[i] ) control->SetItemHelpText(i, m_helptexts[i]); #endif // wxUSE_HELP if ( !m_isShown[i] ) control->Show(i, false); if ( !m_isEnabled[i] ) control->Enable(i, false); } // forget information about the items of this radiobox, we should start // afresh for the next one m_labels.clear(); #if wxUSE_TOOLTIPS m_tooltips.clear(); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP m_helptexts.clear(); m_helptextSpecified.clear(); #endif // wxUSE_HELP m_isShown.clear(); m_isEnabled.clear(); return control; } else // inside the radiobox element { // we handle handle <item>Label</item> constructs here, and the item // tag can have tooltip, helptext, enabled and hidden attributes wxString label = GetNodeContent(m_node); wxString tooltip; m_node->GetAttribute(wxT("tooltip"), &tooltip); wxString helptext; bool hasHelptext = m_node->GetAttribute(wxT("helptext"), &helptext); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) { label = wxGetTranslation(label, m_resource->GetDomain()); if ( !tooltip.empty() ) tooltip = wxGetTranslation(tooltip, m_resource->GetDomain()); if ( hasHelptext ) helptext = wxGetTranslation(helptext, m_resource->GetDomain()); } m_labels.push_back(label); #if wxUSE_TOOLTIPS m_tooltips.push_back(tooltip); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP m_helptexts.push_back(helptext); m_helptextSpecified.push_back(hasHelptext); #endif // wxUSE_HELP m_isEnabled.push_back(GetBoolAttr("enabled", 1)); m_isShown.push_back(!GetBoolAttr("hidden", 0)); return NULL; } }
/*! \brief Build the control preview. * * \param parent wxWindow* The parent window. * \param flags long The control flags. * \return wxObject* The constructed control. * */ wxObject* wxsTimePickerCtrl::OnBuildPreview(wxWindow* Parent,long Flags) { wxTimePickerCtrl* Preview = new wxTimePickerCtrl(Parent,GetId(),wxDateTime::Now(),Pos(Parent),Size(Parent),Style()); return SetupWindow(Preview,Flags); }