Cool_Coder
Cool_Coder

Reputation: 5073

Graphics using Standard C++ only?

I just want to know whether Standard C++ allows GUI programming?

There are 2 aspects of this:

  1. Widgets for UI like window, dialog, push button, etc
  2. Graphics like drawing circle, rectangle, spline, etc

I have been using Qt for my UI & haven't seen anybody doing GUI in C++ only.

PS: I am concerned with C++ language only, I know that Java allows GUI programming!

UPDATE: A new question was added here: How frameworks like Qt create GUI, if C++ has no functionality for that?

Upvotes: 9

Views: 11749

Answers (6)

GuessWhoIam
GuessWhoIam

Reputation: 1

If you’re using c++ on windows, the libraries that came with the compiler have windows.h, which can preform GUI operations and graphics(GDI).

Upvotes: 0

MSalters
MSalters

Reputation: 179789

No, this isn't possible. C++ works on many devices, some of which simply don't have that capability.

Qt can do this, usually because the Operating Systems on which it runs do offer that functionality. It's usually exposed as a set of C functions, which in practice means they're callable by the C++ code in Qt. What the OS uses internally, who knows. It may even leave some of the work to the GPU nowadays.

And on some embedded systems, Qt just gets a pointer to the screen memory, and does all the pixel manipulations itself. That's not a solution when you have to share the screen with multiple applications, but for single-function devices it definitely works.

Upvotes: 7

Daniel Martín
Daniel Martín

Reputation: 7845

No, it's not included. You may want to read the explanation from the language creator: http://www.stroustrup.com/bs_faq.html#gui

GUI frameworks use the low-level facilities provided by the operating system API or the window manager API.

Upvotes: 3

ForEveR
ForEveR

Reputation: 55887

No. There is nothing about GUI in C++ standard.

Frameworks use OS facilities. Standard C++ - no.

Upvotes: 4

CB Bailey
CB Bailey

Reputation: 791709

It allows it, in the sense that it doesn't restrict the ability of an implementation to make available GUI facilities should it choose.

The standard doesn't required a GUI environment to be available - lots of implementations' run time environments don't have one available so there is no mandated standard interface.

There is also no standardized optional GUI interface, either.

Upvotes: 2

Alexey Frunze
Alexey Frunze

Reputation: 62048

Standard C++ does not prohibit GUI programming (IOW, it allows it), but at the same time it does not provide any standard library functionality for that. That's beyond the scope of the language and its standard library and is OS/platform-specific.

About the only thing graphics you can do in plain C++ directly is ASCII art. :)

Upvotes: 1

Related Questions