bool dlgTaskPointShowModal(SingleWindow &parent, OrderedTask** task, const unsigned index) { ordered_task = *task; task_modified = false; active_index = index; wf = LoadDialog(CallBackTable, parent, Layout::landscape ? _T("IDR_XML_TASKPOINT_L") : _T("IDR_XML_TASKPOINT")); assert(wf != NULL); wTaskView = (WndFrame*)wf->FindByName(_T("frmTaskView")); assert(wTaskView != NULL); WndFrame* wType = (WndFrame*) wf->FindByName(_T("lblType")); assert (wType); wType->SetFont(Fonts::MapBold); WndFrame* wLocation = (WndFrame*) wf->FindByName(_T("lblLocation")); assert (wLocation); wLocation->SetFont(Fonts::MapBold); do { RefreshView(); next_previous=0; if (wf->ShowModal() == mrOK) ReadValues(); active_index += next_previous; } while (next_previous != 0); delete wf; if (*task != ordered_task) { *task = ordered_task; task_modified = true; } if (task_modified) { ordered_task->update_geometry(); } return task_modified; }
static void RefreshFonts() { WndProperty * wp; wp = (WndProperty*)wf->FindByName(_T("prpUseCustomFonts")); if (wp) { bool bUseCustomFonts = ((DataFieldBoolean*)(wp->GetDataField()))->GetAsBoolean(); ResetFonts(bUseCustomFonts); ShowFontEditButtons(bUseCustomFonts); } // now set SampleTexts on the Fonts frame WndFrame *sample; sample = (WndFrame *)wf->FindByName(_T("prpInfoWindowFont")); if (sample) sample->SetFont(TempInfoWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpTitleWindowFont")); if (sample) sample->SetFont(TempTitleWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapWindowFont")); if (sample) sample->SetFont(TempMapWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpTitleSmallWindowFont")); if (sample) sample->SetFont(TempTitleSmallWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapWindowBoldFont")); if (sample) sample->SetFont(TempMapWindowBoldFont); sample = (WndFrame *)wf->FindByName(_T("prpCDIWindowFont")); if (sample) sample->SetFont(TempCDIWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapLabelFont")); if (sample) sample->SetFont(TempMapLabelFont); sample = (WndFrame *)wf->FindByName(_T("prpMapLabelImportantFont")); if (sample) sample->SetFont(TempMapLabelImportantFont); // now fix the rest of the dlgConfiguration fonts: wf->SetTitleFont(TempMapWindowBoldFont); }
static void RedrawSampleFont(void) { GetLogFont(NewLogFont); #ifdef ENABLE_SDL // XXX #else /* !ENABLE_SDL */ NewFont.set(NewLogFont); #endif /* !ENABLE_SDL */ WndFrame *wp = (WndFrame *)wf->FindByName(_T("prpFontSample")); if (wp) { if (NewFont.defined()) { wp->SetFont(NewFont); wp->SetCaption(_("Sample Text\n123")); } else { wp->SetCaption(_("Font not found.")); } } }
/** * Displays a MessageBox and returns the pressed button * @param lpText Text displayed inside the MessageBox * @param lpCaption Text displayed in the Caption of the MessageBox * @param uType Type of MessageBox to display (OK+Cancel, Yes+No, etc.) * @return */ int WINAPI MessageBoxX(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) { WndForm *wf = NULL; WndFrame *wText = NULL; int X, Y, Width, Height; WndButton *wButtons[10]; int ButtonCount = 0; int i, x, y, d, w, h, res, dY; RECT rc; assert(lpText != NULL); assert(lpCaption != NULL); // JMW this makes the first key if pressed quickly, ignored // TODO bug: doesn't work sometimes. buttons have to be pressed multiple times (TB) XCSoarInterface::Debounce(); rc = XCSoarInterface::main_window.get_screen_position(); #ifdef ALTAIRSYNC Width = Layout::Scale(220); Height = Layout::Scale(160); #else Width = Layout::Scale(200); Height = Layout::Scale(160); #endif X = ((rc.right - rc.left) - Width) / 2; Y = ((rc.bottom - rc.top) - Height) / 2; y = Layout::Scale(100); w = Layout::Scale(60); h = Layout::Scale(32); // Create dialog wf = new WndForm(&XCSoarInterface::main_window, _T("frmXcSoarMessageDlg"), lpCaption, X, Y, Width, Height); wf->SetFont(MapWindowBoldFont); wf->SetTitleFont(MapWindowBoldFont); wf->SetBackColor(Color(0xDA, 0xDB, 0xAB)); // Create text element wText = new WndFrame(wf, _T("frmMessageDlgText"), 0, Layout::Scale(5), Width, Height); wText->SetCaption(lpText); wText->SetFont(MapWindowBoldFont); wText->SetCaptionStyle(DT_EXPANDTABS | DT_CENTER | DT_NOCLIP | DT_WORDBREAK); // | DT_VCENTER /* TODO code: this doesnt work to set font height dY = wText->GetLastDrawTextHeight() - Height; */ dY = Layout::Scale(-40); wText->resize(Width, wText->GetTextHeight() + 5); wf->resize(Width, wf->get_size().cy + dY); y += dY; // Create buttons uType = uType & 0x000f; if (uType == MB_OK || uType == MB_OKCANCEL) { wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("OK")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDOK); ButtonCount++; } if (uType == MB_YESNO || uType == MB_YESNOCANCEL) { wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("Yes")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDYES); ButtonCount++; wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("No")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDNO); ButtonCount++; } if (uType == MB_ABORTRETRYIGNORE || uType == MB_RETRYCANCEL) { wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("Retry")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDRETRY); ButtonCount++; } if (uType == MB_OKCANCEL || uType == MB_RETRYCANCEL || uType == MB_YESNOCANCEL) { wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("Cancel")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDCANCEL); ButtonCount++; } if (uType == MB_ABORTRETRYIGNORE) { wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("Abort")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDABORT); ButtonCount++; wButtons[ButtonCount] = new WndButton(wf, _T(""), gettext(_T("Ignore")), 0, y, w, h, OnButtonClick); wButtons[ButtonCount]->SetTag(IDIGNORE); ButtonCount++; } d = Width / (ButtonCount); x = d / 2 - w / 2; // Move buttons to the right positions for (i = 0; i < ButtonCount; i++) { wButtons[i]->move(x, y); x += d; } // Show MessageBox and save result res = wf->ShowModal(); delete wf; #ifdef ALTAIRSYNC // force a refresh of the window behind InvalidateRect(hWnd,NULL,true); UpdateWindow(hWnd); #endif return(res); }