本文整理汇总了C++中Style类的典型用法代码示例。如果您正苦于以下问题:C++ Style类的具体用法?C++ Style怎么用?C++ Style使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Style类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//---------------------------------------------------------------------------------------------------------------------
boost::optional <Style> StyleSheet::select(std::string const& selector, bool cascade) const
{
std::multimap <long, std::pair <int, Style> > filtered;
int counter = 0;
for (auto const& i : styles_)
{
long specificity = i.getRule().selector.getHighestSpecificityFor(selector);
if (specificity != -1)
filtered.insert(std::pair <long, std::pair <int, Style>> (specificity, {counter, i}));
++counter;
}
if (filtered.empty())
return boost::none;
Style combined = filtered.rbegin()->second.second;
Style* last = &combined;
for (auto front = filtered.rbegin(), end = filtered.rend(), i = std::next(front); i != end; ++i)
{
last->derive(&i->second.second);
last = &i->second.second;
}
return boost::optional <WretchedCss::Style> {combined.getCombined()};
}
示例2: Rec
bool XARGenerator::OutputPathEntity(const Style& style, const Transformation& trans, PathDataVector& pathVector)
{
bool ok = true;
CXaraFileRecord Rec(0);
if (style.IsFillColourDefined() || style.IsFillGradientDefined()) {
if (style.IsStrokeColourDefined())
Rec.Reinit(TAG_PATH_FILLED_STROKED, TAG_PATH_SIZE);
else
Rec.Reinit(TAG_PATH_FILLED, TAG_PATH_SIZE);
} else // if (style.IsStrokeColourDefined())
Rec.Reinit(TAG_PATH_STROKED, TAG_PATH_SIZE);
Rec.WriteUINT32(pathVector.GetCount());
for (unsigned int i = 0; i < pathVector.GetCount(); ++i)
Rec.WriteBYTE(pathVector[i].m_verb);
for (unsigned int i = 0; i < pathVector.GetCount(); ++i) {
PointD p = pathVector[i].m_coord;
Rec.WriteCoord(DocCoord((INT32)p.x, m_docSize.y - (INT32)p.y));
}
ok = m_pExporter->WriteRecord(&Rec);
RectD boundings = GetMaximumBoundings(pathVector);
/***/ ok = m_pExporter->WriteZeroSizedRecord(TAG_DOWN);
OutputStyles(style, trans, boundings, STYLE_FILL_ALL|STYLE_STROKE_ALL|STYLE_OPACITY);
/***/ ok = m_pExporter->WriteZeroSizedRecord(TAG_UP);
return ok;
}
示例3: scons
static void* scons(Object*) {
#if HAVE_IV
SymChooser* sc = nil;
IFGUI
const char* caption = "Choose a Variable Name or";
if (ifarg(1)) {
caption = gargstr(1);
}
Style* style = new Style(Session::instance()->style());
style->attribute("caption", caption);
if (ifarg(2)) {
Symbol* sym = hoc_lookup(gargstr(2));
int type = RANGEVAR;
if (sym) {
type = sym->type;
}
sc = new SymChooser(new SymDirectory(type), WidgetKit::instance(), style, nil, 1);
}else{
sc = new SymChooser(nil, WidgetKit::instance(), style);
}
Resource::ref(sc);
ENDGUI
return (void*)sc;
#else
return (void*)0;
#endif /* HAVE_IV */
}
示例4: TEST
TEST( KMLStyle , testSetId )
{
Style s;
s.id() = "Id";
EXPECT_EQ( s.id() , "Id" );
EXPECT_TRUE( bool( s ) );
}
示例5: match
boolean MonoKitImpl::match(const Style& s1, const Style& s2, const char* n) {
String name(n);
String v1, v2;
boolean b1 = s1.find_attribute(n, v1);
boolean b2 = s2.find_attribute(n, v2);
return (!b1 && !b2) || (b1 && b2 && v1 == v2);
}
示例6: points
void asciimage::Shape::renderLine(QPainter* painter, int scale, const Style& style) const
{
Q_ASSERT(type() == Type::LINE);
Q_ASSERT(points().size() == 2);
if (scale == 1)
{
if (!isStraightLine())
{
painter->setRenderHint(QPainter::Antialiasing, true);
}
painter->setPen(style.color());
painter->drawLine(points()[0], points()[1]);
}
else
{
if (isStraightLine())
{
const QRect b = boundingRect();
painter->setPen(style.color());
painter->setBrush(style.color());
painter->drawRect(scaledOuterRect(b, scale));
}
else
{
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setPen(QPen(style.color(), scale, Qt::SolidLine, Qt::SquareCap));
painter->drawLine(p(points()[0], scale), p(points()[1], scale));
}
}
}
示例7: getStyle
Style* PatternLoader::getStyle(QString name) {
Style* pS;
for(pS=styleList.first(); pS != 0; pS=styleList.next()) {
if(name.compare(pS->getName())==0) { return pS; }
}
return NULL;
}
示例8: build
void FieldEditorImpl::build(
FieldEditor* e, const char* str, FieldEditorAction* a
) {
WidgetKit& kit = *kit_;
kit.begin_style("FieldEditor");
Style* s = kit.style();
bs_ = new FieldButton(e, a);
editor_ = new FieldStringEditor(bs_, str, kit_, s);
Glyph* g = editor_;
if (s->value_is_on("beveled")) {
g = kit.inset_frame(
new Background(
LayoutKit::instance()->h_margin(editor_, 2.0),
kit.background()
)
);
}
e->body(g);
cursor_is_on_ = false;
blink_handler_ = new IOCallback(FieldEditorImpl)(
this, &FieldEditorImpl::blink_cursor
);
float sec = 0.5;
s->find_attribute("cursorFlashRate", sec);
flash_rate_ = long(sec * 1000000);
kit.end_style();
}
示例9: updateStyle
void AnnotationManager::updateStyle(Style& style) {
// Create annotation source, point layer, and point bucket
if (!style.getSource(SourceID)) {
std::unique_ptr<Source> source = std::make_unique<AnnotationSource>();
source->baseImpl->enabled = true;
style.addSource(std::move(source));
std::unique_ptr<SymbolLayer> layer = std::make_unique<SymbolLayer>(PointLayerID, SourceID);
layer->setSourceLayer(PointLayerID);
layer->setIconImage({"{sprite}"});
layer->setIconAllowOverlap(true);
layer->impl->spriteAtlas = &spriteAtlas;
style.addLayer(std::move(layer));
}
for (const auto& shape : shapeAnnotations) {
shape.second->updateStyle(style);
}
for (const auto& layer : obsoleteShapeAnnotationLayers) {
if (style.getLayer(layer)) {
style.removeLayer(layer);
}
}
obsoleteShapeAnnotationLayers.clear();
}
示例10: Style
Confirmer::Confirmer(const char* name, const char* prompt) {
WidgetKit& kit = *WidgetKit::instance();
const LayoutKit& layout = *LayoutKit::instance();
Style* s = new Style(kit.style());
s->attribute("name", name);
Glyph* sep = layout.hspace(8);
dialog_ = new Dialog(
kit.outset_frame(
layout.margin(
layout.vbox(
layout.hbox(kit.label(prompt), layout.hglue()),
layout.vglue(16, 20, 8),
layout.hbox(
layout.hglue(30, fil, 0),
kit.push_button(
"Cancel", new ConfirmerCallback(cancel)
),
sep,
kit.push_button(
"No", new ConfirmerCallback(no)
),
sep,
kit.push_button(
"Yes", new ConfirmerCallback(yes)
)
)
),
12, 12
)
),
s
);
Resource::ref(dialog_);
}
示例11: InputHandler
FieldEditor::FieldEditor(
const String& sample,
WidgetKit* kit,
Style* s,
FieldEditorAction* action)
: InputHandler(nil, s)
{
impl_ = new FieldEditorImpl;
impl_->action_ = action;
Resource::ref(impl_->action_);
kit->begin_style("FieldEditor");
Style* sty = kit->style();
impl_->editor_ = new TextLine(sample, sample.length());
Glyph* g = impl_->editor_;
if (sty->value_is_on("beveled"))
{
g = kit->inset_frame(
new Background(
LayoutKit::instance()->h_margin(impl_->editor_, 2.0),
kit->background()
)
);
}
body(g);
kit->end_style();
}
示例12: Style
CharacterMenu::CharacterMenu( Drawer & drawer )
{
WidgetFactory& factory = WidgetFactory::getInstance();
// MAIN CONTAINER
Style * style = new Style();
style->setBackgroundImage( factory.getMenuBackground() );
rootContainer = new VerCenterContainer( style );
// TITLE
LabelWidget * lw = factory.getTitleLabel( Locale::get( "CHARACTER" ) );
lw->prepare( drawer );
rootContainer->addWidget( *lw );
// FORRM
playerNameForm = new Form( "setPlayerName" );
// BUTTONS
TextInputWidget* tiw = factory.getLargeTextInput( ".{1,15}", Config::playerName );
interactiveWidgets.push_back( tiw );
rootContainer->addWidget( *tiw );
playerNameForm->addWidget( *tiw );
ButtonWidget* bw = factory.getLargeSubmitButton( Locale::get( "BACK" ), "setmenu settings", *playerNameForm );
this->interactiveWidgets.push_back( bw );
rootContainer->addWidget( *bw );
}
示例13: ClassProperties
void AnnotationManager::updateStyle(Style& style) {
// Create annotation source, point layer, and point bucket
if (!style.getSource(SourceID)) {
std::unique_ptr<Source> source = std::make_unique<Source>();
source->info.type = SourceType::Annotations;
source->info.source_id = SourceID;
source->enabled = true;
style.addSource(std::move(source));
std::unique_ptr<SymbolLayer> layer = std::make_unique<SymbolLayer>();
layer->id = PointLayerID;
layer->type = StyleLayerType::Symbol;
layer->styles.emplace(ClassID::Default, ClassProperties());
layer->bucket = std::make_shared<StyleBucket>(layer->type);
layer->bucket->name = layer->id;
layer->bucket->source = SourceID;
layer->bucket->source_layer = PointLayerID;
layer->bucket->layout.set(PropertyKey::IconImage, ConstantFunction<std::string>("{sprite}"));
layer->bucket->layout.set(PropertyKey::IconAllowOverlap, ConstantFunction<bool>(true));
style.addLayer(std::move(layer));
}
for (const auto& shape : shapeAnnotations) {
shape.second->updateStyle(style);
}
for (const auto& layer : obsoleteShapeAnnotationLayers) {
style.removeLayer(layer);
}
obsoleteShapeAnnotationLayers.clear();
style.getSource(SourceID)->invalidateTiles();
}
示例14: GetEditor
GraphicComp* ImportCmd::PostDialog () {
bool imported = false;
GraphicComp* comp = nil;
Editor* ed = GetEditor();
Style* style;
bool reset_caption = false;
if (chooser_ == nil) {
style = new Style(Session::instance()->style());
style->attribute("subcaption", "Import graphic from file:");
style->attribute("open", "Import");
chooser_ = DialogKit::instance()->file_chooser(".", style);
Resource::ref(chooser_);
} else {
style = chooser_->style();
}
while (chooser_->post_for(ed->GetWindow())) {
const String* str = chooser_->selected();
if (str != nil) {
NullTerminatedString ns(*str);
comp = Import(ns.string());
if (comp != nil) {
break;
}
style->attribute("caption", "Import failed!");
reset_caption = true;
}
}
if (reset_caption) {
style->attribute("caption", "");
}
return comp;
}
示例15: textSize
double AdjustColumnRowManipulator::adjustColumnHelper(const Cell& cell)
{
double long_max = 0.0;
const Style style = cell.effectiveStyle();
const QSizeF size = textSize(cell.displayText(), style);
if (size.width() > long_max) {
double indent = 0.0;
Style::HAlign alignment = style.halign();
if (alignment == Style::HAlignUndefined) {
if (cell.value().isNumber() || cell.isDate() || cell.isTime())
alignment = Style::Right;
else
alignment = Style::Left;
}
if (alignment == Style::Left)
indent = cell.style().indentation();
long_max = indent + size.width()
+ style.leftBorderPen().width() + style.rightBorderPen().width();
}
// add 4 because long_max is the length of the text
// but column has borders
if (long_max == 0.0)
return -1.0;
else
return long_max + 4.0;
}