Can I access the Unity background elements? - c++

I'm not very familiar with Linux, but have some experience with C and C++. I would like to get in touch with some Visual FX and/or UI development (either C or C++). I was wondering if there is a possibility to access the GUI elements of the Desktop on Ubuntu's Unity UI.
What I especially would like to do, is to render animations on the desktop or windows or all over the screen. (particle effects when clicking with the mouse or so).
Can anyone point me in the right direction? (Libraries, Documents, ...)

I think Desktop Effects have to be designed specific for the corresponding Window Manager.
I think unity uses (some sort of) compiz, so you should look into compiz plugin development.
A lot of "i thinks" so i am not really sure if that'll help you, but good luck.

You want to learn a lot more about GTK. There are lot of documentation on line (and some books also). You might code in C++ using GtkMM (but you could consider Qt also). GTK itself is coded in C, with well designed coding style and convention. Looking inside its source code is worthwhile.

Related

Creating GUIs in Win32 C++

I'm developing my first Windows desktop application and I'm trying to figure out what the best approach would be to create the program's GUI.
I know, I know... I feel stupid for asking considering the amount of data on the subject on SO. However most answers seem outdated and I'm not sure if they fit my specific project. Also tutorials for Windows 8 'metro apps' are clogging my Google search results, which is NOT what I'm looking for.
I use Visual Studio. I've followed tutorials. I have basic knowledge of C and Java and extensive experience with PHP. I'm excited to learn C++, so I'm not looking for GUIs to create a GUI (like WinForms). I also don't care about managed code and portability for now, especially since I'm trying to avoid dependencies (i.e. users having to install .NET). As long as it runs smoothly on Vista and up, I'm happy.
The application
The software will teach basic physics to kids. I'd like to create a main area and a sidebar. The main area will feature a physics animation, say a bouncing ball, along with some Q&A. Users can zoom in to the animation to measure some stuff and answer the question. Users can track their progress in the sidebar. That's pretty much it.
What I've found so far
I'm getting a bit frustrated with MSDN. Most of their examples are given in four different languages (C#, C++, etc). I can't seem to get more than a bit of Hello World code from them.
I found a GDI API on MSDN and it seems like a good start for me. However I've read quite a few answers on SO saying creating layouts in pure C++ is really hard, that we're better of using frameworks like ATL and WTL. Since I'm also going to create (somewhat interactive) animations, I've wondered whether I should use gaming-targeted APIs like Direct2D.
Since all of this is new to me, and there are a lot of options, I don't know where to start for my particular application. Any tips would be greatly appreciated!
Using the raw Win32 API (no additional downloads or third-party helpers):
Here's a good primer (introduces dialog boxes, text boxes, buttons, etc): theForger's Win32 API Tutorial
And here's where you go from there (numeric up-downs, list boxes, combo boxes, tooltips, and more): Common Controls on MSDN. Most of these require you to #include <commctrl.h>.
I also found this to be a good resource that covered what the other two didn't: Win32 Developer - Window Assets
But the Win32 API doesn't seem like it does exactly what you want. A physics app for kids should have a more visual GUI than the API can provide. Good luck, though!
If you're ok with adding additional Frameworks, I'd suggest looking at Qt.
It allows to create the GUI from code only, has a good structure, and has an Interface for 2D drawing, if required.
If you are concerned about dependencies, you only have to include the Qt DLLs to your executables; no installation is required for the user.
To get started, see my (old) tutorial "Lessons in Windows API Programming".
But you really need a good book, such as edition 5 or earlier of Charles Petzold's classic "Programming Windows".
The problem with latest edition is that it's for C# and .NET, with Charles grabbing the tail of the "new way" at just the wrong time…
Disclaimer: I haven't checked the details of edition numbers.
Using the Windows API is the simplest, but producing advanced GUIs can take a very long time. Microsoft Foundation Class is a way to make the Windows API more user friendly and OOP. Does anyone have any experience with MFC?
Why not use some 2D C++ game engine, like HGE: http://hge.relishgames.com/overview.html.

gtkmm and MSAA accessibility

I'm interested to know if gtkmm w/ ATK (or whatever) works with MSAA like Qt does. We're looking right now at switching toolkit from WX and it turns out that our testing software relies on MSAA to do it's thing (something I wish I'd known 3 years ago when we picked WX to begin with). Of all the GUI toolkits, I prefer GTKmm mainly due to it's use of signals and slots but in a way much more expressive and generic than Qt's....and without the need for the extra build step that requires the Qt VS plugin. The designer is much better too.
So I'd like to use GTKmm but the only discussions and google stuff I can find on the topic are 3+ years old. They lead me to believe the answer is no, it doesn't support it and if it does it's really shoddy. But a lot can change in 3 years.
So, anyone that uses GTK or GTKmm on win32 know if it supports the windows accessibility framework?
I can’t say for sure but I would lean toward very little to no support. I use the Jaws screen reader SOFTWARE SINCE I’m blind. It uses MSAA quite heavily and GTK applications such as Pidgin are almost completely inaccessible. While I can read some of the text on a screen figuring out weather I’m in an edit field or weather a button is selected is impossible. If my screen reader can’t deal with GTK applications I assume your testing software will have major issues as well.
I don't know if this is still being tracked but I will second this assessment as another windows screen reader user. gnuCash was the app I tried and it was pretty rough going. Worked like a dream in Gnome with Orca though. Apparently, it's like this, if you want windows accessibility, use QT and WxWidgets. If you want Linux, use gtk+. QT is going to be accessible in Linux apparently though this is yet to be (not till gnome 3, I think). Pity you had to abandon WxWidgets. I personally like their widgets since it has those sizers which take much of the guess work out of placement of controls. Important when you can't see and you want to build a gui. Looks like about the only cross-platform accessibility solutions right now are Xul and SWT (Java, you know). Sad thing about WxWidgets is that this sort of thing was reported to them two years ago but nothing seems to have been done about it.
http://trac.wxwidgets.org/ticket/9785
I would be delighted to know that I am wrong about this. I doubt it, though.

