can gtkmm change the css property of a class programmatically? - c++

Gtk::StyleContext has methods for adding and removing a CSS class. Can I change the property of this class programmatically?

Yes, sort of; you can load another CSS file in the style context's CSS provider, that has different rules for that CSS class.
I suspect you might be asking about how to go into the rules directly and edit them programmatically; you can't do that.

Related

Listing customization ServiceNow

How can I personalize a list within ServiceNow?
I mean, I have this list:
But I think its very confusing to see the position on the right side.. How can I center it?
Like CSS customization or JS or something like that.. where can I find the customization form?
You can customise the position of the field content by using Field Styles.
If you mean customising the position of the field header, I have had a play around with doing this and I seem to have got it working.
If you inspect the HTML of the column header you want to target (the th tag), you'll see that there's an attribute on it called glide_type which contains in it the type of column. You can use this to create a CSS rule to target only headers of a particular type.
For example, I have a field of type decimal, and the th tag has the following attribute:glide_type="decimal". So to target that element, I could create a CSS rule like the below:
th.text-align-left.list_header_cell[glide_type="decimal"] {
text-align: right;
}
The hacky part is including that CSS so that it applies throughout the SN interface. You can use a UI Script to run some JavaScript which includes the Style Sheet. So if you put the above CSS inside a new Style Sheet (navigate to Content Management > Design > Style Sheets), and copy that new Style Sheet's Sys ID, you can create a UI Script with the below in it to include that Style Sheet on all pages:
link = document.createElement("link");
link.href = "STYLE_SHEET_SYS_ID_GOES_HERE.cssdbx?";
link.type = "text/css";
link.rel = "stylesheet";
link.media = "screen,print";
document.getElementsByTagName("head")[0].appendChild(link);
After doing that, you'll see that the Style Sheet is getting loaded on all pages, and if you've written your CSS right then you should find that the column header is now right-aligned!
As #Kirk said, performing this kind of customisation will mean that it's hard for ServiceNow Customer Support to assist if there's something you've customised getting in the way of their troubleshooting. Take this into account if you decide to implement something like this, and also thoroughly test this on a non-production instance.
In addition to the above, this solution may break in future releases as ServiceNow may decide to change the way that lists work and thus the CSS selector may no longer target the right/any element.
Hope this helps!
Dylan
It's not suggested to customize any sort of CSS or JS with that, we were told that is voids your support for that section if you do so.
You could just add a few more display fields if you really desire to remove the extra white-space.
For a complete description of that (which you may know how to do):
Click the Gear icon
Then select some relevant fields from the Available section, and click the Right arrow to add them.

Purpose of %%GLOBAL_HeadFonts%% in Bigcommerce templates?

Noticed the template variable %%GLOBAL_HeadFonts%% in HTMLHead.html in the Bigcommerce Blueprint theme as well as other themes.
What I don't understand is where the value of this variable can be set in the Bigcommerce admin interface / back-end. I notice that theme authors seem to stick additional fonts directly into HTMLHead.html before/after %%GLOBAL_HeadFonts%%.
%%GLOBAL_HeadFonts%% is used to fetch the base theme's fonts. Since you have no control over any %%GLOBAL.something%% and %%LNG.something%% its better to call your fonts just under this line. You can upload your fonts by creating a fonts directory (under template) then call those fonts either within your Style.css or externally using %%ASSET.fonts/myfont.wof%%
Use this https://developer.bigcommerce.com/themes/panels/html_head to understand BigCommerce HTML.head architecture.

Help with this design issue

I'm making a game GUI API. It is coming along very nicely except for one aspect. I want themes similar to how GTK works. The way I want it to work is that every GUI element will have a default Windows9X-like way of drawing themselves. If it is found that a theme is set for that type of widget, it will be drawn with those bitmaps.
My original concept was to create a Theme class which would have getters and setters for the bitmaps.
for example:
themeManager.setButtonHover(Bitmap *bitmap);
The problem with this, is that it is not flexable if I want to create new types of Widgets. I may eventually want to create a superButton which would use a different theme than a button. This is the flaw with that concept. The concept I'm thinking of going with is that each widget type has static methods to set the theme for itself and the constructor uses that.
Are there better ways of doing this that I'm not thinking of? Since it is an API, I want to avoid reading text files, so reading the theme from a text document is not an option.
Thanks
May be template the superButton on a policy and then have a default policy which does the default and the user has the option of providing a different policy? The policy could then define the attributes of the button (such as the hover image etc.) - does what I describe make sense?

Customizing Dojo Widgets

How do I customize an existing Dojo widget? I'm using dojo version 1.3. In the previous versions we had the html file under templates folder. Do I need to edit the source code directly.
I need to add an image to Accordion widget. Can someone please help me in customizing it?
Thanks in advance.
First, grab the existing template from the dojo library. This'll be your starting point.
Then, create your own widget that inherits from AccordionContainer, but specify your own html template:
dojo.declare("MyWidgets.Accordion", dijit.layout.AccordionContainer, {
templatePath: dojo.moduleUrl("MyWidgets","Accordion.html");
});
(dojo.moduleUrl is a nice way of specifying folder paths so the dojo library can find and inline them when you package up your final product).
This way, you leave the original source intact, but can set your own html and override any methods as needed.
That HTML template is still there in the templates folders. You just need to download the source release. Depending on your needs you could 1) set the content by adding children, 2) write custom widget inheriting it or 3) use it as a part of compound widget. Inheritance in Dojo way is simple:
dojo.declare("my.Accordion", dijit.layout.AccordionContainer, {
// your methods...
});
I think you could extend the existing widget rather than modifying it.

How to correctly modify <HEAD> in Django-CMS for custom plugins?

Django-CMS custom plugins and navigation extenders allow to create any content HTML in some part of the HTML . However I frequently have some JavaScripts required for some specific plugins, like a photo album viewer plugin that requires a JS in the .
My current solution is to let the user specify a specific template for that. I could do some checking in the template render() to use a specific placeholder or use placeholder restrictions but that doesn't seem right: It's still in the "body" placeholder.
Any suggestion?
Nothing wrong with including Javascript in the body - in fact, some consider it best practice.