本文整理汇总了C++中Fl_Config::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Config::read方法的具体用法?C++ Fl_Config::read怎么用?C++ Fl_Config::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Config
的用法示例。
在下文中一共展示了Fl_Config::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSchemeColors
void getSchemeColors()
{
char tr[128];
int ir = 0;
char *keys[] =
{
"color", "label color", "selection color",
"selection text color", "highlight color", "text color",
"highlight label color",
};
Fl_Button *colorBoxes[7] =
{
colorBox, labelColorBox, selectionColorBox, selectionTextColorBox,
highlightColorBox, textColorBox, highlightLabelColorBox
};
if (schemeListBox->size() > 1)
{
Fl_Config *colorConfig;
const char *ai = schemeListBox->value();
if (strcmp(ai, "Active")==0)
{
char pathActive[FL_PATH_MAX];
snprintf(pathActive, sizeof(pathActive)-1, "%s/.ede/schemes/Active.scheme", getenv("HOME"));
colorConfig = new Fl_Config(pathActive);
} else {
char pathScheme[FL_PATH_MAX];
snprintf(pathScheme, sizeof(pathScheme)-1, "%s/.ede/schemes/%s", getenv("HOME"), ai);
colorConfig = new Fl_Config(pathScheme);
}
for(int boxIndex = 0; boxIndex < 7; boxIndex++)
{
colorConfig->set_section("widgets/default");
if(!colorConfig->read(keys[boxIndex], ir)) {
colorBoxes[boxIndex]->color((Fl_Color)ir);
colorBoxes[boxIndex]->highlight_color((Fl_Color)ir);
}
}
colorConfig->set_section("widgets/tooltip");
if(!colorConfig->read("color", ir)) {
tooltipBox->color((Fl_Color)ir);
tooltipBox->highlight_color((Fl_Color)ir);
}
if(!colorConfig->read("label color",ir)) {
tooltipTextColorButton->color((Fl_Color)ir);
tooltipTextColorButton->highlight_color((Fl_Color)ir);
}
colorConfig->set_section("widgets/default");
if (!colorConfig->read("text background", ir)) {
textBackgroundBox->color((Fl_Color)ir);
textBackgroundBox->highlight_color((Fl_Color)ir);
}
Fl_String tmpencoding;
if(!colorConfig->read("font encoding", tr, 0, sizeof(tr))) { tmpencoding = tr; }
if(!colorConfig->read("label font", tr, 0, sizeof(tr))) {
if (tr[0] == '_') tr[0] = ' '; // converted leading space
Fl_Font thefont = fl_create_font(tr);
labelfont.font = thefont;
labelfont.encoding = tmpencoding;
labelfont.defined = true;
if(!colorConfig->read("label size", tr, 0, sizeof(tr))) { labelfont.size = atoi(tr); }
}
if(!colorConfig->read("text font", tr, 0, sizeof(tr))) {
if (tr[0] == '_') tr[0] = ' ';
Fl_Font thefont = fl_create_font(tr);
textfont.font = thefont;
textfont.encoding = tmpencoding;
textfont.defined = true;
if(!colorConfig->read("text size", tr, 0, sizeof(tr))) { textfont.size = atoi(tr); }
}
labelFontInput->label(font_nice_name(labelfont));
textFontInput->label(font_nice_name(textfont));
colorConfig->set_section("global colors");
if(!colorConfig->read("background", ir)) backgroundBox->color((Fl_Color)ir);
colorBox->parent()->parent()->redraw();
delete colorConfig;
}
}