Basic GdkWindow hello world Example? - c++

I'm new to Gtk/Gdk.
I've done some work with GtkWindows, but now I need to work with lower level Gdk Windows.
I understand GdkWindows are used to implement GtkWindows and GtkWidgets in general. It is the drawing area.
I'm kind of not sure where to start. How do I make a shell, with a GdkWindow inside it with something like a label inside that saying hello world?
I've looked around for tutorials, but haven't been able to find anything.
Edit - background for this
I can't get away with just knowing Gtk. The reason I need to work on Gdk.
I'm an SWT/Gtk developer.
SWT is build on top of Gtk/Gdk.
For gtk3, it has a custom container, to allow things like overlapping IDE elements.
The custom container uses low-level Gdk calls, (e.g for realization).
It's buggy. I need to fix it. Thus need to learn Gdk.

Related

How to inspect pop up windows/tool tips/hover effects which are designed to hide/close on mouse move with tools like WinSpy++ or Spy++?

Essentially I'm trying to learn more about the Win32 api, how certain classes/elements are created, destroyed, what items make them up etc.. Dissecting windows if you will for a project of mine.
I'm very curious at the moment what popups/tool tips/hover effects ubiquities to all windows applications are made up of. My main goal is to grab text from any tooltip/hover thingy/WS_POPUP?
If someone knows that is great but I'd also like to have the tools to research it myself.
I'm not even sure what to google to be honest to get me on the right path. I've tried some C++ code to print class names and fetch the text from what I think might be a msgbox but no dice so far.
The MiniSpy tool on Codeproject comes in handy in situations like this because it uses the corner of the spy window as the location, not the mouse.

Object level (non-pixel dependent) automation for QT-based GUIs?

I'm looking for some advice and insight on how people approach creating Object-level GUI automation. Technically the type of functionality I am trying to achieve is easily described by Squish software. I want to be able to simulate Key-Press and Mouse Click events without relying on Platform-specific pixel displays, and screen sizes. I've tried to use tools like Sikuli, but unfortunately my application varies too from platform to platform to make reliably re-repeatable tests.
Basically what I am looking for is some advice as to where to look at how 3rd Part (EXTERNAL) programs hook into properties of QT Widgets and other objects. I know a long time ago there was something call QtObjectInspector, but this software required you making Source-Level changes to your Qt code to be compatible on top of being unavailable.
If companies like Squish can do it, how are they doing it? Where do you start? I doubt they are looking at very low level memory interactions, sniffing for "Traffic" that looks like QT on each different system, but I may be wrong.
I'm sorry for such a vague question, but I've been researching for over a day and all I can find now is articles about how amazing Squish is.
Thanks!
EDIT:
I looked into QtTestLib, however this doesn't have the "From the outside" kind of access that I am looking for.

How to add support for printing into my C++ application

I have what seems like a simple task. I wrote a Windows application using C++. Now I need to add to it a capability to print forms -- nothing fancy, just plain text, with lines, tables, and simple graphics. Besides printing, a user needs to be able to preview on the screen all forms being printed.
Previously I was able to get away with this task by using an embedded Internet Explorer control and design all forms in HTML (which I like -- the HTML part.) But the problem comes with IE... hmm... I wish I had a nickel every time I heard that phrase :) Anyway, IE can print an HTML page but it does not provide any easy way for users of my software to customize page size, page margins, etc.
I spent a good deal of the last week trying to make IE Print Templates work with what I need ... but eventually failed. That stuff is very poorly documented and what I was able to do seems to randomly crash on me. So at this point I gave up on IE...
So my question to you -- is there a way to incorporate printing into my C++ program for the purposes like I described above?
If I remember correctly, printers have their own HDC, and you can draw on it. That'll work if have something simple. If you want to render HTML page using pure WinAPI, you're in big trouble.
I'd advise to abandon winapi and try GUI framework instead.
Qt 4(and 5, most likely) has text editor that can display rich text, layout engine for rich text, component that can display web pages. Read documentation a bit, and you will most likely find a way to render web page onto printer instead of screen. So far it looks like exactly what you would need.
Using Qt will add dependencies (20+ MB of DLLs for your project), but, IMO< it is a better idea than trying to use IE COM interfaces.
If you don't want to use Qt, you could try something like WebKIT, but I had some bad experiences with it, plus Qt might be just easier to use.
Additional info on printing: Printing with Qt.
Try searching for GDI, if you want to use win32 builtins.
Or use another toolkit like wxWidgets. Or consider writing to PDF with some library. Or let LaTeX do the heavy lifting - writing text files is easy. The LaTeX-way works as long as you don't want to modify your output depending on the layout (one Use-Case that doesn't work with LaTeX is the "balance" at the top/bottom of each page.)
Consider having your program generate XML files and using XSLT to render them into HTML.
By attaching stylesheets you will make it much easier to customize the presentation.

Is it possible to bring native UI's into Cocos2dx

I am pretty new to cocos2d-x. Surfing internet did not help much.
My Question:
We have requirement to develop an application which has more controls like calender, table, options along with few animation stuff. I really impressed with cocos2d-x. But i do not find any use cases like calender, table , that can be used in cocos2d-x, unless we write on our own. [ i may be wrong also here ].
So, Kindly suggest, if going with cocos2d-x , can i achieve the said above?.
There are some extensions inside cocos2d-x distibution (see ./extensions folder), and some UIKit classes reimplementations on github. Animations usually implemented with CCAction subclasses (like CCMoveBy, CCMoveTo, etc).
Yes. You can use native controls using a bridge between Cocos2d-x and Objective C
Here is an example of how to achieve it.
However these native UI will run only for iOS. You wont be able to get the benefit of cocos2d-x being multiplatform.

Create a paint like work area and ability to move them

I like to design a workplace or form(not decided) in VC++ (MFC) or (C++) where I can select and place different objects like car , bike etc and move them programmatically.Each object has its own properties(which is already designed) I have no problem in moving them by changing x,y position.
But my question is how do I place different objects like car , bus on screen and move them to the place I want.I should also able to delete them when needed. As I am new MFC I would like to know how to proceed . Given an right direction I can swim on my own.
Qt is an excellent framework for this kind of thing.
Do not use MFC. Period. That thing is a genuine piece of crap, and every programmer I know absolutely hates it and stays away from it.
If you want to start from scratch, use WINAPI, but that's your choice (depending on if you want to reinvent the wheel.) Read up on input events and DirectDraw (for drawing to a 2D canvas.) Microsoft also has WPF for newer .NET builds, and it has canvas support built it.
Agree that you should not use MFC. Sticking with C++, there is Managed C++ on the .NET platform, or you could go native C++ and use DirectDraw or use OpenGL (which is more cross platform).