本文整理汇总了C++中Appearance::setPadding方法的典型用法代码示例。如果您正苦于以下问题:C++ Appearance::setPadding方法的具体用法?C++ Appearance::setPadding怎么用?C++ Appearance::setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Appearance
的用法示例。
在下文中一共展示了Appearance::setPadding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Appearance *Option::parseAppearance(char *str)
{
Appearance *app = 0;
char *p;
if (*str == '[') {
char *tok;
int mask = 0;
int top, left, bottom, right;
top = left = bottom = right = 0;
p = strtok_r(str, "[] ,", &tok);
app = parseAppearance(p);
if (!(p = strtok_r(NULL, "[] ,", &tok))) goto err;
top = strtol(p, 0, 10);
if (strchr(p, '%'))
mask |= PERPAD_TOP;
if (!(p = strtok_r(NULL, "[] ,", &tok))) goto err;
right = strtol(p, 0, 10);
if (strchr(p, '%'))
mask |= PERPAD_RIGHT;
if ((p = strtok_r(NULL, "[] ,", &tok))) {
bottom = strtol(p, 0, 10);
if (strchr(p, '%'))
mask |= PERPAD_BOT;
if (!(p = strtok_r(NULL, "[] ,", &tok))) goto err;
left = strtol(p, 0, 10);
if (strchr(p, '%'))
mask |= PERPAD_LEFT;
}
else {
bottom = top;
if (mask & PERPAD_TOP)
mask |= PERPAD_BOT;
right = left;
if (mask & PERPAD_LEFT)
mask |= PERPAD_RIGHT;
}
app->setPadding(Padding(mask, top, right, bottom, left));
}
else if ((p = strstr(str, "gradient"))) {
int direction = 0;
char *tok;
p = strchr(p, '(');
if (!p) goto err;
p = strtok_r(p, ", ()", &tok);
if (strcmp(p, "vert") == 0)
direction = GRAD_VERT;
else
direction = GRAD_HORZ;
app = new GradientAppearance(direction);
GradientAppearance *gapp = dynamic_cast<GradientAppearance *>(app);
while((p = strtok_r(NULL, ", ()", &tok)) != NULL){
gapp->addColor(atoc(p));
}
}
else if ((p = strstr(str, "image"))) {
char *tok;
p = strchr(p, '(');
if (!p) goto err;
if (!(p = strtok_r(p, "(\")", &tok))) goto err;
Setting *setting = Insune::getSingleton()->getSetting("style");
const char *style = setting->getValue()->getString();
char stylepath[256];
snprintf(stylepath, 256, STYLEDIR "%s/%s", style, p);
char *align = NULL;
char *type = NULL;
if ((p = strtok_r(NULL, "(\")", &tok))) {
if (*p == '@') {
align = p + 1;
if ((p = strchr(p + 1, '!'))) {
*p = '\0';
type = p + 1;
}
} else if (*p == '!') {
type = p + 1;
if ((p = strchr(p + 1, '@'))) {
*p = '\0';
align = p + 1;
}
}
}
if (align && type)
app = new ImageAppearance(stylepath, align, type);
else if (align)
app = new ImageAppearance(stylepath, align);
else if (type)
app = new ImageAppearance(stylepath, NULL, type);
else
//.........这里部分代码省略.........