// Adds the property declarations for a tile. void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool register_repeat_modes) { RegisterProperty(String(32, "%s-src", name.CString()), "").AddParser("string"); RegisterProperty(String(32, "%s-s-begin", name.CString()), "0").AddParser("number"); RegisterProperty(String(32, "%s-s-end", name.CString()), "1").AddParser("number"); RegisterProperty(String(32, "%s-t-begin", name.CString()), "0").AddParser("number"); RegisterProperty(String(32, "%s-t-end", name.CString()), "1").AddParser("number"); RegisterShorthand(String(32, "%s-s", name.CString()), String(64, "%s-s-begin, %s-s-end", name.CString(), name.CString())); RegisterShorthand(String(32, "%s-t", name.CString()), String(64, "%s-t-begin, %s-t-end", name.CString(), name.CString())); if (register_repeat_modes) { RegisterProperty(String(32, "%s-repeat", name.CString()), "stretch") .AddParser("keyword", "stretch, clamp-stretch, clamp-truncate, repeat-stretch, repeat-truncate"); RegisterShorthand(name, String(256, "%s-src, %s-repeat, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString(), name.CString())); } else RegisterShorthand(name, String(256, "%s-src, %s-s-begin, %s-t-begin, %s-s-end, %s-t-end", name.CString(), name.CString(), name.CString(), name.CString(), name.CString())); }
GradientDecoratorInstancer( void ) : DecoratorInstancer() { // register properties for the decorator RegisterProperty( "dir", "" ).AddParser( "string" ).AddParser( "keyword", "horizontal, vertical" ); RegisterProperty( "start", "#ffff" ).AddParser( "color" ); RegisterProperty( "end", "#ffff" ).AddParser( "color" ); RegisterShorthand( "gradient", "dir, start, end" ); // Com_Printf("decorator instancer created\n"); }
// Registers Rocket's default style properties. void StyleSheetSpecification::RegisterDefaultProperties() { // Style property specifications (ala RCSS). RegisterProperty(MARGIN_TOP, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_RIGHT, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_BOTTOM, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MARGIN_LEFT, "0px", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterShorthand(MARGIN, "margin-top, margin-right, margin-bottom, margin-left"); RegisterProperty(PADDING_TOP, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_RIGHT, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_BOTTOM, "0px", false, true).AddParser("number"); RegisterProperty(PADDING_LEFT, "0px", false, true).AddParser("number"); RegisterShorthand(PADDING, "padding-top, padding-right, padding-bottom, padding-left"); RegisterProperty(BORDER_TOP_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_RIGHT_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_BOTTOM_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(BORDER_LEFT_WIDTH, "0px", false, true).AddParser("number"); RegisterShorthand(BORDER_WIDTH, "border-top-width, border-right-width, border-bottom-width, border-left-width"); RegisterProperty(BORDER_TOP_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_RIGHT_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_BOTTOM_COLOR, "black", false, false).AddParser(COLOR); RegisterProperty(BORDER_LEFT_COLOR, "black", false, false).AddParser(COLOR); RegisterShorthand(BORDER_COLOR, "border-top-color, border-right-color, border-bottom-color, border-left-color"); RegisterShorthand(BORDER_TOP, "border-top-width, border-top-color"); RegisterShorthand(BORDER_RIGHT, "border-right-width, border-right-color"); RegisterShorthand(BORDER_BOTTOM, "border-bottom-width, border-bottom-color"); RegisterShorthand(BORDER_LEFT, "border-left-width, border-left-color"); RegisterProperty(DISPLAY, "inline", false, true).AddParser("keyword", "none, block, inline, inline-block"); RegisterProperty(POSITION, "static", false, true).AddParser("keyword", "static, relative, absolute, fixed"); RegisterProperty(TOP, "0px", false, false) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(RIGHT, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(BOTTOM, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(LEFT, "0px", false, false).AddParser("number") .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(FLOAT, "none", false, true).AddParser("keyword", "none, left, right"); RegisterProperty(CLEAR, "none", false, true).AddParser("keyword", "none, left, right, both"); RegisterProperty(Z_INDEX, "auto", false, false) .AddParser("keyword", "auto, top, bottom") .AddParser("number"); RegisterProperty(WIDTH, "auto", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MIN_WIDTH, "0px", false, true).AddParser("number"); RegisterProperty(MAX_WIDTH, "-1", false, true).AddParser("number"); RegisterProperty(HEIGHT, "auto", false, true) .AddParser("keyword", "auto") .AddParser("number"); RegisterProperty(MIN_HEIGHT, "0px", false, true).AddParser("number"); RegisterProperty(MAX_HEIGHT, "-1", false, true).AddParser("number"); RegisterProperty(LINE_HEIGHT, "1.2", true, true).AddParser("number"); RegisterProperty(VERTICAL_ALIGN, "baseline", false, true) .AddParser("keyword", "baseline, middle, sub, super, text-top, text-bottom, top, bottom") .AddParser("number"); RegisterProperty(OVERFLOW_X, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll"); RegisterProperty(OVERFLOW_Y, "visible", false, true).AddParser("keyword", "visible, hidden, auto, scroll"); RegisterShorthand("overflow", "overflow-x, overflow-y", PropertySpecification::REPLICATE); RegisterProperty(CLIP, "auto", true, false) .AddParser("keyword", "auto, none") .AddParser("number"); RegisterProperty(VISIBILITY, "visible", false, false).AddParser("keyword", "visible, hidden"); // Need some work on this if we are to include images. RegisterProperty(BACKGROUND_COLOR, "transparent", false, false).AddParser(COLOR); RegisterShorthand(BACKGROUND, BACKGROUND_COLOR); RegisterProperty(COLOR, "white", true, false).AddParser(COLOR); RegisterProperty(FONT_FAMILY, "", true, true).AddParser("string"); RegisterProperty(FONT_CHARSET, "U+0020-007E", true, false).AddParser("string"); RegisterProperty(FONT_STYLE, "normal", true, true).AddParser("keyword", "normal, italic"); RegisterProperty(FONT_WEIGHT, "normal", true, true).AddParser("keyword", "normal, bold"); RegisterProperty(FONT_SIZE, "12", true, true).AddParser("number"); RegisterShorthand(FONT, "font-style, font-weight, font-size, font-family, font-charset"); RegisterProperty(TEXT_ALIGN, LEFT, true, true).AddParser("keyword", "left, right, center, justify"); RegisterProperty(TEXT_DECORATION, "none", true, false).AddParser("keyword", "none, underline"/*"none, underline, overline, line-through"*/); RegisterProperty(TEXT_TRANSFORM, "none", true, true).AddParser("keyword", "none, capitalize, uppercase, lowercase"); RegisterProperty(WHITE_SPACE, "normal", true, true).AddParser("keyword", "normal, pre, nowrap, pre-wrap, pre-line"); RegisterProperty(CURSOR, "auto", true, false) .AddParser("keyword", "auto") .AddParser("string"); // Functional property specifications. RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone"); RegisterProperty(TAB_INDEX, "none", false, false).AddParser("keyword", "none, auto"); RegisterProperty(FOCUS, "auto", true, false).AddParser("keyword", "none, auto"); RegisterProperty(SCROLLBAR_MARGIN, "0", false, false).AddParser("number"); }