How to zoom a GtkTreeView - gtk3

I want to zoom a GtkTreeView. Initially I thought I simply could use transform to do that, but it seems like GTK CSS currently does not support transform.
So reading up on the CSS docs, it seems my only chance would be to set font-size.
Now naively I tried to set font-size to 200% in GtkStyleContext.
All I get then is
g_object_set_is_valid_property: object class 'GtkStyleContext' has no property named 'font-size'
So how is one supposed to set font-size in code?

You can start with this:
css_provider = Gtk.CssProvider()
css = b"""treeview.view {font-size: 200%;}"""
css_provider.load_from_data(css)
style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
But, this will set 200% to all treeviews.
If you want (and you probably do) a custom style class which you can attach to any widget, it should look something like
.my_style_class { font-size: 200%; }
And you add this class to specific widget's StyleContext:
widget.get_style_context().add_class("my_style_class")

Related

How to set width of a control inside a function for QUnit test?

I have a scrollContainer which I need to set the width of. However, i'm not sure how to access the width inside my test file.
I can access the controller through
this.oViewStub = new Control()
var oScrollContainer = new sap.m.ScrollContainer()
this.oViewStub.byId returns oScrollContainer <-- pseudocode
This is the code i'm trying to reach in my test file:
this.getView().byId("scrollContainer").$().parent().parent().width().
So I have this.getView().byId("scrollContainer") covered as it returns oScrollContainer but i'm unable to set/get the width of it. How do I fix this?
1) Create a CSS file and define a class with the width that you want;
2) this.getView().byId("scrollContainer").addStyleClass("yourClass");
3) If it still doesn't work, probably the SAPUI5 standard code is overwriting your CSS. In this case you can specify a more precise path to reach your scroll container in the CSS file, but one thing that should work is to include the property !important when you set the with in your CSS file:
.yourClass {
width: 7rem !important;
}
something like sinon.stub($.prototype, 'width').returns(900) will work

Is it possible to change the font-size of the values within an ion-picker?

I made an ion-picker with which I can configure the font-size on my Ionic-App. So now I would like to change the font-size within the picker so that the user can see how big the font will be, before he has to confirm it. So for example if you scroll down and select 150%, it should re-scale the font-size to 150% just within the ion-picker.
I already know how to read the current value without confirming it and how to change the font in the entire app, so the only thing that's left would be to change the font of the picker-values.
add global.scss
.picker-opt{
font-size: 12px; //change size depend your Requirement
}
Yeah.
All what you need is to give the item an id;
And you make normal javascriptcode which is var elementsize = getelementbyid('and put there the item id);
Then
Elementsize.style["font-size"] = thepicker.value;
And that will solve your problem.
Or in otherway it can be binded with variable and ngmodule with this variable .
Regards.

LayoutPanel with right alignment

I'm using a layout panel with some layers. One of the layers is quite simple but I want it to have a float: right on the element. But this is actually not working because subwidgets are styled with style="postition: absolute; left: 0px; ..." which overrides the styling and so the subpanels/widgets will always be placed on the left. Any workaround for this?
After adding your element to your layout container, did you try setWidgetHorizontalPosition ?
If above method does not work and you want to use float right, maybe you can use a non-layout system with FlowPanel maybe. Otherwise you will have to fix the position and width/height of your components but you may loose responsive design.
Last trick : If you really need to change the absolute style. In your component do something like this (do this after your component has been added to the dom)
this.getElement().getParent().getStyle().set.....
You can reset whatever property you want but this might break your layout

Modify a css animation property?

Is there a way to programatically define and start a css animation? I'd like to animate a div from one absolute position to another. Something like:
FlowPanel fp = new FlowPanel();
fp.getElement().getStyle().setPosition(Position.ABSOLUTE);
fp.getElement().getStyle().setLeft(50, Style.Unit.PX);
fp.getElement().getStyle().setTop(50, Style.Unit.PX);
...
// something like:
fp.setAnimation("top: 300px");
I saw that we could define a css animation in our css file, and changing the name of the div's style will trigger the animation. But I don't know if we can programatically modify an animation defined in css. For example:
// css file
.testAnimation {
top: 500px;
transition-property: top;
transition-duration: 1s;
}
...
// But we can't modify the "top" attribute here depending on runtime needs?:
fp.setStyleName("testAnimation"); // I may want "top" to be some other value here.
Thanks
You have several approaches
1) GWT Animation - http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwAnimation
2) Jquery Approach - via GWTQuery - https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/6kOSm0HBP4A
3) JSNI In GWT - How to add CSS AnimationEnd event handler to GWT widget?
You can use getElement().getStyle().setProperty( property, value ) to set any css property. But this is not the right way of doing it. Suggested way is to do via css.
This Link might help you

Font shadows using Raphaël—JavaScript Library

I would like to put a shadow around any given text, or make the text more anti-aliased looking.
For example lets say I'm running a simple text such as:
var titleName = R.text(x+200, y-75, "Lorem Ipsoup de jour")
.attr({font: '75px Helvetica, Arial', opacity: 1, fill: "#dfe6ec"})
The text is somewhat chunky looking at that size, and doesn't blend well against a background. Is there a way I can create a drop-shadow effect (with alpha channel, ideally)?
In SVG a text shadow effect isn't as simple as with CSS3, but it's reasonably straightforward using a filter. You can't use that example as is in Raphaël because it has no support for groups, but you might be able to create the filter definition in an external file and then apply it with:
.attr({filter: "url(filters.svg#dropShadow)"});
--edit
I've had a chance to give it a try and it doesn't work because filter isn't recognised by attr, however it does work (in Firefox) if you grab the node and use a regular DOM setAttribute method.
var t = paper.text(100, 100, "Raphaël\nkicks\nbutt!");
t.node.setAttribute("filter", "url('filters.svg#dropShadow')");
Chrome doesn't apply the drop shadow, and Opera blurs the entire element. It almost certainly won't work in IE because that'll be VML. Example here.
I know this is an old question, but to help anyone else searching for this you can try Element.glow([glow]) to get a shadow effect. http://raphaeljs.com/reference.html#Element.glow