// Processes an event coming through from Rocket. void EventManager::ProcessEvent(Rocket::Core::Event& event, const Rocket::Core::String& value) { Rocket::Core::StringList commands; Rocket::Core::StringUtilities::ExpandString(commands, value, ';'); for (size_t i = 0; i < commands.size(); ++i) { // Check for a generic 'load' or 'exit' command. Rocket::Core::StringList values; Rocket::Core::StringUtilities::ExpandString(values, commands[i], ' '); if (values.empty()) return; if (values[0] == "goto" && values.size() > 1) { // Load the window, and if successful close the old window. if (LoadWindow(values[1])) event.GetTargetElement()->GetOwnerDocument()->Close(); } else if (values[0] == "load" && values.size() > 1) { // Load the window. LoadWindow(values[1]); } else if (values[0] == "close") { Rocket::Core::ElementDocument* target_document = NULL; if (values.size() > 1) target_document = context->GetDocument(values[1].CString()); else target_document = event.GetTargetElement()->GetOwnerDocument(); if (target_document != NULL) target_document->Close(); } else if (values[0] == "exit") { Shell::RequestExit(); } else if (values[0] == "pause") { GameDetails::SetPaused(true); } else if (values[0] == "unpause") { GameDetails::SetPaused(false); } else { if (event_handler != NULL) event_handler->ProcessEvent(event, commands[i]); } } }
RecOptDialog::RecOptDialog(ScheduledRecording* sr, MythMainWindow *parent, const char *name) : MythDialog(parent, name), listMenu(this, "listMenu") { schedRec = sr; program = sr->getProgramInfo(); theme = new XMLParse(); theme->SetWMult(wmult); theme->SetHMult(hmult); if (!theme->LoadTheme(xmldata, "recording_options")) { MythPopupBox::showOkPopup(gContext->GetMainWindow(), tr("Missing Element"), tr("The theme you are using does not contain a 'recording_options' " "element. Please contact the theme creator and ask if they could " "please update it.<br><br>The next screen will be empty. " "Press EXIT to return to the menu.")); return; } LoadWindow(xmldata); listMenu.init(theme, "selector", "menu_list", listRect); rootGroup = sr->getRootGroup(); rootGroup->setParentList(&listMenu); listMenu.setCurGroup(rootGroup); setNoErase(); allowEvents = true; allowUpdates = true; updateBackground(); }
void WindSetupPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(CallBackTable, parent, _T("IDR_XML_INFOBOXWINDSETUP")); const NMEAInfo &basic = XCSoarInterface::Basic(); const WindSettings &settings = CommonInterface::GetComputerSettings().wind; const bool external_wind = basic.external_wind_available && settings.use_external_wind; if (external_wind) { static gcc_constexpr_data StaticEnumChoice external_wind_list[] = { { 0, N_("External") }, { 0 } }; SetFormControlEnabled(form, _T("prpAutoWind"), false); LoadFormProperty(form, _T("prpAutoWind"), external_wind_list, 0); } else { static gcc_constexpr_data StaticEnumChoice auto_wind_list[] = { { AUTOWIND_NONE, N_("Manual") }, { AUTOWIND_CIRCLING, N_("Circling") }, { AUTOWIND_ZIGZAG, N_("ZigZag") }, { AUTOWIND_CIRCLING | AUTOWIND_ZIGZAG, N_("Both") }, { 0 } }; LoadFormProperty(form, _T("prpAutoWind"), auto_wind_list, settings.GetLegacyAutoWindMode()); } }
void DevicesConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_DEVICESCONFIGPANEL") : _T("IDR_XML_DEVICESCONFIGPANEL_L")); current_device = 0; for (unsigned i = 0; i < NUMDEV; ++i) Profile::GetDeviceConfig(i, device_config[i]); DockWindow *dock = (DockWindow *)form.FindByName(_T("edit")); assert(dock != NULL); DeviceEditWidget *edit = new DeviceEditWidget(device_config[0]); dock->SetWidget(edit); WndListFrame *list = (WndListFrame *)form.FindByName(_T("list")); assert(list != NULL); list->SetPaintItemCallback(PaintDeviceListItem); list->SetLength(2); list->SetCursorCallback(DeviceListCursorCallback); LoadFormProperty(form, _T("prpSetSystemTimeFromGPS"), CommonInterface::GetComputerSettings().set_system_time_from_gps); LoadFormProperty(form, _T("prpIgnoreNMEAChecksum"), NMEAParser::ignore_checksum); }
void VarioConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_VARIOCONFIGPANEL") : _T("IDR_XML_VARIOCONFIGPANEL_L")); const VarioSettings &settings = CommonInterface::GetUISettings().vario; LoadFormProperty(form, _T("prpAppGaugeVarioSpeedToFly"), settings.ShowSpeedToFly); LoadFormProperty(form, _T("prpAppGaugeVarioAvgText"), settings.ShowAvgText); LoadFormProperty(form, _T("prpAppGaugeVarioMc"), settings.ShowMc); LoadFormProperty(form, _T("prpAppGaugeVarioBugs"), settings.ShowBugs); LoadFormProperty(form, _T("prpAppGaugeVarioBallast"), settings.ShowBallast); LoadFormProperty(form, _T("prpAppGaugeVarioGross"), settings.ShowGross); LoadFormProperty(form, _T("prpAppAveNeedle"), settings.ShowAveNeedle); }
void MacCreadyEditPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(call_back_table, parent, _T("IDR_XML_INFOBOXMACCREADYEDIT")); TCHAR caption[16]; WndButton *button = (WndButton *)form.FindByName(_T("cmdPlusBig")); assert(button != NULL); FormatUserVerticalSpeed( Units::ToSysVSpeed(GetUserVerticalSpeedStep() * 5), caption, false); button->SetCaption(caption); button = (WndButton *)form.FindByName(_T("cmdPlusSmall")); assert(button != NULL); FormatUserVerticalSpeed( Units::ToSysVSpeed(GetUserVerticalSpeedStep()), caption, false); button->SetCaption(caption); button = (WndButton *)form.FindByName(_T("cmdMinusBig")); assert(button != NULL); FormatUserVerticalSpeed( Units::ToSysVSpeed(-GetUserVerticalSpeedStep() * 5), caption, false); button->SetCaption(caption); button = (WndButton *)form.FindByName(_T("cmdMinusSmall")); assert(button != NULL); FormatUserVerticalSpeed( Units::ToSysVSpeed(-GetUserVerticalSpeedStep()), caption, false); button->SetCaption(caption); }
Window* pnlTaskProperties::Load(SingleWindow &parent, TabBarControl* wTabBar, WndForm* _wf, OrderedTask** task, bool* _task_modified) { ordered_task_pointer = task; ordered_task = *ordered_task_pointer;; assert(_task_modified); task_changed = _task_modified; assert(_wf); wf = _wf; Window *wProp = LoadWindow(dlgTaskManager::CallBackTable, wf, *wTabBar, Layout::landscape ? _T("IDR_XML_TASKPROPERTIES_L") : _T("IDR_XML_TASKPROPERTIES")); wTaskView = (WndOwnerDrawFrame*)wf->FindByName(_T("frmTaskViewProperties")); assert(wTaskView != NULL); wTaskView->SetOnMouseDownNotify(dlgTaskManager::OnTaskViewClick); assert(wProp); InitView(); return wProp; }
void TaskListPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(task_list_callbacks, parent, Layout::landscape ? _T("IDR_XML_TASKLIST_L") : _T("IDR_XML_TASKLIST")); instance = this; task_store = new TaskStore(); lazy_loaded = false; browse_tabbed = ((TabbedControl *)form.FindByName(_T("tabbedManage"))); assert(browse_tabbed != NULL); if (is_simulator()) /* cannot communicate with real devices in simulator mode */ form.FindByName(_T("cmdDeclare"))->set_enabled(false); // Save important control pointers wTaskView = (WndOwnerDrawFrame*)form.FindByName(_T("frmTaskView1")); assert(wTaskView != NULL); TaskViewRect = wTaskView->get_position(); wTaskView->SetOnMouseDownNotify(::OnTaskViewClick); fullscreen = false; wTasks = (WndListFrame*)form.FindByName(_T("frmTasks")); assert(wTasks != NULL); // Set callbacks wTasks->SetActivateCallback(OnTaskListEnter); wTasks->SetPaintItemCallback(::OnTaskPaintListItem); wTasks->SetCursorCallback(OnTaskCursorCallback); }
gameEngine::gameEngine() { m_running = true; LoadWindow("Arkham Horror", 1024, 768); m_states.emplace_back(new TestState(m_window)); // m_states.emplace_back(new MenuState(m_window, OPTION_START | OPTION_EXIT | OPTION_CREDITS | OPTION_HELP)); }
void LoggerConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_LOGGERCONFIGPANEL") : _T("IDR_XML_LOGGERCONFIGPANEL_L")); const ComputerSettings &settings_computer = CommonInterface::GetComputerSettings(); const Plane &plane = settings_computer.plane; LoadFormProperty(form, _T("prpLoggerTimeStepCruise"), settings_computer.logger_time_step_cruise); LoadFormProperty(form, _T("prpLoggerTimeStepCircling"), settings_computer.logger_time_step_circling); LoadFormPropertyFromProfile(form, _T("PilotName"), szProfilePilotName); LoadFormProperty(form, _T("AircraftType"), plane.type); LoadFormProperty(form, _T("AircraftReg"), plane.registration); LoadFormProperty(form, _T("CompetitionID"), plane.competition_id); LoadFormPropertyFromProfile(form, _T("LoggerID"), szProfileLoggerID); LoadFormProperty(form, _T("prpLoggerShortName"), settings_computer.logger_short_name); LoadFormProperty(form, _T("prpDisableAutoLogger"), !settings_computer.auto_logger_disabled); }
void PolarConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; loading = true; LoadWindow(polar_callbacks, parent, Layout::landscape ? _T("IDR_XML_POLARCONFIGPANEL_L") : _T("IDR_XML_POLARCONFIGPANEL")); buttonList = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdLoadInternalPolar")); assert(buttonList != NULL); buttonList->SetOnClickNotify(OnLoadInternal); buttonImport = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdLoadPolarFile")); assert(buttonImport != NULL); buttonImport->SetOnClickNotify(OnLoadFromFile); buttonExport = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdSavePolarFile")); assert(buttonExport != NULL); buttonExport->SetOnClickNotify(OnExport); SetLiftFieldStepAndMax(_T("prpPolarW1")); SetLiftFieldStepAndMax(_T("prpPolarW2")); SetLiftFieldStepAndMax(_T("prpPolarW3")); const ComputerSettings &settings = XCSoarInterface::GetComputerSettings(); UpdatePolarPoints(settings.plane.v1, settings.plane.v2, settings.plane.v3, settings.plane.w1, settings.plane.w2, settings.plane.w3); LoadFormProperty(form, _T("prpPolarReferenceMass"), settings.plane.reference_mass); LoadFormProperty(form, _T("prpPolarDryMass"), settings.plane.dry_mass); LoadFormProperty(form, _T("prpPolarMaxBallast"), settings.plane.max_ballast); LoadFormProperty(form, _T("prpPolarWingArea"), settings.plane.wing_area); LoadFormProperty(form, _T("prpMaxManoeuveringSpeed"), ugHorizontalSpeed, settings.plane.max_speed); UpdatePolarTitle(); UpdatePolarInvalidLabel(); const ComputerSettings &settings_computer = XCSoarInterface::GetComputerSettings(); LoadFormProperty(form, _T("prpHandicap"), settings_computer.plane.handicap); LoadFormProperty(form, _T("prpBallastSecsToEmpty"), settings_computer.plane.dump_time); loading = false; }
void PolarConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; loading = true; LoadWindow(polar_callbacks, parent, Layout::landscape ? _T("IDR_XML_POLARCONFIGPANEL_L") : _T("IDR_XML_POLARCONFIGPANEL")); buttonList = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdLoadInternalPolar")); assert(buttonList != NULL); buttonList->SetOnClickNotify(OnLoadInternal); buttonImport = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdLoadPolarFile")); assert(buttonImport != NULL); buttonImport->SetOnClickNotify(OnLoadFromFile); buttonExport = (WndButton *)ConfigPanel::GetForm() .FindByName(_T("cmdSavePolarFile")); assert(buttonExport != NULL); buttonExport->SetOnClickNotify(OnExport); const ComputerSettings &settings = CommonInterface::GetComputerSettings(); DockWindow &dock = *(DockWindow *)form.FindByName(_T("shape")); PolarShapeEditWidget *shape_editor = new PolarShapeEditWidget(settings.plane.polar_shape); dock.SetWidget(shape_editor); shape_editor->SetDataAccessCallback(OnFieldData); LoadFormProperty(form, _T("prpPolarReferenceMass"), settings.plane.reference_mass); LoadFormProperty(form, _T("prpPolarDryMass"), settings.plane.dry_mass); LoadFormProperty(form, _T("prpPolarMaxBallast"), settings.plane.max_ballast); LoadFormProperty(form, _T("prpPolarWingArea"), settings.plane.wing_area); LoadFormProperty(form, _T("prpMaxManoeuveringSpeed"), UnitGroup::HORIZONTAL_SPEED, settings.plane.max_speed); UpdatePolarTitle(); UpdatePolarInvalidLabel(); const ComputerSettings &settings_computer = CommonInterface::GetComputerSettings(); LoadFormProperty(form, _T("prpHandicap"), settings_computer.plane.handicap); LoadFormProperty(form, _T("prpBallastSecsToEmpty"), settings_computer.plane.dump_time); loading = false; }
void TaskRulesConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_TASKRULESCONFIGPANEL_L") : _T("IDR_XML_TASKRULESCONFIGPANEL")); const ComputerSettings &settings_computer = XCSoarInterface::GetComputerSettings(); const TaskBehaviour &task_behaviour = settings_computer.task; LoadFormProperty(form, _T("prpStartMaxSpeed"), ugHorizontalSpeed, task_behaviour.ordered_defaults.start_max_speed); LoadFormProperty(form, _T("prpStartMaxSpeedMargin"), ugHorizontalSpeed, task_behaviour.start_max_speed_margin); static gcc_constexpr_data StaticEnumChoice start_max_height_ref_list[] = { { hrAGL, N_("AGL"), N_("Reference AGL for start maximum height rule (above start point)") }, { hrMSL, N_("MSL"), N_("Reference MSL for start maximum height rule (above sea level)") }, { 0 } }; LoadFormProperty(form, _T("prpStartHeightRef"), start_max_height_ref_list, task_behaviour.ordered_defaults.start_max_height_ref); LoadFormProperty(form, _T("prpStartMaxHeight"), ugAltitude, task_behaviour.ordered_defaults.start_max_height); LoadFormProperty(form, _T("prpStartMaxHeightMargin"), ugAltitude, task_behaviour.start_max_height_margin); static gcc_constexpr_data StaticEnumChoice finish_min_height_ref_list[] = { { hrAGL, N_("AGL"), N_("Reference AGL for finish minimum height rule (above finish point)") }, { hrMSL, N_("MSL"), N_("Reference MSL for finish minimum height rule (above sea level)") }, { 0 } }; LoadFormProperty(form, _T("prpFinishHeightRef"), finish_min_height_ref_list, task_behaviour.ordered_defaults.finish_min_height_ref); LoadFormProperty(form, _T("prpFinishMinHeight"), ugAltitude, task_behaviour.ordered_defaults.finish_min_height); const StaticEnumChoice contests_list[] = { { OLC_FAI, ContestToString(OLC_FAI) }, { OLC_Classic, ContestToString(OLC_Classic) }, { OLC_League, ContestToString(OLC_League) }, { OLC_Plus, ContestToString(OLC_Plus) }, { OLC_XContest, ContestToString(OLC_XContest) }, { OLC_DHVXC, ContestToString(OLC_DHVXC) }, { OLC_SISAT, ContestToString(OLC_SISAT) }, { 0 } }; LoadFormProperty(form, _T("prpContests"), contests_list, task_behaviour.contest); }
Window* InfoBoxContentWind::PnlEditLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); InfoBoxID = id; Window *wInfoBoxAccessEdit = LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXWINDEDIT")); assert(wInfoBoxAccessEdit); return wInfoBoxAccessEdit; }
void TaskPropertiesPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(task_properties_callbacks, parent, Layout::landscape ? _T("IDR_XML_TASKPROPERTIES_L") : _T("IDR_XML_TASKPROPERTIES")); wTaskView = (WndOwnerDrawFrame*)form.FindByName(_T("frmTaskViewProperties")); assert(wTaskView != NULL); wTaskView->SetOnMouseDownNotify(dlgTaskManager::OnTaskViewClick); InitView(); }
Window* InfoBoxContentWind::PnlSetupLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); InfoBoxID = id; Window *wInfoBoxAccessSetup = LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXWINDSETUP")); assert(wInfoBoxAccessSetup); const NMEAInfo &basic = XCSoarInterface::Basic(); const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer(); const bool external_wind = basic.external_wind_available && settings_computer.ExternalWind; WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpAutoWind")); if (external_wind) { wp->set_enabled(false); DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); df.addEnumText(_("External")); df.Set(0); wp->RefreshDisplay(); } else { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Manual")); dfe->addEnumText(_("Circling")); dfe->addEnumText(_("ZigZag")); dfe->addEnumText(_("Both")); dfe->Set(settings_computer.AutoWindMode); wp->RefreshDisplay(); } wp = (WndProperty*)dlgInfoBoxAccess::GetWindowForm()->FindByName(_T("prpTrailDrift")); if (wp) { DataFieldBoolean &df = *(DataFieldBoolean *)wp->GetDataField(); df.Set(XCSoarInterface::SettingsMap().EnableTrailDrift); wp->RefreshDisplay(); } return wInfoBoxAccessSetup; }
Window* InfoBoxContentMacCready::PnlEditLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); // wf = _wf; InfoBoxID = id; Window *wInfoBoxAccessEdit = LoadWindow(dlgContent.CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXMACCREADYEDIT")); assert(wInfoBoxAccessEdit); return wInfoBoxAccessEdit; }
Window* InfoBoxContentAltitude::PnlInfoLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); // wf = _wf; InfoBoxID = id; Window *wInfoBoxAccessInfo = LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXALTITUDEINFO")); assert(wInfoBoxAccessInfo); wf->SetTimerNotify(OnTimerNotify); return wInfoBoxAccessInfo; }
Window* InfoBoxContentAltitude::PnlSimulatorLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); if (!is_simulator()) return NULL; InfoBoxID = id; Window *wInfoBoxAccessSimulator = LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXALTITUDESIMULATOR")); assert(wInfoBoxAccessSimulator); return wInfoBoxAccessSimulator; }
Window* InfoBoxContentAltitude::PnlSetupLoad(SingleWindow &parent, TabBarControl* wTabBar, WndForm* wf, const int id) { assert(wTabBar); assert(wf); // wf = _wf; InfoBoxID = id; Window *wInfoBoxAccessSetup = LoadWindow(CallBackTable, wf, *wTabBar, _T("IDR_XML_INFOBOXALTITUDESETUP")); assert(wInfoBoxAccessSetup); LoadFormProperty(*wf, _T("prpQNH"), CommonInterface::SettingsComputer().pressure.GetQNH()); return wInfoBoxAccessSetup; }
void TaskEditPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { ordered_task = *ordered_task_pointer;; LoadWindow(task_edit_callbacks, parent, rc, _T("IDR_XML_TASKEDIT")); instance = this; wTaskPoints = (ListControl*)form.FindByName(_T("frmTaskPoints")); assert(wTaskPoints != NULL); wSummary = (WndFrame *)form.FindByName(_T("frmSummary")); assert(wSummary); UPixelScalar line_height = wf.GetLook().list.font->GetHeight() + Layout::Scale(6) + wf.GetLook().small_font->GetHeight(); wTaskPoints->SetItemHeight(line_height); wTaskPoints->SetHandler(this); }
void TimeConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(CallBackTable, parent, Layout::landscape ? _T("IDR_XML_TIMECONFIGPANEL") : _T("IDR_XML_TIMECONFIGPANEL_L")); loading = true; int utc_offset = XCSoarInterface::GetComputerSettings().utc_offset; LoadFormProperty(form, _T("prpUTCOffset"), fixed(iround(fixed(utc_offset) / 1800)) / 2); #ifdef WIN32 if (IsEmbedded() && !IsAltair()) ((WndProperty*)form.FindByName(_T("prpUTCOffset")))->set_enabled(false); #endif SetLocalTime(utc_offset); loading = false; }
void InfoBoxesConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_INFOBOXESCONFIGPANEL") : _T("IDR_XML_INFOBOXESCONFIGPANEL_L")); const InfoBoxSettings &settings = CommonInterface::GetUISettings().info_boxes; for (unsigned i = 0; i < InfoBoxSettings::MAX_PANELS; i++) { const InfoBoxSettings::Panel &data = settings.panels[i]; StaticString<32> buffer; buffer.Format(_T("cmdInfoBoxesPanel%u"), i); buttons[i] = (WndButton*) form.FindByName(buffer); if (buttons[i]) { buttons[i]->SetOnClickNotify(::OnInfoBoxesButton); buttons[i]->SetCaption(gettext(data.name)); } } }
void COFSNcDlg2::LoadSkin() { CComPtr<IXMLDOMDocument> pDoc = NULL; CComPtr<IXMLDOMNode> pRoot = NULL; LoadSkinXML(&pDoc, &pRoot); if(pRoot) { CRect r, rMin, rMax; r.SetRectEmpty(); rMin.SetRectEmpty(); rMax.SetRectEmpty(); LoadWindow(pRoot, r, rMin, rMax); // SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER); LoadColors(pRoot); LoadPictures(pRoot); LoadSkin(pRoot); SetMinTrackSize(rMin.Size()); if(!rMax.IsRectEmpty()) SetMaxTrackSize(rMax.Size()); } }
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR pCommandLine,int iCmdShow) { int iHeight = 800; int iWidth = 1000; //sets time stuff //_tzset(); try { //Register Window class and create window LoadWindow(hInstance,iHeight,iWidth,g_pWindowName); //todo: read config file //read User and Nick from it and toss it to the MainWindow Creation //then read all the other config things and figure out where the f**k to toss them? g_pMainWindow = new MainWindow(g_pInstance,g_pWindow); g_pMainWindow->InitProgram(); }catch(int e) { // printf(e.what()); char pBuffer[50] = {0}; snprintf(pBuffer,50,"Error %i. Terminating program.",e); MessageBox(NULL,pBuffer,"Error!",5); } return 0; }
void TaskClosePanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(task_close_callbacks, parent, Layout::landscape ? _T("IDR_XML_TASKMANAGERCLOSE_L") : _T("IDR_XML_TASKMANAGERCLOSE")); wTaskView = (WndOwnerDrawFrame *)form.FindByName(_T("frmTaskViewClose")); assert(wTaskView != NULL); wTaskView->SetOnMouseDownNotify(dlgTaskManager::OnTaskViewClick); wStatus = (WndFrame *)form.FindByName(_T("frmStatus")); assert(wStatus); cmdRevert = (WndButton *)form.FindByName(_T("cmdRevert")); assert(cmdRevert); cmdClose = (WndButton *)form.FindByName(_T("cmdClose")); assert(cmdClose); wStatus->SetAlignCenter(); }
void TW_Close_Window(void) { if (TW_anz_fenster>-1) { /* TM_Prot(); */ LoadWindow(fenster[TW_anz_fenster].adr, (char)(fenster[TW_anz_fenster].x-1), (char)(fenster[TW_anz_fenster].y-1), (char)(fenster[TW_anz_fenster].br+2), (char)(fenster[TW_anz_fenster].ho+2)); TW_anz_fenster--; if (TW_anz_fenster<0) _settextwindow(1,1,25,80); else _settextwindow((short)(fenster[TW_anz_fenster].y), (short)(fenster[TW_anz_fenster].x), (short)(fenster[TW_anz_fenster].y+ fenster[TW_anz_fenster].ho-1), (short)(fenster[TW_anz_fenster].x+ fenster[TW_anz_fenster].br-1)); } /* TM_Prot(); */ }
MainWindow::MainWindow( os::String zPath ) : os::Window( os::Rect( 0, 0, 500, 400 ), "main_wnd", MSG_MAINWND_TITLE ) { SetTitle( zPath ); CenterInScreen(); /* Create toolbar */ m_pcToolBar = new os::ToolBar( os::Rect( 0, 0, GetBounds().Width(), 40 ), "" ); os::HLayoutNode* pcNode = new os::HLayoutNode( "h_root" ); pcNode->SetBorders( os::Rect( 0, 4, 5, 4 ) ); os::ImageButton* pcBreaker = new os::ImageButton(os::Rect(), "breaker", "",NULL,NULL, os::ImageButton::IB_TEXT_BOTTOM,false,false,false); SetButtonImageFromResource( pcBreaker, "breaker.png" ); pcNode->AddChild( pcBreaker, 0.0f ); m_pcBackButton = new os::ImageButton( os::Rect(), "back", "",new os::Message( M_BACK ) ,NULL, os::ImageButton::IB_TEXT_BOTTOM, true, false, true ); m_pcBackButton->SetEnable( false ); SetButtonImageFromResource( m_pcBackButton, "back.png" ); pcNode->AddChild( m_pcBackButton, 0.0f ); os::ImageButton* pcUp = new os::ImageButton( os::Rect(), "up", "",new os::Message( M_UP ) ,NULL, os::ImageButton::IB_TEXT_BOTTOM, true, false, true ); SetButtonImageFromResource( pcUp, "up.png" ); pcNode->AddChild( pcUp, 0.0f ); os::ImageButton* pcReload = new os::ImageButton( os::Rect(), "reload", "",new os::Message( M_RELOAD ) ,NULL, os::ImageButton::IB_TEXT_BOTTOM, true, false, true ); SetButtonImageFromResource( pcReload, "reload.png" ); pcNode->AddChild( pcReload, 0.0f ); os::ImageButton* pcHome = new os::ImageButton( os::Rect(), "home", "",new os::Message( M_HOME ) ,NULL, os::ImageButton::IB_TEXT_BOTTOM, true, false, true ); SetButtonImageFromResource( pcHome, "home.png" ); pcNode->AddChild( pcHome, 0.0f ); pcNode->AddChild( new os::HLayoutSpacer( "" ) ); /* Create popupmenu */ os::Menu* pcPopupMenu = new os::Menu( os::Rect(), "", os::ITEMS_IN_COLUMN ); pcPopupMenu->AddItem( MSG_MENU_VIEW_ICONS, new os::Message( M_VIEW_ICONS ) ); pcPopupMenu->AddItem( MSG_MENU_VIEW_LIST, new os::Message( M_VIEW_LIST ) ); pcPopupMenu->AddItem( MSG_MENU_VIEW_DETAILS, new os::Message( M_VIEW_DETAILS ) ); pcPopupMenu->AddItem( new os::MenuSeparator() ); pcPopupMenu->AddItem( MSG_MENU_VIEW_SAVE, new os::Message( M_SAVE_WINDOW ) ); pcPopupMenu->AddItem( MSG_MENU_VIEW_SAVE_DEFAULT, new os::Message( M_SAVE_DEFAULT ) ); pcPopupMenu->SetTargetForItems( this ); os::BitmapImage* pcView = new os::BitmapImage(); os::File cSelf( open_image_file( get_image_id() ) ); os::Resources cCol( &cSelf ); os::ResStream *pcStream = cCol.GetResourceStream( "view.png" ); pcView->Load( pcStream ); delete( pcStream ); m_pcViewMenu = new os::PopupMenu( os::Rect( GetBounds().Width() - 70, 2, GetBounds().Width() - 5, 32 ), "", MSG_MENU_VIEW, pcPopupMenu, pcView, os::CF_FOLLOW_RIGHT | os::CF_FOLLOW_RIGHT ); pcNode->AddChild( m_pcViewMenu ); /* Create icon view */ m_pcView = new os::IconDirectoryView( os::Rect( 0, 41, GetBounds().Width(), GetBounds().Height() ), zPath, os::CF_FOLLOW_ALL ); m_pcView->SetDirChangeMsg( new os::Message( M_CHANGE_DIR ) ); os::BitmapImage* pcDirIcon = static_cast<os::BitmapImage*>(m_pcView->GetDirIcon()); pcDirIcon->SetSize( os::Point( 24, 24 ) ); SetIcon( pcDirIcon->LockBitmap() ); delete( pcDirIcon ); m_cBackStack.push( zPath ); m_pcToolBar->SetRoot( pcNode ); AddChild( m_pcToolBar ); AddChild( m_pcView ); m_pcView->MakeFocus(); /* Load default folder style & window position; this will be overridden later by folder-specific settings, if any */ LoadDefault(); LoadWindow( false ); /* Load folder's saved style, window position */ m_pcView->ReRead(); }
void MainWindow::HandleMessage( os::Message* pcMessage ) { switch( pcMessage->GetCode() ) { case M_CHANGE_DIR: { os::String zPath; if( pcMessage->FindString( "file/path", &zPath.str() ) != 0 ) break; m_pcView->SetPath( zPath ); m_pcView->Clear(); LoadWindow( true ); m_pcView->ReRead(); /* Get the new directory icon */ os::BitmapImage* pcImage = static_cast<os::BitmapImage*>(m_pcView->GetDirIcon()); if( pcImage ) { pcImage->SetSize( os::Point( 24, 24 ) ); SetIcon( pcImage->LockBitmap() ); delete( pcImage ); } SetTitle( m_pcView->GetPath() ); m_cBackStack.push( m_pcView->GetPath() ); if( m_cBackStack.size() > 1 ) m_pcBackButton->SetEnable( true ); else m_pcBackButton->SetEnable( false ); break; } case M_BACK: { if( m_cBackStack.size() > 1 ) { m_cBackStack.pop(); os::String cNewPath = m_cBackStack.top(); m_cBackStack.pop(); os::Message* pcMsg = new os::Message( M_CHANGE_DIR ); pcMsg->AddString( "file/path", cNewPath ); PostMessage( pcMsg, this ); delete( pcMsg ); } break; } case M_UP: { os::Message* pcMsg = new os::Message( M_CHANGE_DIR ); os::Path cPath( m_pcView->GetPath().c_str() ); pcMsg->AddString( "file/path", cPath.GetDir().GetPath() ); PostMessage( pcMsg, this ); delete( pcMsg ); break; } case M_HOME: { const char *pzHome = getenv( "HOME" ); os::Message* pcMsg = new os::Message( M_CHANGE_DIR ); pcMsg->AddString( "file/path", pzHome ); PostMessage( pcMsg, this ); delete( pcMsg ); break; } case M_RELOAD: { m_pcView->ReRead(); break; } case M_VIEW_ICONS: { m_pcView->SetView( os::IconDirectoryView::VIEW_ICONS ); m_pcView->ReRead(); /* ReRead after view change to ensure that correct-sized icons are used */ break; } case M_VIEW_LIST: { m_pcView->SetView( os::IconDirectoryView::VIEW_LIST ); m_pcView->ReRead(); break; } case M_VIEW_DETAILS: { m_pcView->SetView( os::IconDirectoryView::VIEW_DETAILS ); m_pcView->ReRead(); break; } case M_SAVE_WINDOW: { SaveWindow(); break; } case M_SAVE_DEFAULT: { SaveDefault(); break; } case M_APP_QUIT: { OkToQuit(); break; } break; } }
void AltitudeSimulatorPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { LoadWindow(CallBackTable, parent, _T("IDR_XML_INFOBOXALTITUDESIMULATOR")); }