https://en.wikipedia.org/wiki/Graphical_user_interface
Usually, a server program collects user input and turns them into event messages (mouse moved, button clicked, etc.) which certain clients (including your application) can receive and then respond to.
On Unix-like systems, there is a distinct server program (e.g., an
X Server) whose job it is to manage displays (whatever they may be) and collect inputs for graphical programs (clients) to consume. There's often a client called a window manager, whose purpose is to let you drag around windows on the screen, resize and position them, and so forth. On Windows, all of this functionality is baked into the operating system, but the functionality is the same.
A typical client (i.e., not a video game) will create some buttons or something, and then proceed to wait for that button to be clicked. When the user clicks that button, the server catches it and eventually sends it back to the client.
The idea is
event-driven programming.
Are DirectX and OpenGL GUIs? |
No. They are low-level interfaces to hardware for stuff like high-performance 3d graphics.
What should I study or read to be able to build my own GUI? |
It depends on what you want to make, and on which platforms.