How to resolve the algorithm GUI/Maximum window dimensions step by step in the Nim programming language
How to resolve the algorithm GUI/Maximum window dimensions step by step in the Nim programming language
Table of Contents
Problem Statement
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations and menubars. The idea is to determine the physical display parameters for the maximum height and width of the usable display area in pixels (without scrolling). The values calculated should represent the usable desktop area of a window maximized to fit the the screen.
For multiple monitors, the values calculated should represent the size of the usable display area on the monitor which is related to the task (i.e.: the monitor which would display a window if such instructions were given). For a tiling window manager, the values calculated should represent the maximum height and width of the display area of the maximum size a window can be created (without scrolling). This would typically be a full screen window (minus any areas occupied by desktop bars), unless the window manager has restrictions that prevents the creation of a full screen window, in which case the values represent the usable area of the desktop that occupies the maximum permissible window size (without scrolling).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm GUI/Maximum window dimensions step by step in the Nim programming language
Source code in the nim programming language
import
gtk2, gdk2
nim_init()
var w = gdk2.screen_width()
var h = gdk2.screen_height()
echo("WxH=",w,"x",h)
import glib2, gtk2
proc printSize(window: PWindow): guint {.cdecl.} =
var width, height: gint
window.get_size(addr(width), addr(height))
echo "W x H = ", width, " x ", height
main_quit()
nim_init()
let window = window_new(WINDOW_TOPLEVEL)
window.maximize()
window.show_all()
discard g_timeout_add(100, printSize, addr(window[]))
main()
import gintro/[glib, gobject, gtk, gio]
var window: ApplicationWindow
#---------------------------------------------------------------------------------------------------
proc printSize(data: pointer): gboolean {.cdecl.} =
var width, height: int
window.getSize(width, height)
echo "W x H = ", width, " x ", height
window.destroy()
#---------------------------------------------------------------------------------------------------
proc activate(app: Application) =
## Activate the application.
window = app.newApplicationWindow()
window.maximize()
window.showAll()
discard timeoutAdd(PRIORITY_DEFAULT, 100, SourceFunc(printSize), nil, nil)
#———————————————————————————————————————————————————————————————————————————————————————————————————
let app = newApplication(Application, "Rosetta.ScreenSize")
discard app.connect("activate", activate)
discard app.run()
import
iup
# assumes you have the iup .dll or .so installed
discard iup.open(nil,nil)
var scrnFullSize = GetGlobal("FULLSIZE")
var scrnSize = GetGlobal("SCREENSIZE")
var scrnMInfo = GetGlobal("MONITORSINFO")
var scrnVScreen = GetGlobal("VIRTUALSCREEN")
var dlg = Dialog(nil)
SetAttribute(dlg, "SIZE", "FULL")
var scrnXSize = GetAttribute(dlg,"MAXSIZE")
echo scrnFullSize, "\n", scrnSize, "\n", scrnMInfo, "\n", scrnVScreen, "\n", scrnXSize
discard iup.Alarm("Screen client size", scrnFullSize ,"Ok",nil, nil)
#discard iup.mainloop()
iup.close()
You may also check:How to resolve the algorithm Program name step by step in the Objective-C programming language
You may also check:How to resolve the algorithm Loops/For step by step in the 11l programming language
You may also check:How to resolve the algorithm Fast Fourier transform step by step in the ooRexx programming language
You may also check:How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the Bracmat programming language
You may also check:How to resolve the algorithm Sorting algorithms/Comb sort step by step in the PowerShell programming language