User Interface clarifications

As you know, many programs are written in C++.
Some of these have fancy GUI with non-classical-Windows style ( think to Photoshop, 3ds max, maya etc )..now my question is: how are they done? In pure Win32 API? MFC? DirectX/OpenGL? or other?
I can reach similar results with C#/WPF but how can I do it in C++?
Read Programming Windows by Petzold
In my experience, it seems to be the most practical way to learn Win32 programming.
If you care about cool effects, Petzold can definitely help you. After you're somewhat familiar with win32, you can skip to the chapter in Petzold to bitblt'ng and doing animation. I had to do some fancy animated graphs in a win32 app once, and I pretty much used Petzold (and some MSDN) as my primary reference.
It really depends on the application and the team that made it. So the answer is all of the above. If you see them doing something that looks off-beat and it looks the same on both windows and mac (assuming its cross platform) they have probably built their own GUI engine. Doing that lets them do custom things to suit their product.

searching for winapi functions

I'm learning programing windows applications with C++. Now I'm reading about messages and I'm playing with the spy++.
What function spy++ use in order to mark/highlight the window under mouse cursor?
Also, can you give me some tips about using MSDN? I'm my opinion is not user friendly at all.
I'm learning programming by myself and i can't get some real life experience tips as those which are learning at college or in teams.
ty
Not sure exactly what your problem with MSDN is ... I tend to go to e.g. Win32 and COM development and look around for a suitable category in the listing to the left, then click down from there. Or just enter function names and search if I already know what I'm looking for but want the reference documentation. On the other hand, I'm not much of a Win32 developer.
I think spy++ is just inverting the colors directly on the window/screen DC (You could use InvertRect() for example) On Windows 2000 and later, it is probably better to use a translucent layered window if you actually wanted to implement this window highlight since some graphic corruption can occur when messing with other windows behind their back.
Writing a Windows application with just the windows API is possible, but you'll end up writing huge amounts of boilerplate code just to create simple things. This is why people normally use libraries built on top of it to make things easier - MFC for example.
The MSDN article Creating Win32 Applications provides a good explanation of the ins-and-outs of a Windows application using the Win32 API. Bare in mind though that you could build the same application in minutes using MFC.
I agree that MSDN is not the most user friendly source of information for a beginner. In my opinion it works much better as a reference.
My advice would be to focus on building some test applications using MFC (assuming you are tied to C++ as a language). Try looking at the codeproject MFC sections for example, and perhaps even buy a book to help get you started. This does of course require Visual Studio, but you can download the free express edition here

User Interface Controls for Win32

I see many user interface control libraries for .NET, but where can I get similar stuff for win32 using simply C/C++?
Things like prettier buttons, dials, listviews, graphs, etc.
Seems every Win32 programmers' right of passage is to end up writing his own collection. :/
No MFC controls please. I only do pure C/C++. And with that said, I also don't feel like adding a multi-megabyte framework to my application just so that I can have a prettier button.
I apologize for leaving out one tiny detail, and that is that my development is for Windows Mobile.
So manifest files are out.
I just notice how many developer companies have gone crazy with making pretty looking .NET components and wondered where the equivalent C/C++ Win32 components have gone?
I read about how many people ended up writing their own gradient button class, etc. So you would think that there would be some commercial classes for this stuff. It's just weird.
I'll take a closer look at QT and investigate its GUI support for such things. This is the challenge when you're the one man in your own uISV. No other developers to help you "get things done".
I've used Trolltech's Qt framework in the past and had great success with it:
In addition, it's also cross-platform, so in theory you can target Win, Mac, & Linux (provided you don't do anything platform-specific in the rest of your code, of course ;) )
Edit: I notice that you're targeting Windows Mobile; that definitely adds to Qt's strength, as its cross-platform support extends to WinCE and Embedded Linux as well.
The Code Project has lots of UI controls for C/C++
Most of them are focussed on MFC or WTL but there are some that are pure Win32.
As an aside if you're not using a framework, you really should consider WTL over pure Win32. It's low overhead and about a million times more productive.
For prettier buttons, etc., if you aren't already doing it, embed an application manifest so that your program is linked to version 6 of the common controls library. Doing so will get you the Windows XP- or Vista-styled versions of the standard Windows controls.
If you want types of controls beyond what Windows offers natively, you'll likely have to either write it yourself or be more specific about what kind of control you are looking for.
I you don't mind using the MFC libraries you should try the Visual C++ 2008 Feature Pack
Stingray
CodeJock - Toolkit Pro for MFC/ C++
The MFC feature pack is derived from BCGSoft components.
Using winAPI's you can do almost anything you want and really fast too. It takes some time to figure it out but it works. Go to MSDN, lookup MessageBox(), check out DialogBox() and go from there.
I personally do not care for MFC by the way. If you want to use an MFC like approach I'd recommend Borland's C++ Builder. Pretty old but still very usefull I think.