int CGUIDialogYesNo::ShowAndGetInput(const KODI::MESSAGING::HELPERS::DialogYesNoMessage& options) { //Set default yes/no labels, these might be overwritten further down if specified //by the caller SetChoice(0, 106); SetChoice(1, 107); if (!options.heading.isNull()) SetHeading(options.heading); if (!options.text.isNull()) SetText(options.text); if (!options.noLabel.isNull()) SetChoice(0, options.noLabel); if (!options.yesLabel.isNull()) SetChoice(1, options.yesLabel); if (options.autoclose > 0) SetAutoClose(options.autoclose); m_bCanceled = false; for (size_t i = 0; i < 3; ++i) { if (!options.lines[i].isNull()) SetLine(i, options.lines[i]); } Open(); if (m_bCanceled) return -1; return IsConfirmed() ? 1 : 0; }
static void update_axisbar_items(int gno) { tickmarks t; if (axisbar_frame) { get_graph_tickmarks(gno, &t, curaxis); SetChoice(barcolor, t.t_drawbarcolor); SetChoice(barlinew, t.t_drawbarlinew - 1); SetChoice(barlines, t.t_drawbarlines - 1); } }
bool COptionsPageFilelists::LoadPage() { bool failure = false; SetChoice(XRCID("ID_SORTMODE"), m_pOptions->GetOptionVal(OPTION_FILELIST_DIRSORT), failure); SetTextFromOption(XRCID("ID_COMPARISON_THRESHOLD"), OPTION_COMPARISON_THRESHOLD, failure); SetChoice(XRCID("ID_DOUBLECLICK_FILE"), m_pOptions->GetOptionVal(OPTION_DOUBLECLICK_ACTION_FILE), failure); SetChoice(XRCID("ID_DOUBLECLICK_DIRECTORY"), m_pOptions->GetOptionVal(OPTION_DOUBLECLICK_ACTION_DIRECTORY), failure); return !failure; }
void update_nonl_frame(void) { int i; if (nonl_frame) { XmString str = XmStringCreateSimple(nonl_opts.title); XtVaSetValues(nonl_title_item, XmNlabelString, str, NULL); /* * If I define only XmALIGNMENT_CENTER (default!) then it's ignored - bug in Motif??? */ XtVaSetValues(nonl_title_item, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XtVaSetValues(nonl_title_item, XmNalignment, XmALIGNMENT_CENTER, NULL); XmStringFree(str); xv_setstr(nonl_formula_item, nonl_opts.formula); sprintf(buf, "%g", nonl_opts.tolerance); xv_setstr(nonl_tol_item, buf); SetChoice(nonl_nparm_item, nonl_opts.parnum); for (i = 0; i < MAXPARM; i++) { sprintf(buf, "%g", nonl_parms[i].value); xv_setstr(nonl_value_item[i], buf); XmToggleButtonSetState(nonl_constr_item[i], nonl_parms[i].constr, False); sprintf(buf, "%g", nonl_parms[i].min); xv_setstr(nonl_lowb_item[i], buf); XtSetSensitive(nonl_lowb_item[i], nonl_parms[i].constr); sprintf(buf, "%g", nonl_parms[i].max); xv_setstr(nonl_uppb_item[i], buf); XtSetSensitive(nonl_uppb_item[i], nonl_parms[i].constr); if (i < nonl_opts.parnum) { if (!XtIsManaged (nonl_parm_item[i])) { XtManageChild(nonl_parm_item[i]); } } else { if (XtIsManaged (nonl_parm_item[i])) { XtUnmanageChild(nonl_parm_item[i]); } } } XmToggleButtonSetState(nonl_autol_item, nonl_prefs.autoload, False); for (i = 0; i < 3; i++) { XmToggleButtonSetState(nonl_load_item[i], False, False); } XmToggleButtonSetState(nonl_load_item[nonl_prefs.load], True, False); if (nonl_prefs.load == LOAD_FUNCTION) { XtSetSensitive(nonl_fload_rc, True); } else { XtSetSensitive(nonl_fload_rc, False); } sprintf(buf, "%g", nonl_prefs.start); xv_setstr(nonl_start_item, buf); sprintf(buf, "%g", nonl_prefs.stop); xv_setstr(nonl_stop_item, buf); sprintf(buf, "%d", nonl_prefs.npoints); xv_setstr(nonl_npts_item, buf); } }
ComboBox::ComboBox (const std::string &label, const std::string &resource_id, const Point2i &_size, const std::vector<std::pair<std::string, std::string> > &choices, const std::string choice) : m_choices(choices) , m_index(0) { position = Point2i(-1, -1); size = _size; Profile *res = GetResourceManager().LoadXMLProfile("graphism.xml", false); torus = new TorusCache(res, resource_id, BIG_R, SMALL_R); txt_label = new Text(label, dark_gray_color, Font::FONT_SMALL, Font::FONT_BOLD, false); txt_label->SetMaxWidth(GetSizeX()); txt_value_black = new Text("", black_color, Font::FONT_MEDIUM, Font::FONT_BOLD, false); txt_value_white = new Text("", white_color, Font::FONT_MEDIUM, Font::FONT_BOLD, false); std::vector<std::string>::size_type index = 0; for (std::vector<std::pair<std::string, std::string> >::const_iterator iter = choices.begin (); iter != choices.end (); iter++) { if (iter->first == choice) m_index = index; index++; } SetChoice(m_index); }
static void update_props(EditPoints * ep) { int col; short *widths; Widget matrix = ep->mw; col = GetChoice(editp_col_item); if( col==6 ) col = 0; XtVaGetValues(matrix, XmNcolumnWidths, &widths, NULL); SetChoice(editp_format_item, ep->cformat[col]); SetChoice(editp_precision_item, ep->cprec[col]); SetChoice(editp_width_item, ep->cwidth[col] - 1); }
Widget* ComboBox::ClickUp(const Point2i &mousePosition, uint button) { NeedRedrawing(); bool is_click = Mouse::IS_CLICK_BUTTON(button); if ( (is_click && mousePosition.x > (GetPositionX() + GetSizeX()/2)) || button == SDL_BUTTON_WHEELUP ) { SetChoice(m_index + 1); return this; } else if ( (is_click && mousePosition.x <= (GetPositionX() + GetSizeX()/2)) || button == SDL_BUTTON_WHEELDOWN ) { SetChoice(m_index - 1); return this; } return NULL; }
bool COptionsPageDebug::LoadPage() { bool failure = false; SetCheck(XRCID("ID_DEBUGMENU"), m_pOptions->GetOptionVal(OPTION_DEBUG_MENU) ? true : false, failure); SetChoice(XRCID("ID_DEBUGLEVEL"), m_pOptions->GetOptionVal(OPTION_LOGGING_DEBUGLEVEL), failure); SetCheck(XRCID("ID_RAWLISTING"), m_pOptions->GetOptionVal(OPTION_LOGGING_RAWLISTING) ? true : false, failure); return !failure; }
bool COptionsPageInterface::LoadPage() { bool failure = false; SetCheckFromOption(XRCID("ID_FILEPANESWAP"), OPTION_FILEPANE_SWAP, failure); SetChoice(XRCID("ID_FILEPANELAYOUT"), m_pOptions->GetOptionVal(OPTION_FILEPANE_LAYOUT), failure); SetChoice(XRCID("ID_MESSAGELOGPOS"), m_pOptions->GetOptionVal(OPTION_MESSAGELOG_POSITION), failure); #ifndef __WXMAC__ SetCheckFromOption(XRCID("ID_MINIMIZE_TRAY"), OPTION_MINIMIZE_TRAY, failure); #endif SetCheckFromOption(XRCID("ID_PREVENT_IDLESLEEP"), OPTION_PREVENT_IDLESLEEP, failure); SetCheckFromOption(XRCID("ID_SPEED_DISPLAY"), OPTION_SPEED_DISPLAY, failure); if (!CPowerManagement::IsSupported()) XRCCTRL(*this, "ID_PREVENT_IDLESLEEP", wxCheckBox)->Hide(); if (m_pOptions->OptionFromFzDefaultsXml(OPTION_DEFAULT_KIOSKMODE) || m_pOptions->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2) { XRCCTRL(*this, "ID_DONT_SAVE_PASSWORDS", wxCheckBox)->SetValue(true); XRCCTRL(*this, "ID_DONT_SAVE_PASSWORDS", wxCheckBox)->Disable(); } else SetCheckFromOption(XRCID("ID_DONT_SAVE_PASSWORDS"), OPTION_DEFAULT_KIOSKMODE, failure); SetCheckFromOption(XRCID("ID_INTERFACE_SITEMANAGER_ON_STARTUP"), OPTION_INTERFACE_SITEMANAGER_ON_STARTUP, failure); // Start of @td SetCheckFromOption(XRCID("ID_ENCRYPT_PASSWORDS"), OPTION_ENCRYPT_PASSWORDS, failure); wxString stars = wxString(DEFAULTVALUE, wxConvUTF8); SetText(XRCID("ID_MASTER_PASSWORD"), stars, failure); // @TODO : Better display... // End of @td if (!failure) { SetCtrlState(); } return !failure; }
bool COptionsPageInterface::LoadPage() { bool failure = false; SetCheckFromOption(XRCID("ID_FILEPANESWAP"), OPTION_FILEPANE_SWAP, failure); SetChoice(XRCID("ID_FILEPANELAYOUT"), m_pOptions->GetOptionVal(OPTION_FILEPANE_LAYOUT), failure); SetChoice(XRCID("ID_MESSAGELOGPOS"), m_pOptions->GetOptionVal(OPTION_MESSAGELOG_POSITION), failure); #ifndef __WXMAC__ SetCheckFromOption(XRCID("ID_MINIMIZE_TRAY"), OPTION_MINIMIZE_TRAY, failure); #endif SetCheckFromOption(XRCID("ID_PREVENT_IDLESLEEP"), OPTION_PREVENT_IDLESLEEP, failure); if (!CPowerManagement::IsSupported()) XRCCTRL(*this, "ID_PREVENT_IDLESLEEP", wxCheckBox)->Hide(); return !failure; }
static void update_axislabel_items(int gno) { Arg a; tickmarks t; int iv; char buf[128]; if (axislabel_frame) { get_graph_tickmarks(gno, &t, curaxis); SetChoice(axislabellayout, t.label_layout == LAYOUT_PERPENDICULAR ? 1 : 0); SetChoice(axislabelplace, t.label_place == TYPE_AUTO ? 0 : 1); sprintf(buf, "%.2f %.2f", t.label.x, t.label.y); xv_setstr(axislabelspec, buf); SetChoice(axislabelfont, t.label.font); SetChoice(axislabelcolor, t.label.color); SetChoice(axislabellinew, t.label.linew - 1); iv = (int) (100 * t.label.charsize); XtSetArg(a, XmNvalue, iv); XtSetValues(axislabelcharsize, &a, 1); } }
bool COptionsPageTransfer::LoadPage() { bool failure = false; SetTextFromOption(XRCID("ID_NUMTRANSFERS"), OPTION_NUMTRANSFERS, failure); SetTextFromOption(XRCID("ID_NUMDOWNLOADS"), OPTION_CONCURRENTDOWNLOADLIMIT, failure); SetTextFromOption(XRCID("ID_NUMUPLOADS"), OPTION_CONCURRENTUPLOADLIMIT, failure); SetTextFromOption(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT, failure); SetTextFromOption(XRCID("ID_DOWNLOADLIMIT"), OPTION_SPEEDLIMIT_INBOUND, failure); SetTextFromOption(XRCID("ID_UPLOADLIMIT"), OPTION_SPEEDLIMIT_OUTBOUND, failure); SetChoice(XRCID("ID_BURSTTOLERANCE"), m_pOptions->GetOptionVal(OPTION_SPEEDLIMIT_BURSTTOLERANCE), failure); return !failure; }
bool COptionsPageUpdateCheck::LoadPage() { bool failure = false; int sel; if (!m_pOptions->GetOptionVal(OPTION_UPDATECHECK)) sel = 0; else { int days = m_pOptions->GetOptionVal(OPTION_UPDATECHECK_INTERVAL); if (days <= 7) sel = 1; else if (days <= 14) sel = 2; else sel = 3; } SetChoice(XRCID("ID_UPDATECHECK"), sel, failure); SetChoice(XRCID("ID_UPDATETYPE"), (m_pOptions->GetOptionVal(OPTION_UPDATECHECK_CHECKBETA) != 0) ? 1 : 0, failure); return !failure; }
void update_ticks_items(int gno) { tickmarks t; if (ticks_frame) { SetChoice(editaxis, curaxis); get_graph_tickmarks(gno, &t, curaxis); XmToggleButtonSetState(tlonoff, t.tl_flag == TRUE, False); XmToggleButtonSetState(tonoff, t.t_flag == TRUE, False); XmToggleButtonSetState(baronoff, t.t_drawbar == TRUE, False); XmTextSetString(axislabel, t.label.s); if (islogx(gno) && (curaxis % 2 == 0)) { t.tmajor = (int) t.tmajor; if (t.tmajor == 0) { t.tmajor = 1; } sprintf(buf, "%.0f", t.tmajor); } else if (islogy(gno) && (curaxis % 2 == 1)) { t.tmajor = (int) t.tmajor; if (t.tmajor == 0) { t.tmajor = 1; } sprintf(buf, "%.0f", t.tmajor); } else if (t.tmajor > 0) { sprintf(buf, "%.5g", t.tmajor); } else { strcpy(buf, "UNDEFINED"); } XmTextSetString(tmajor, buf); if (islogx(gno) && (curaxis % 2 == 0)) { t.tminor = (int) t.tminor; if (t.tminor < 0 || t.tminor > 5) { t.tminor = 0; } sprintf(buf, "%.0f", t.tminor); } else if (islogy(gno) && (curaxis % 2 == 1)) { t.tminor = (int) t.tminor; if (t.tminor < 0 || t.tminor > 5) { t.tminor = 0; } sprintf(buf, "%.0f", t.tminor); } else if (t.tminor > 0) { sprintf(buf, "%.5g", t.tminor); } else { strcpy(buf, "UNDEFINED"); } XmTextSetString(tminor, buf); } }
bool COptionsPageTransfer::LoadPage() { bool failure = false; wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DOWNLOADLIMIT", wxTextCtrl); if (!pTextCtrl) return false; pTextCtrl->SetMaxLength(9); pTextCtrl->ChangeValue(m_pOptions->GetOption(OPTION_SPEEDLIMIT_INBOUND)); pTextCtrl = XRCCTRL(*this, "ID_UPLOADLIMIT", wxTextCtrl); if (!pTextCtrl) return false; pTextCtrl->SetMaxLength(9); pTextCtrl->ChangeValue(m_pOptions->GetOption(OPTION_SPEEDLIMIT_OUTBOUND)); SetTextFromOption(XRCID("ID_NUMTRANSFERS"), OPTION_NUMTRANSFERS, failure); SetTextFromOption(XRCID("ID_NUMDOWNLOADS"), OPTION_CONCURRENTDOWNLOADLIMIT, failure); SetTextFromOption(XRCID("ID_NUMUPLOADS"), OPTION_CONCURRENTUPLOADLIMIT, failure); SetTextFromOption(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT, failure); SetChoice(XRCID("ID_BURSTTOLERANCE"), m_pOptions->GetOptionVal(OPTION_SPEEDLIMIT_BURSTTOLERANCE), failure); return !failure; }
void update_labelprops_proc(void) { Arg a; int iv; if (labelprops_frame) { SetChoice(title_font_item, g[cg].labs.title.font); SetChoice(title_color_item, g[cg].labs.title.color); SetChoice(title_linew_item, g[cg].labs.title.linew - 1); iv = (int) (100 * g[cg].labs.title.charsize); XtSetArg(a, XmNvalue, iv); XtSetValues(title_size_item, &a, 1); SetChoice(stitle_font_item, g[cg].labs.stitle.font); SetChoice(stitle_color_item, g[cg].labs.stitle.color); SetChoice(stitle_linew_item, g[cg].labs.stitle.linew - 1); iv = (int) (100 * g[cg].labs.stitle.charsize); XtSetArg(a, XmNvalue, iv); XtSetValues(stitle_size_item, &a, 1); } }
static void update_ticklabel_items(int gno) { Arg a; tickmarks t; int iv; if (ticklabel_frame) { get_graph_tickmarks(gno, &t, curaxis); SetChoice(tlfont, t.tl_font); SetChoice(tlcolor, t.tl_color); SetChoice(tllinew, t.tl_linew - 1); SetChoice(tlskip, t.tl_skip); SetChoice(tlstagger, t.tl_staggered); xv_setstr(tlappstr, t.tl_appstr); xv_setstr(tlprestr, t.tl_prestr); SetChoice(tlstarttype, t.tl_starttype == TYPE_SPEC); if (t.tl_starttype == TYPE_SPEC) { sprintf(buf, "%f", t.tl_start); xv_setstr(tlstart, buf); sprintf(buf, "%f", t.tl_stop); xv_setstr(tlstop, buf); } SetChoice(tlstoptype, t.tl_stoptype == TYPE_SPEC); if (t.tl_stoptype == TYPE_SPEC) { sprintf(buf, "%f", t.tl_stop); xv_setstr(tlstop, buf); } iv = get_format_index(t.tl_format); SetChoice(tlform, iv); switch (t.tl_op) { case PLACE_LEFT: SetChoice(ticklop, 0); break; case PLACE_RIGHT: SetChoice(ticklop, 1); break; case PLACE_BOTTOM: SetChoice(ticklop, 0); break; case PLACE_TOP: SetChoice(ticklop, 1); break; case PLACE_BOTH: SetChoice(ticklop, 2); break; } switch (t.tl_sign) { case SIGN_NORMAL: SetChoice(tlsign, 0); break; case SIGN_ABSOLUTE: SetChoice(tlsign, 1); break; case SIGN_NEGATE: SetChoice(tlsign, 2); break; } SetChoice(tlprec, t.tl_prec); iv = (int) (100 * t.tl_charsize); XtSetArg(a, XmNvalue, iv); XtSetValues(tlcharsize, &a, 1); switch (t.tl_layout) { case TICKS_HORIZONTAL: SetChoice(tllayout, 0); break; case TICKS_VERTICAL: SetChoice(tllayout, 1); break; case TYPE_SPEC: SetChoice(tllayout, 2); break; } switch (t.tl_loc) { case LABEL_ONTICK: SetChoice(tlloc, 0); break; case LABEL_BETWEEN: SetChoice(tlloc, 1); break; } iv = (int) t.tl_angle % 360; XtSetArg(a, XmNvalue, iv); XtSetValues(tlangle, &a, 1); } }
static void update_tickmark_items(int gno) { Arg a; tickmarks t; int iv; if (tickmark_frame) { get_graph_tickmarks(gno, &t, curaxis); switch (t.t_inout) { case TICKS_IN: SetChoice(tinout, 0); break; case TICKS_OUT: SetChoice(tinout, 1); break; case TICKS_BOTH: SetChoice(tinout, 2); break; } switch (t.t_op) { case PLACE_LEFT: SetChoice(tickop, 0); break; case PLACE_RIGHT: SetChoice(tickop, 1); break; case PLACE_BOTTOM: SetChoice(tickop, 0); break; case PLACE_TOP: SetChoice(tickop, 1); break; case PLACE_BOTH: SetChoice(tickop, 2); break; } SetChoice(tgridcol, t.t_color); SetChoice(tgridlinew, t.t_linew - 1); SetChoice(tgridlines, t.t_lines - 1); SetChoice(tmgridcol, t.t_mcolor); SetChoice(tmgridlinew, t.t_mlinew - 1); SetChoice(tmgridlines, t.t_mlines - 1); iv = (int) (100 * t.t_size); XtSetArg(a, XmNvalue, iv); XtSetValues(tlen, &a, 1); iv = (int) (100 * t.t_msize); XtSetArg(a, XmNvalue, iv); XtSetValues(tmlen, &a, 1); XmToggleButtonSetState(tgrid, t.t_gridflag == TRUE, False); XmToggleButtonSetState(tmgrid, t.t_mgridflag == TRUE, False); } }