1----------------------------------------------------------------------- 2-- GtkAda - Ada95 binding for Gtk+/Gnome -- 3-- -- 4-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 5-- Copyright (C) 2000-2013, AdaCore -- 6-- -- 7-- This library is free software; you can redistribute it and/or -- 8-- modify it under the terms of the GNU General Public -- 9-- License as published by the Free Software Foundation; either -- 10-- version 2 of the License, or (at your option) any later version. -- 11-- -- 12-- This library is distributed in the hope that it will be useful, -- 13-- but WITHOUT ANY WARRANTY; without even the implied warranty of -- 14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 15-- General Public License for more details. -- 16-- -- 17-- You should have received a copy of the GNU General Public -- 18-- License along with this library; if not, write to the -- 19-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- 20-- Boston, MA 02111-1307, USA. -- 21-- -- 22-- As a special exception, if other files instantiate generics from -- 23-- this unit, or you link this unit with other files to produce an -- 24-- executable, this unit does not by itself cause the resulting -- 25-- executable to be covered by the GNU General Public License. This -- 26-- exception does not however invalidate any other reasons why the -- 27-- executable file might be covered by the GNU Public License. -- 28----------------------------------------------------------------------- 29 30-- <description> 31-- This widget implements a top level window. 32-- It is used as the base class for dialogs, ... 33-- 34-- A window has both a default widget (to which events are sent if no other 35-- widget has been selected and has the focus), and a focus widget (which 36-- gets the events and overrides the default widget). 37-- 38-- You can set many hints on the window (its minimum and maximum size, its 39-- decoration, etc.) but these are only hints to the window manager, which 40-- might not respect them. 41-- 42-- A useful hint, respected by most window managers, can be used to force 43-- some secondary windows to stay on top of the main window on the screen 44-- (for instance, so that a smaller window can not be hidden by a bigger 45-- one). See the function Set_Transient_For below. 46-- 47-- A window can also be modal, i.e. grab all the mouse and keyboard events 48-- in the application while it is displayed. 49-- 50-- </description> 51-- <c_version>2.16.6</c_version> 52-- <group>Windows</group> 53-- <screenshot>gtk-window</screenshot> 54 55with Glib.Object; 56with Glib.Properties; 57with Gdk.Event; 58with Gdk.Pixbuf; 59with Gdk.Types; 60with Gdk.Window; 61with Gtk.Accel_Group; 62with Gtk.Bin; 63with Gtk.Enums; 64with Gtk.Widget; 65 66package Gtk.Window is 67 68 type Gtk_Window_Record is new Bin.Gtk_Bin_Record with private; 69 type Gtk_Window is access all Gtk_Window_Record'Class; 70 71 type Gtk_Window_Group_Record is 72 new Glib.Object.GObject_Record with null record; 73 type Gtk_Window_Group is access all Gtk_Window_Group_Record'Class; 74 75 procedure Gtk_New 76 (Window : out Gtk_Window; 77 The_Type : Gtk.Enums.Gtk_Window_Type := Gtk.Enums.Window_Toplevel); 78 -- Create a new window. 79 -- The_Type specifies the type of the window, and can be either a 80 -- top level window, a dialog or a popup window. You will most often only 81 -- need to use Window_Toplevel, the other types are mostly used internally 82 -- by gtk+. 83 -- A Popup window is used to display a temporary information window. It has 84 -- no borders nor resizing handles. 85 86 procedure Initialize 87 (Window : access Gtk_Window_Record'Class; 88 The_Type : Gtk.Enums.Gtk_Window_Type); 89 -- Internal initialization function. 90 -- See the section "Creating your own widgets" in the documentation. 91 92 function Get_Type return Glib.GType; 93 -- Return the internal value associated with a Gtk_Window. 94 95 procedure Set_Title 96 (Window : access Gtk_Window_Record; Title : UTF8_String); 97 function Get_Title (Window : access Gtk_Window_Record) return UTF8_String; 98 -- Change the title of the window, as it appears in the title bar. 99 -- Note that on some systems you might not be able to change it. 100 101 procedure Set_Wmclass 102 (Window : access Gtk_Window_Record; 103 Wmclass_Name : String; 104 Wmclass_Class : String); 105 -- Don't use this function. It sets the X Window System "class" and 106 -- "name" hints for a window. According to the ICCCM, you should 107 -- always set these to the same value for all windows in an 108 -- application, and GTK sets them to that value by default, so calling 109 -- this function is sort of pointless. However, you may want to call 110 -- Set_Role on each window in your application, for the 111 -- benefit of the session manager. Setting the role allows the window 112 -- manager to restore window positions when loading a saved session. 113 114 procedure Set_Role (Window : access Gtk_Window_Record; Role : String); 115 function Get_Role (Window : access Gtk_Window_Record) return String; 116 -- In combination with the window title, the window role allows a 117 -- window manager to identify "the same" window when an application is 118 -- restarted. So for example you might set the "toolbox" role on your 119 -- app's toolbox window, so that when the user restarts their session, 120 -- the window manager can put the toolbox back in the same place. 121 -- If a window already has a unique title, you don't need to set the 122 -- role, since the WM can use the title to identify the window when 123 -- restoring the session. 124 -- Role: unique identifier for the window to be used when restoring a 125 -- session 126 127 function Activate_Focus (Window : access Gtk_Window_Record) return Boolean; 128 -- Call Gtk.Widget.Activate on the widget that currently has the focus in 129 -- the window, ie sends an "activate" signal to that widget. Note that this 130 -- signal does not really exists and is mapped to some widget-specific 131 -- signal. 132 -- Return True if the widget could be activated, False otherwise. 133 -- The Focus widget is set through a signal "set_focus". 134 135 function Activate_Default 136 (Window : access Gtk_Window_Record) return Boolean; 137 -- Activate the default widget in the window. 138 -- In other words, send an "activate" signal to that widget. Note that 139 -- this signal is a virtual one and is mapped to some widget specific 140 -- signal. 141 -- Return False is the widget could not be activated or if there was 142 -- no default widget. 143 -- You can set the default widget with the following calls: 144 -- 145 -- Gtk.Widget.Set_Flags (Widget, Can_Default); 146 -- Gtk.Widget.Grab_Default (Widget); 147 148 procedure Set_Transient_For 149 (Window : access Gtk_Window_Record; 150 Parent : access Gtk_Window_Record'Class); 151 function Get_Transient_For 152 (Window : access Gtk_Window_Record) return Gtk_Window; 153 -- Specify that Window is a transient window. 154 -- A transient window is a temporary window, like a popup menu or a 155 -- dialog box). Parent is the toplevel window of the application to which 156 -- Window belongs. A window that has set this can expect less decoration 157 -- from the window manager (for instance no title bar and no borders). 158 -- (see XSetTransientForHint(3) on Unix systems) 159 -- 160 -- The main usage of this function is to force Window to be on top of 161 -- Parent on the screen at all times. Most window managers respect this 162 -- hint, even if this is not mandatory. 163 164 procedure Set_Type_Hint 165 (Window : access Gtk_Window_Record; 166 Hint : Gdk.Window.Gdk_Window_Type_Hint); 167 function Get_Type_Hint 168 (Window : access Gtk_Window_Record) 169 return Gdk.Window.Gdk_Window_Type_Hint; 170 -- allow the window manager to decorate and handle the window in a way 171 -- which is suitable to the function of the window in your application. 172 -- This function should be called before the window becomes visible. 173 174 procedure Set_Keep_Above 175 (Window : access Gtk_Window_Record; Setting : Boolean); 176 procedure Set_Keep_Below 177 (Window : access Gtk_Window_Record; Setting : Boolean); 178 -- Asks to keep Window above, so that it stays on top. Note that you 179 -- shouldn't assume the window is definitely above afterward, because other 180 -- entities (e.g. the user or window managers) could not keep it above, and 181 -- not all window managers support keeping windows above. But normally the 182 -- window will end kept above. Just don't write code that crashes if not. 183 -- 184 -- It's permitted to call this function before showing a window, in which 185 -- case the window will be kept above when it appears onscreen initially. 186 -- 187 -- You can track the above state via the "window_state_event" signal on 188 -- Window. 189 -- 190 -- Note that, according to the "Extended Window Manager Hints" 191 -- specification, the above state is mainly meant for user preferences and 192 -- should not be used by applications e.g. for drawing attention to their 193 -- dialogs. 194 195 procedure Set_Auto_Startup_Notification (Setting : Boolean); 196 -- By default, after showing the first Window for each screen, GTK+ calls 197 -- gdk_notify_startup_complete(). Call this function to disable the 198 -- automatic startup notification. You might do this if your first window 199 -- is a splash screen, and you want to delay notification until after your 200 -- real main window has been shown, for example. 201 -- 202 -- In that example, you would disable startup notification temporarily, 203 -- show your splash screen, then re-enable it so that showing the main 204 -- window would automatically result in notification. 205 -- 206 -- Notification is used by the desktop environment to show the user that 207 -- your application is still loading. 208 209 procedure Set_Startup_Id 210 (Window : access Gtk_Window_Record; 211 Startup_Id : String); 212 -- Startup notification identifiers are used by desktop environment to 213 -- track application startup, to provide user feedback and other 214 -- features. This function changes the corresponding property on the 215 -- underlying Gdk_Window. Normally, startup identifier is managed 216 -- automatically and you should only use this function in special cases 217 -- like transferring focus from other processes. You should use this 218 -- function before calling Present or any equivalent function generating 219 -- a window map event. 220 -- 221 -- This function is only useful on X11, not with other GTK+ targets. 222 223 function Get_Deletable (Window : access Gtk_Window_Record) return Boolean; 224 procedure Set_Deletable 225 (Window : access Gtk_Window_Record; 226 Setting : Boolean); 227 -- By default, windows have a close button in the window frame. Some 228 -- window managers allow GTK+ to disable this button. If you set the 229 -- deletable property to False using this function, GTK+ will do its best 230 -- to convince the window manager not to show a close button. Depending on 231 -- the system, this function may not have any effect when called on a 232 -- window that is already visible, so you should call it before calling 233 -- Gtk.Window.Show. 234 -- 235 -- On Windows, this function always works, since there's no window manager 236 -- policy involved. 237 238 procedure Set_Destroy_With_Parent 239 (Window : access Gtk_Window_Record; 240 Setting : Boolean := True); 241 function Get_Destroy_With_Parent 242 (Window : access Gtk_Window_Record) return Boolean; 243 -- Set whether destroying the transient parent of Window will also destroy 244 -- Window itself. 245 -- This is useful for dialogs that shouldn't persist beyond the lifetime 246 -- of the main window they're associated with, for example. 247 248 procedure Set_Geometry_Hints 249 (Window : access Gtk_Window_Record; 250 Geometry_Widget : Gtk.Widget.Gtk_Widget; 251 Geometry : Gdk.Window.Gdk_Geometry; 252 Geom_Mask : Gdk.Window.Gdk_Window_Hints); 253 -- Specify some geometry hints for the window. 254 -- This includes its minimal and maximal sizes, ... 255 -- These attributes are specified in Geometry. 256 -- Geom_Mask indicates which of the fields in Geometry are set. 257 -- Geometry_Widget can be null (and thus is not an access parameter). It 258 -- adds some extra size to Geometry based on the actual size of 259 -- Geometry_Widget (the extra amount is Window'Size - Geometry_Widget'Size) 260 -- 261 -- Geometry.Base_* indicates the size that is used by the window manager 262 -- to report the size: for instance, if Base_Width = 600 and actual width 263 -- is 200, the window manager will indicate a width of -400. 264 -- 265 -- If your window manager respects the hints (and its doesn't have to), 266 -- then the user will never be able to resize the window to a size not 267 -- in Geometry.Min_* .. Geometry.Max_*. 268 -- 269 -- Geometry.*_Inc specifies by which amount the size will be multiplied. 270 -- For instance, if Width_Inc = 50 and the size reported by the Window 271 -- Manager is 2x3, then the actual width of the window is 100. 272 -- Your window's size will always be a multiple of the *_Inc values. 273 -- 274 -- Geometry.*_Aspect specifies the aspect ratio for the window. The window 275 -- will always be resized so that the ratio between its width and its 276 -- height remains in the range Min_Aspect .. Max_Aspect. 277 278 procedure Set_Decorated 279 (Window : access Gtk_Window_Record; 280 Setting : Boolean := True); 281 function Get_Decorated (Window : access Gtk_Window_Record) return Boolean; 282 -- By default, windows are decorated with a title bar, resize 283 -- controls, etc. Some window managers allow GtkAda to disable these 284 -- decorations, creating a borderless window. If you set the decorated 285 -- property to False using this function, GtkAda will do its best to 286 -- convince the window manager not to decorate the window. 287 288 procedure Set_Modal 289 (Window : access Gtk_Window_Record; Modal : Boolean := True); 290 function Get_Modal (Window : access Gtk_Window_Record) return Boolean; 291 -- Define the window as being Modal. 292 -- It will grab the input from the keyboard and the mouse while it is 293 -- displayed and will release it when it is hidden. The grab is only in 294 -- effect for the windows that belong to the same application, and will not 295 -- affect other applications running on the same screen. 296 -- In cunjunction with Gtk.Main.Main, this is the easiest way to show a 297 -- dialog to which the user has to answer before the application can 298 -- continue. 299 300 procedure Set_Skip_Pager_Hint 301 (Window : access Gtk_Window_Record; 302 Setting : Boolean); 303 function Get_Skip_Taskbar_Hint 304 (Window : access Gtk_Window_Record) 305 return Boolean; 306 -- Windows may set a hint asking the desktop environment not to display 307 -- the window in the pager. This function sets this hint. 308 -- (A "pager" is any desktop navigation tool such as a workspace 309 -- switcher that displays a thumbnail representation of the windows 310 -- on the screen). 311 312 procedure Set_Skip_Taskbar_Hint 313 (Window : access Gtk_Window_Record; 314 Setting : Boolean); 315 function Get_Skip_Pager_Hint 316 (Window : access Gtk_Window_Record) 317 return Boolean; 318 -- Windows may set a hint asking the desktop environment not to display 319 -- the window in the task bar. This function sets this hint. 320 321 procedure Set_Urgency_Hint 322 (Window : access Gtk_Window_Record; 323 Setting : Boolean); 324 function Get_Urgency_Hint 325 (Window : access Gtk_Window_Record) 326 return Boolean; 327 -- Windows may set a hint asking the desktop environment to draw 328 -- the users attention to the window. This function sets this hint. 329 330 function List_Toplevels return Gtk.Widget.Widget_List.Glist; 331 -- Return a list of all existing toplevel windows. 332 -- The widgets in the list are not individually referenced. If you want 333 -- to iterate through the list and perform actions involving 334 -- callbacks that might destroy the widgets, you must "ref"erence 335 -- all the widgets in the list first and then unref all the widgets 336 -- afterwards. 337 -- The list itself must be freed by the caller 338 339 procedure Present (Window : access Gtk_Window_Record); 340 -- Present a window to the user. 341 -- This may mean raising the window in the stacking order, deiconifying it, 342 -- moving it to the current desktop, and/or giving it the keyboard focus, 343 -- possibly dependent on the user's platform, window manager, and 344 -- preferences. 345 -- 346 -- If Window is hidden, this function calls Gtk.Widget.Show as well. 347 -- 348 -- If you are calling this function in response to a user interaction, it 349 -- is preferable to use Present_With_Time. 350 351 procedure Present_With_Time 352 (Window : access Gtk_Window_Record; 353 Timestamp : Guint32); 354 -- Present a window to the user in response to a user interaction. 355 -- Timestamp is the timestamp of the user interaction (typically a button 356 -- or key press event) which triggered this call. 357 -- 358 -- This function should be used when the user tries to open a window 359 -- that's already open. Say for example the preferences dialog is 360 -- currently open, and the user chooses Preferences from the menu 361 -- a second time; use Present to move the already-open dialog 362 -- where the user can see it. 363 364 procedure Stick (Window : access Gtk_Window_Record); 365 -- Ask to stick Window, which means that it will appear on all user 366 -- desktops. Note that you shouldn't assume the window is definitely 367 -- stuck afterward, because other entities (e.g. the user or window 368 -- manager) could unstick it again, and some window managers do not 369 -- support sticking windows. But normally the window will end up 370 -- stuck. 371 -- 372 -- It's permitted to call this function before showing a window. 373 -- 374 -- You can track stickiness via the "window_state_event" signal 375 -- on Gtk_Widget. 376 377 procedure Unstick (Window : access Gtk_Window_Record); 378 -- Ask to unstick Window, which means that it will appear on only 379 -- one of the user's desktops. Note that you shouldn't assume the 380 -- window is definitely unstuck afterward, because other entities 381 -- (e.g. the user or window manager) could stick it again. But 382 -- normally the window will end up stuck. 383 -- 384 -- You can track stickiness via the "window_state_event" signal 385 -- on Gtk_Widget. 386 387 function Get_Opacity (Window : access Gtk_Window_Record) return Gdouble; 388 procedure Set_Opacity 389 (Window : access Gtk_Window_Record; 390 Opacity : Gdouble); 391 -- Request the windowing system to make Window partially transparent, 392 -- with opacity 0.0 being fully transparent and 1.0 fully opaque. (Values 393 -- of the opacity parameter are clamped to the [0.0,1.0] range.) On X11 394 -- this has any effect only on X screens with a compositing manager 395 -- running. See Gtk.Widget.Is_Composited. On Windows it should always work. 396 -- 397 -- Note that on Windows, setting a window's opacity after the window has 398 -- been shown causes it to flicker once. 399 400 -------------- 401 -- Position -- 402 -------------- 403 404 procedure Move (Window : access Gtk_Window_Record; X, Y : Gint); 405 -- Asks the window manager to move Window to the given position. Window 406 -- managers are free to ignore this; most window managers ignore requests 407 -- for initial window positions (instead using a user-defined placement 408 -- algorithm) and honor requests after the window has already been shown. 409 -- 410 -- Note: the position is the position of the gravity-determined reference 411 -- point for the window. The gravity determines two things: first, the 412 -- location of the reference point in root window coordinates; and second, 413 -- which point on the window is positioned at the reference point. 414 -- 415 -- By default the gravity is GRAVITY_NORTH_WEST, so the reference point is 416 -- simply the (x, y) supplied to Move. The top-left corner of the window 417 -- decorations (aka window frame or border) will be placed at (x, y). 418 -- Therefore, to position a window at the top left of the screen, you want 419 -- to use the default gravity (which is GRAVITY_NORTH_WEST) and move the 420 -- window to 0,0. 421 -- 422 -- To position a window at the bottom right corner of the screen, you would 423 -- set GRAVITY_SOUTH_EAST, which means that the reference point is at x + 424 -- the window width and y + the window height, and the bottom-right corner 425 -- of the window border will be placed at that reference point. So, to 426 -- place a window in the bottom right corner you would first set gravity to 427 -- south east, then write: 428 -- Move (Window, Gdk_Screen_Width - Window_Width, 429 -- Gdk_Screen_Height - Window_Height); 430 431 procedure Set_Position 432 (Window : access Gtk_Window_Record; 433 Position : Gtk.Enums.Gtk_Window_Position); 434 -- Specify how the position of the window should be computed. 435 -- If Position is Win_Pos_Center_Always or Win_Pos_Center, then the window 436 -- is centered on the screen. In the first case, it is also recentered 437 -- when the window is resized with Gtk.Widget.Set_Usize (ie except on 438 -- user action). 439 -- If Position is Win_Pos_Mouse, then the window is positioned so that it 440 -- centered around the mouse. 441 -- If Position is Win_Pos_None, no calculation is done. If 442 -- Gtk.Widget.Set_Uposition has been called, it is respected. This is the 443 -- default case. 444 445 procedure Get_Position 446 (Window : access Gtk_Window_Record; 447 Root_X, Root_Y : out Gint); 448 -- This function returns the position you need to pass to gtk.window.move 449 -- to keep Window in its current position. This means that the meaning of 450 -- the returned value varies with window gravity. See Gtk.Window.Move for 451 -- more details. 452 -- 453 -- If you haven't changed the window gravity, its gravity will be 454 -- GRAVITY_NORTH_WEST. This means that Get_Position gets the position of 455 -- the top-left corner of the window manager frame for the window. 456 -- gtk.window.move sets the position of this same top-left corner. 457 -- 458 -- Get_Position is not 100% reliable because the X Window System does not 459 -- specify a way to obtain the geometry of the decorations placed on a 460 -- window by the window manager. Thus GTK+ is using a "best guess" that 461 -- works with most window managers. 462 -- 463 -- Moreover, nearly all window managers are historically broken with 464 -- respect to their handling of window gravity. So moving a window to its 465 -- current position as returned by Get_Position tends to result in moving 466 -- the window slightly. Window managers are slowly getting better over 467 -- time. 468 -- 469 -- If a window has gravity GRAVITY_STATIC the window manager frame is not 470 -- relevant, and thus Get_Position will always produce accurate results. 471 -- However you can't use static gravity to do things like place a window in 472 -- a corner of the screen, because static gravity ignores the window 473 -- manager decorations. 474 -- 475 -- If you are saving and restoring your application's window positions, you 476 -- should know that it's impossible for applications to do this without 477 -- getting it somewhat wrong because applications do not have sufficient 478 -- knowledge of window manager state. The Correct Mechanism is to support 479 -- the session management protocol (see the "GnomeClient" object in the 480 -- GNOME libraries for example) and allow the window manager to save your 481 -- window sizes and positions. 482 483 procedure Begin_Move_Drag 484 (Window : access Gtk_Window_Record; 485 Button : Gint; 486 Root_X : Gint; 487 Root_Y : Gint; 488 Timestamp : Guint32); 489 -- Starts moving a window. This function is used if an application has 490 -- window movement grips. When GDK can support it, the window movement will 491 -- be done using the standard mechanism for the window manager or windowing 492 -- system. Otherwise, GDK will try to emulate window movement, potentially 493 -- not all that well, depending on the windowing system. 494 -- (Root_X, Root_Y): Position where the user clicked to initiate the drag, 495 -- in root window coordinates. Timestamp is the timestamp of the event that 496 -- initiated the drag 497 498 function Parse_Geometry 499 (Window : access Gtk_Window_Record; 500 Geometry : String) 501 return Boolean; 502 -- Parses a standard X Window System geometry string - see the manual page 503 -- for X (type 'man X') for details on this. Parse_Geometry does work on 504 -- all GTK+ ports including Win32 but is primarily intended for an X 505 -- environment. 506 -- 507 -- If either a size or a position can be extracted from the geometry 508 -- string, Parse_Geometry returns True and calls Set_Default_Size and/or 509 -- Move to resize/move the window. 510 -- 511 -- If Parse_Geometry returns True, it will also set the HINT_USER_POS 512 -- and/or HINT_USER_SIZE hints indicating to the window manager that the 513 -- size/position of the window was user-specified. This causes most window 514 -- managers to honor the geometry. 515 -- 516 -- Note that for Parse_Geometry to work as expected, it has to be called 517 -- when the window has its "final" size, i.e. after calling Show_All on the 518 -- contents and Set_Geometry_Hints on the window. 519 520 ----------- 521 -- Sizes -- 522 ----------- 523 524 procedure Set_Resizable 525 (Window : access Gtk_Window_Record; 526 Resizable : Boolean := True); 527 function Get_Resizable (Window : access Gtk_Window_Record) return Boolean; 528 -- Sets or gets whether the user can resize a window. 529 -- Windows are user resizable by default. 530 531 procedure Set_Gravity 532 (Window : access Gtk_Window_Record; 533 Gravity : Gdk.Window.Gdk_Gravity); 534 function Get_Gravity 535 (Window : access Gtk_Window_Record) return Gdk.Window.Gdk_Gravity; 536 -- Window gravity defines the "reference point" to be used when 537 -- positioning or resizing a window. Calls to 538 -- Gtk.Widget.Set_UPosition will position a different point on the 539 -- window depending on the window gravity. When the window changes size 540 -- the reference point determined by the window's gravity will stay in 541 -- a fixed location. 542 -- 543 -- See Gdk_Gravity for full details. To briefly summarize, 544 -- Gravity_North_West means that the reference point is the 545 -- northwest (top left) corner of the window 546 -- frame. Gravity_South_East would be the bottom right corner of 547 -- the frame, and so on. If you want to position the window contents, 548 -- rather than the window manager's frame, Gravity_Static moves 549 -- the reference point to the northwest corner of the Gtk_Window 550 -- itself. 551 -- 552 -- The default window gravity is Gravity_North_West. 553 554 procedure Set_Has_Frame (Window : access Gtk_Window_Record); 555 function Get_Has_Frame (Window : access Gtk_Window_Record) return Boolean; 556 -- If this function is called on a window before it is realized 557 -- or showed it will have a "frame" window around widget-window. 558 -- Using the signal frame_event you can receive all events targeted at the 559 -- frame. 560 -- 561 -- This function is used by the linux-fb port to implement managed 562 -- windows, but it could concievably be used by X-programs that 563 -- want to do their own window decorations. 564 565 procedure Set_Frame_Dimensions 566 (Window : access Gtk_Window_Record; 567 Left, Top, Right, Bottom : Gint); 568 procedure Get_Frame_Dimensions 569 (Window : access Gtk_Window_Record; 570 Left, Top, Right, Bottom : out Gint); 571 -- Change the size of the frame border. 572 -- This has only an effect for windows with frames (see Set_Has_Frame). 573 574 procedure Fullscreen (Window : access Gtk_Window_Record); 575 procedure Unfullscreen (Window : access Gtk_Window_Record); 576 -- Ask to place Window in fullscreen state. 577 -- You shouldn't assume the window is definitely full screen afterward, 578 -- because other entities (user or window manager) could unfullscreen it 579 -- again and not all window managers honor requests to fullscreen windows. 580 -- You can track the fullscreen state via the "window_state_event" signal. 581 582 procedure Iconify (Window : access Gtk_Window_Record); 583 -- Ask to iconify Window. 584 -- Note that you shouldn't assume the window is definitely iconified 585 -- afterward, because other entities (e.g. the user or window manager) 586 -- could deiconify it again, or there may not be a window manager in which 587 -- case iconification isn't possible, etc. But normally the window will end 588 -- up iconified. Just don't write code that crashes if not. 589 -- 590 -- It's permitted to call this function before showing a window, 591 -- in which case the window will be iconified before it ever appears 592 -- onscreen. 593 -- 594 -- You can track iconification via the "window_state_event" signal 595 -- on Gtk_Widget. 596 597 procedure Deiconify (Window : access Gtk_Window_Record); 598 -- Ask to deiconify Window. 599 -- Note that you shouldn't assume the window is definitely deiconified 600 -- afterward, because other entities (e.g. the user or window manager) 601 -- could iconify it again before your code which assumes deiconification 602 -- gets to run. 603 -- 604 -- You can track iconification via the "window_state_event" signal 605 -- on Gtk_Widget. 606 607 procedure Maximize (Window : access Gtk_Window_Record); 608 -- Ask to maximize Window, so that it becomes full-screen. 609 -- Note that you shouldn't assume the window is definitely maximized 610 -- afterward, because other entities (e.g. the user or window manager) 611 -- could unmaximize it again, and not all window managers support 612 -- maximization. But normally the window will end up maximized. 613 -- 614 -- It's permitted to call this function before showing a window, 615 -- in which case the window will be maximized when it appears onscreen 616 -- initially. 617 -- 618 -- You can track maximization via the "window_state_event" signal 619 -- on Gtk_Widget. 620 621 procedure Unmaximize (Window : access Gtk_Window_Record); 622 -- Ask to unmaximize Window. 623 -- Note that you shouldn't assume the window is definitely unmaximized 624 -- afterward, because other entities (e.g. the user or window manager) 625 -- could maximize it again, and not all window managers honor requests to 626 -- unmaximize. But normally the window will end up unmaximized. 627 -- 628 -- You can track maximization via the "window_state_event" signal 629 -- on Gtk_Widget. 630 631 procedure Set_Default_Size 632 (Window : access Gtk_Window_Record; Width : Gint; Height : Gint); 633 procedure Get_Default_Size 634 (Window : access Gtk_Window_Record; 635 Width : out Gint; 636 Height : out Gint); 637 -- Sets the default size of a window. If the window's "natural" size (its 638 -- size request) is larger than the default, the default will be 639 -- ignored. More generally, if the default size does not obey the geometry 640 -- hints for the window (Set_Geometry_Hints can be used to set these 641 -- explicitly), the default size will be clamped to the nearest permitted 642 -- size. 643 -- 644 -- Unlike Gtk.Widget.Set_Size_Request, which sets a size request for a 645 -- widget and thus would keep users from shrinking the window, this 646 -- function only sets the initial size, just as if the user had resized the 647 -- window themselves. Users can still shrink the window again as they 648 -- normally would. Setting a default size of -1 means to use the "natural" 649 -- default size (the size request of the window). 650 -- 651 -- For more control over a window's initial size and how resizing works, 652 -- investigate Set_Geometry_Hints. 653 -- 654 -- For some uses, Resize is a more appropriate function. Resize changes 655 -- the current size of the window, rather than the size to be used on 656 -- initial display. Resize always affects the window itself, not the 657 -- geometry widget. 658 -- 659 -- The default size of a window only affects the first time a window is 660 -- shown; if a window is hidden and re-shown, it will remember the size it 661 -- had prior to hiding, rather than using the default size. 662 -- 663 -- Windows can't actually be 0x0 in size, they must be at least 1x1, but 664 -- passing 0 for Width and Height is OK, resulting in a 1x1 default size. 665 -- 666 -- This has no effect on Popup windows (set in call to Gtk_New). 667 668 procedure Resize 669 (Window : access Gtk_Window_Record; 670 Width, Height : Gint); 671 -- Resize the window as if the user had done so, obeying geometry 672 -- constraints. The default geometry constraint is that windows may 673 -- not be smaller than their size request; to override this 674 -- constraint, call Gtk.Widget.Set_Size_Request to set the window's 675 -- request to a smaller value. 676 -- 677 -- If Resize is called before showing a window for the -- first time, it 678 -- overrides any default size set with -- Set_Default_Size. 679 -- 680 -- Windows may not be resized smaller than 1 by 1 pixels. However, as a 681 -- special case, if both Width and Height are set to -1, the best requested 682 -- size is recomputed for the window, and used. 683 684 procedure Get_Size 685 (Window : access Gtk_Window_Record; 686 Width, Height : out Gint); 687 -- Obtains the current size of Window. If Window is not onscreen, it 688 -- returns the size GTK+ will suggest to the window manager for the initial 689 -- window size (but this is not reliably the same as the size the window 690 -- manager will actually select). The size obtained by Get_Size is the last 691 -- size received in Gdk_Event_Configure, that is, GTK+ uses its 692 -- locally-stored size, rather than querying the X server for the size. As 693 -- a result, if you call Resize then immediately call Get_Size, the size 694 -- won't have taken effect yet. After the window manager processes the 695 -- resize request, GTK+ receives notification that the size has changed via 696 -- a configure event, and the size of the window gets updated. 697 -- 698 -- Note 1: Nearly any use of this function creates a race condition, 699 -- because the size of the window may change between the time that you get 700 -- the size and the time that you perform some action assuming that size is 701 -- the current size. To avoid race conditions, connect to "configure_event" 702 -- on the window and adjust your size-dependent state to match the size 703 -- delivered in the Gdk_Event_Configure. 704 -- 705 -- Note 2: The returned size does *not* include the size of the window 706 -- manager decorations (aka the window frame or border). Those are not 707 -- drawn by GTK+ and GTK+ has no reliable method of determining their size. 708 -- 709 -- Note 3: If you are getting a window size in order to position the window 710 -- onscreen, there may be a better way. The preferred way is to simply set 711 -- the window's semantic type with Set_Type_Hint, which allows the window 712 -- manager to e.g. center dialogs. Also, if you set the transient parent of 713 -- dialogs with Set_Transient_For window managers will often center the 714 -- dialog over its parent window. It's much preferred to let the window 715 -- manager handle these things rather than doing it yourself, because all 716 -- apps will behave consistently and according to user prefs if the window 717 -- manager handles it. Also, the window manager can take the size of the 718 -- window decorations/border into account, while your application cannot. 719 -- 720 -- In any case, if you insist on application-specified window positioning, 721 -- there's *still*> a better way than doing it yourself - Set_Position will 722 -- frequently handle the details for you. 723 724 procedure Reshow_With_Initial_Size (Window : access Gtk_Window_Record); 725 -- Hide Window, then reshows it, resetting the default size and position. 726 -- Used by GUI builders only. 727 728 procedure Begin_Resize_Drag 729 (Window : access Gtk_Window_Record; 730 Edge : Gdk.Window.Gdk_Window_Edge; 731 Button : Gint; 732 Root_X : Gint; 733 Root_Y : Gint; 734 Timestamp : Guint32); 735 -- Starts resizing a window. This function is used if an application has 736 -- window resizing controls. When GDK can support it, the resize will be 737 -- done using the standard mechanism for the window manager or windowing 738 -- system. Otherwise, GDK will try to emulate window resizing, potentially 739 -- not all that well, depending on the windowing system. 740 741 ----------- 742 -- Icons -- 743 ----------- 744 745 procedure Set_Icon_Name (Window : access Gtk_Window_Record; Name : String); 746 function Get_Icon_Name (Window : access Gtk_Window_Record) return String; 747 -- Set the icon for the window from a named themed icon. See 748 -- Gtk.Icon_Them for more details. This has nothing to do with the 749 -- WM_ICON_NAME property which is mentioned in the ICCCM (and related to 750 -- window managers) 751 752 procedure Set_Icon 753 (Window : access Gtk_Window_Record; Icon : Gdk.Pixbuf.Gdk_Pixbuf); 754 function Get_Icon 755 (Window : access Gtk_Window_Record) return Gdk.Pixbuf.Gdk_Pixbuf; 756 -- Sets up the icon representing Window. This icon is used when the window 757 -- is minimized (also known as iconified). Some window managers or desktop 758 -- environments may also place it in the window frame, or display it in 759 -- other contexts. 760 -- 761 -- The icon should be provided in whatever size it was naturally drawn; 762 -- that is, don't scale the image before passing it to GTK+. Scaling is 763 -- postponed until the last minute, when the desired final size is known, 764 -- to allow best quality. 765 -- 766 -- If you have your icon hand-drawn in multiple sizes, use 767 -- Set_Icon_List. Then the best size will be used. 768 -- 769 -- This function is equivalent to calling Set_Icon_List with a single 770 -- element. 771 -- 772 -- See also Set_Default_Icon_List to set the icon for all windows in your 773 -- application in one go. 774 775 procedure Set_Icon_List 776 (Window : access Gtk_Window_Record; 777 List : Glib.Object.Object_Simple_List.Glist); 778 function Get_Icon_List 779 (Window : access Gtk_Window_Record) 780 return Glib.Object.Object_Simple_List.Glist; 781 -- Sets up the icon representing Window. The icon is used when the window 782 -- is minimized (also known as iconified). Some window managers or desktop 783 -- environments may also place it in the window frame, or display it in 784 -- other contexts. 785 -- 786 -- Set_Icon_List allows you to pass in the same icon in several hand-drawn 787 -- sizes. The list should contain the natural sizes your icon is available 788 -- in; that is, don't scale the image before passing it to GTK+. Scaling is 789 -- postponed until the last minute, when the desired final size is known, 790 -- to allow best quality. 791 -- 792 -- By passing several sizes, you may improve the final image quality of the 793 -- icon, by reducing or eliminating automatic image scaling. 794 -- 795 -- Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger 796 -- images (64x64, 128x128) if you have them. 797 -- 798 -- Note that transient windows (those who have been set transient for 799 -- another window using Set_Transient_For) will inherit their icon from 800 -- their transient parent. So there's no need to explicitly set the icon on 801 -- transient windows. 802 803 function Set_Icon_From_File 804 (Window : access Gtk_Window_Record; 805 Filename : String) return Boolean; 806 -- Equivalent to calling Set_Icon with a pixbuf loaded from Filename. 807 -- return False on failure. 808 809 procedure Set_Default_Icon_List 810 (List : Glib.Object.Object_Simple_List.Glist); 811 function Get_Default_Icon_List 812 return Glib.Object.Object_Simple_List.Glist; 813 -- Sets an icon list to be used as fallback for windows that haven't had 814 -- Set_Icon_List called on them to setup a window-specific icon list. 815 816 procedure Set_Default_Icon (Icon : Gdk.Pixbuf.Gdk_Pixbuf); 817 -- Sets an icon to be used as a fallback for windows that haven't had 818 -- Set_Icon called on them 819 820 function Set_Default_Icon_From_File (Filename : String) return Boolean; 821 -- Same as Set_Default_Icon, loads the pixbuf automatically. 822 823 function Get_Default_Icon_Name return String; 824 procedure Set_Default_Icon_Name (Name : String); 825 -- Gets/Sets icon to be used as a fallback for windows that haven't had a 826 -- themed icon set (set Set_Icon_Name). 827 828 ------------ 829 -- Groups -- 830 ------------ 831 832 procedure Gtk_New (Group : out Gtk_Window_Group); 833 -- Create a new window group. 834 -- Grabs added with Gtk.Main.Grab_Add only affect windows within the same 835 -- group. 836 837 function Group_Get_Type return GType; 838 -- Return the internal type used for window groups 839 840 procedure Group_Add_Window 841 (Window_Group : access Gtk_Window_Group_Record; 842 Window : access Gtk_Window_Record'Class); 843 -- Add a window to Window_Group 844 845 procedure Group_Remove_Window 846 (Window_Group : access Gtk_Window_Group_Record; 847 Window : access Gtk_Window_Record'Class); 848 -- Remove a specific window from the group 849 850 function Group_List_Windows 851 (Window_Group : access Gtk_Window_Group_Record) 852 return Gtk.Widget.Widget_List.Glist; 853 -- Returns a list of the Gtk_Windows that belong to Window_Group. 854 855 function Get_Group 856 (Window : access Gtk_Window_Record) return Gtk_Window_Group; 857 -- Returns the group for Window or the default group, if 858 -- Window is null or if Window does not have an explicit 859 -- window group. 860 861 ----------- 862 -- Focus -- 863 ----------- 864 865 function Get_Focus (Window : access Gtk_Window_Record) 866 return Gtk.Widget.Gtk_Widget; 867 -- Return the widget that would have the keyboard focus if 868 -- Window itself has the focus. It currently has the focus 869 -- only if Has_Focus_Is_Set returns True. 870 -- To know whether the Window itself currently has the focus, check the 871 -- Has_Toplevel_Focus_Property 872 -- property described below 873 874 procedure Set_Focus 875 (Window : access Gtk_Window_Record; 876 Focus : Gtk.Widget.Gtk_Widget); 877 -- Set the focus child for Window. 878 -- If Focus is not the current focus widget, and is focusable, sets 879 -- it as the focus widget for the window. If Focus is null, unsets 880 -- the focus widget for this window. To set the focus to a particular 881 -- widget in the toplevel, it is usually more convenient to use 882 -- gtk_widget_grab_focus() instead of this function. 883 884 procedure Set_Accept_Focus 885 (Window : access Gtk_Window_Record; Setting : Boolean); 886 function Get_Accept_Focus 887 (Window : access Gtk_Window_Record) return Boolean; 888 -- Windows may set a hint asking the desktop environment not to receive 889 -- the input focus. 890 891 procedure Set_Focus_On_Map 892 (Window : access Gtk_Window_Record; Setting : Boolean); 893 function Get_Focus_On_Map 894 (Window : access Gtk_Window_Record) return Boolean; 895 -- Windows may set a hint asking the desktop environment not to receive 896 -- the input focus when the window is mapped. 897 898 function Has_Toplevel_Focus 899 (Window : access Gtk_Window_Record) return Boolean; 900 -- Returns whether the input focus is within this Window. For real toplevel 901 -- windows, this is identical to Is_Active, but for embedded windows the 902 -- results will differ 903 904 function Is_Active (Window : access Gtk_Window_Record) return Boolean; 905 -- Returns whether the window is part of the current active toplevel. (That 906 -- is, the toplevel window receiving keystrokes.) The return value is True 907 -- if the window is active toplevel itself, but also if it is, say, a 908 -- Gtk_Plug embedded in the active toplevel. You might use this function if 909 -- you wanted to draw a widget differently in an active window from a 910 -- widget in an inactive window. 911 912 ------------------------ 913 -- Keys and shortcuts -- 914 ------------------------ 915 916 function Get_Default_Widget 917 (Window : access Gtk_Window_Record) return Gtk.Widget.Gtk_Widget; 918 procedure Set_Default 919 (Window : access Gtk_Window_Record; 920 Default_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 921 -- The default widget is the widget that's activated when the user presses 922 -- Enter in a dialog (for example). This function sets or unsets the 923 -- default widget for a Window. When setting (rather than unsetting) the 924 -- default widget it's generally easier to call Grab_Focus on the widget. 925 -- Before making a widget the default widget, you must set the CAN_DEFAULT 926 -- flag on the widget you'd like to make the default using 927 -- Gtk.Widget.Set_Flags. A null value indicates no default widget. 928 929 procedure Set_Mnemonic_Modifier 930 (Window : access Gtk_Window_Record; 931 Modifier : Gdk.Types.Gdk_Modifier_Type); 932 function Get_Mnemonic_Modifier 933 (Window : access Gtk_Window_Record) 934 return Gdk.Types.Gdk_Modifier_Type; 935 -- Sets the mnemonic modifier for this window. 936 -- Modifier is the mask used to active mnemonics in this window 937 938 procedure Add_Mnemonic 939 (Window : access Gtk_Window_Record; 940 Keyval : Gdk.Types.Gdk_Key_Type; 941 Target : access Gtk.Widget.Gtk_Widget_Record'Class); 942 procedure Remove_Mnemonic 943 (Window : access Gtk_Window_Record; 944 Keyval : Gdk.Types.Gdk_Key_Type; 945 Target : access Gtk.Widget.Gtk_Widget_Record'Class); 946 -- Add a mnemonic to this window. 947 -- Target will receive the "activate" signal when Keyval is pressed inside 948 -- the window. In addition to keyval, the user must press the special key 949 -- defined through Set_Mnemonic_Modifier 950 951 function Mnemonic_Activate 952 (Window : access Gtk_Window_Record; 953 Keyval : Gdk.Types.Gdk_Key_Type; 954 Modifier : Gdk.Types.Gdk_Modifier_Type) 955 return Boolean; 956 -- Activates the targets associated with the mnemonic. This sends the 957 -- "activate" signal to the corresponding signal 958 959 function Activate_Key 960 (Window : access Gtk_Window_Record; 961 Event : Gdk.Event.Gdk_Event_Key) return Boolean; 962 -- Activates mnemonics and accelerators for this window. This is normally 963 -- called by the default key_press_event_handler for toplevel windows, 964 -- however in some cases it may be useful to call this directly when 965 -- overriding the standard key handling for a toplevel window. 966 -- Return True if the mnemonic was found and activated. 967 968 function Propagate_Key_Event 969 (Window : access Gtk_Window_Record; 970 Event : Gdk.Event.Gdk_Event_Key) return Boolean; 971 -- Propagate a key press or release event to the focus widget and up the 972 -- focus container chain until a widget handles Event. 973 -- This is normally called by the default key_press_event handler, but 974 -- might be useful when overriding the standard key handling for a 975 -- toplevel window. 976 977 procedure Add_Accel_Group 978 (Window : access Gtk_Window_Record; 979 Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group); 980 procedure Remove_Accel_Group 981 (Window : access Gtk_Window_Record; 982 Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group); 983 -- Adds or Removes the specified accelerator group for the window, such 984 -- that calling Gtk.Accel_Groups.Active on Window will activate 985 -- accelerators in Accel_Group. 986 987 ----------------- 988 -- Obsolescent -- 989 ----------------- 990 -- All subprograms below are now obsolescent in gtk+. They might be removed 991 -- from future versions of gtk+ (and therefore GtkAda). 992 -- To find out whether your code uses any of these, we recommend compiling 993 -- with the -gnatwj switch 994 -- <doc_ignore> 995 996 procedure Set_Resizeable 997 (Window : access Gtk_Window_Record; 998 Resizable : Boolean := True) renames Set_Resizable; 999 -- pragma Obsolescent ("Use Gtk.Window.Set_Resizable instead"); 1000 1001 function Get_Resizeable (Window : access Gtk_Window_Record) return Boolean 1002 renames Get_Resizable; 1003 -- pragma Obsolescent ("Use Gtk.Window.Get_Resizable instead"); 1004 1005 procedure Set_Policy 1006 (Window : access Gtk_Window_Record; 1007 Allow_Shrink : Boolean; 1008 Allow_Grow : Boolean; 1009 Auto_Shrink : Boolean); 1010 pragma Obsolescent; -- Set_Policy 1011 -- Specify the behavior of the window with regards to size modifications. 1012 -- Default values when the window is created are: 1013 -- Allow_Shrink => False, 1014 -- Allow_Grow => True, 1015 -- Auto_Shrink => False. 1016 -- 1017 -- If Allow_Shrink is False, then the minimum size of the window is 1018 -- calculated once depending on its children, and the window can never be 1019 -- smaller. 1020 -- If Allow_Grow is False, then the maximum size of the window is 1021 -- calculated once depending on its children, and the window can never be 1022 -- bigger. 1023 -- If Auto_Shrink if False, then the window is not shrinked when its 1024 -- content changes. 1025 1026 -- </doc_ignore> 1027 1028 ---------------- 1029 -- Properties -- 1030 ---------------- 1031 1032 -- <properties> 1033 -- The following properties are defined for this widget. See 1034 -- Glib.Properties for more information on properties. 1035 -- 1036 -- - Name: Type_Property 1037 -- Type: Gtk_Window_Type 1038 -- Flags: read-write (construct only) 1039 -- Descr: The type of the window 1040 -- See also: Gtk_New 1041 -- 1042 -- - Name: Title_Property 1043 -- Type: UTF8_String 1044 -- Flags: read-write 1045 -- Descr: The title of the window 1046 -- See also: Set_Title and Get_Title 1047 -- 1048 -- - Name: Role_Property 1049 -- Type: String 1050 -- See: Set_Role / Get_Role 1051 -- 1052 -- - Name: Allow_Shrink_Property 1053 -- Type: Boolean 1054 -- Flags: read-write 1055 -- Descr: If TRUE, the window has no mimimum size. Don't use this 1056 -- feature, it makes no sense 1057 -- See also: Set_Policy 1058 -- 1059 -- - Name: Allow_Grow_Property 1060 -- Type: Boolean 1061 -- Flags: read-write 1062 -- Descr: If TRUE, users can expand the window beyond its minimum size. 1063 -- See also: Set_Policy 1064 -- 1065 -- - Name: Resizable_Property 1066 -- Type: Boolean 1067 -- See: Set_Resizable / Get_Resizable 1068 -- 1069 -- - Name: Modal_Property 1070 -- Type: Boolean 1071 -- Flags: read-write 1072 -- Descr: If TRUE, the window is modal (other windows are not usable 1073 -- while this one is up) 1074 -- See also: Set_Modal 1075 -- 1076 -- - Name: Win_Pos_Property 1077 -- Type: Gtk_Window_Position 1078 -- Flags: read-write 1079 -- Descr: The initial position of the window. 1080 -- See also: Set_Position 1081 -- 1082 -- - Name: Default_Width_Property 1083 -- Type: Gint 1084 -- Flags: read-write 1085 -- Descr: The default width of the window, or 0 to use the size request. 1086 -- See also: Set_Default_Size 1087 -- 1088 -- - Name: Default_Height_Property 1089 -- Type: Gint 1090 -- Flags: read-write 1091 -- Descr: The default height of the window, or 0 to use the size request. 1092 -- See also: Set_Default_Size 1093 -- 1094 -- - Name: Destroy_With_Parent_Property 1095 -- Type: Boolean 1096 -- Flags: read-write 1097 -- Descr: If this window should be destroyed when the parent is destroyed 1098 -- See also: Set_Destroy_With_Parent 1099 -- 1100 -- - Name: Has_Toplevel_Focus_Property 1101 -- Type: Boolean 1102 -- Flags: read-only 1103 -- Descr: Whether the input focus is within this Gtk_Window 1104 -- 1105 -- - Name: Is_Active_Property 1106 -- Type: Boolean 1107 -- Flags: read-only 1108 -- Descr: Whether the toplevel is the current active window 1109 -- 1110 -- Name: Deletable_Property 1111 -- Type: Boolean 1112 -- Descr: Whether the window frame should have a close button 1113 -- 1114 -- Name: Opacity_Property 1115 -- Type: Double 1116 -- Descr: The opacity of the window, from 0.0 to 1.0 1117 -- 1118 -- Name: Startup_Id_Property 1119 -- Type: String 1120 -- Descr: Unique startup identifier for the window used by 1121 -- startup-notification 1122 -- 1123 -- Name: Transient_For_Property 1124 -- Type: Object 1125 -- Descr: The transient parent of the dialog 1126 -- 1127 -- </properties> 1128 1129 Type_Property : constant Gtk.Enums.Property_Gtk_Window_Type; 1130 Title_Property : constant Glib.Properties.Property_String; 1131 Role_Property : constant Glib.Properties.Property_String; 1132 Allow_Shrink_Property : constant Glib.Properties.Property_Boolean; 1133 Allow_Grow_Property : constant Glib.Properties.Property_Boolean; 1134 Modal_Property : constant Glib.Properties.Property_Boolean; 1135 Resizable_Property : constant Glib.Properties.Property_Boolean; 1136 Has_Toplevel_Focus_Property : constant Glib.Properties.Property_Boolean; 1137 Is_Active_Property : constant Glib.Properties.Property_Boolean; 1138 Window_Position_Property : constant Gtk.Enums.Property_Gtk_Window_Position; 1139 Default_Width_Property : constant Glib.Properties.Property_Int; 1140 Default_Height_Property : constant Glib.Properties.Property_Int; 1141 Destroy_With_Parent_Property : constant Glib.Properties.Property_Boolean; 1142 Icon_Property : constant Glib.Properties.Property_Object; 1143 Icon_Name_Property : constant Glib.Properties.Property_String; 1144 Screen_Property : constant Glib.Properties.Property_Object; 1145 Type_Hint_Property : constant Gdk.Window.Property_Window_Type_Hint; 1146 Skip_Taskbar_Hint_Property : constant Glib.Properties.Property_Boolean; 1147 Skip_Pager_Hint_Property : constant Glib.Properties.Property_Boolean; 1148 Urgency_Hint_Property : constant Glib.Properties.Property_Boolean; 1149 Accept_Focus_Property : constant Glib.Properties.Property_Boolean; 1150 Focus_On_Map_Property : constant Glib.Properties.Property_Boolean; 1151 Decorated_Property : constant Glib.Properties.Property_Boolean; 1152 Gravity_Property : constant Gdk.Window.Property_Gravity; 1153 Deletable_Property : constant Glib.Properties.Property_Boolean; 1154 Opacity_Property : constant Glib.Properties.Property_Double; 1155 Startup_Id_Property : constant Glib.Properties.Property_String; 1156 Transient_For_Property : constant Glib.Properties.Property_Object; 1157 1158 ------------- 1159 -- Signals -- 1160 ------------- 1161 1162 -- <signals> 1163 -- The following new signals are defined for this widget: 1164 -- 1165 -- - "set_focus" 1166 -- procedure Handler (Window : access Gtk_Window_Record'Class; 1167 -- Widget : access Gtk_Widget_Record'Class); 1168 -- Called when the widget that has the focus has changed. 1169 -- This widget gets all keyboard events that happen in the window. 1170 -- You should not block the emission of this signal, since most of 1171 -- the work is done in the default handler. 1172 -- 1173 -- - "frame_event" 1174 -- function Handler 1175 -- (Window : access Gtk_Window_Record'Class; 1176 -- Event : Gdk.Event.Gdk_Event) return Boolean; 1177 -- If this function is called on a window before it is realized 1178 -- or showed it will have a "frame" window around widget-window. 1179 -- Called when the "frame" window set around a window receives events. 1180 -- This is mainly used by the linux-fb port to implement managed 1181 -- windows, but it could concievably be used by X-programs that 1182 -- want to do their own window decorations. 1183 -- 1184 -- - "activate_focus" 1185 -- procedure Handler (Window : access Gtk_Window_Record'Class); 1186 -- You should emit this signal to request that the currently focused 1187 -- widget receives the "activate" signal. This is the same as calling 1188 -- Activate_Focus, but can be bound to a key binding 1189 -- 1190 -- - "activate_default" 1191 -- procedure Handler (Window : access Gtk_Window_Record'Class); 1192 -- Same as Activate_Default, but can be bound to a key binding 1193 -- 1194 -- - "move_focus" 1195 -- procedure Handler 1196 -- (Window : access Gtk_Window_Record'Class; 1197 -- Direction : Gtk_Direction_Type); 1198 -- Emitted when a new child gains the focus 1199 -- 1200 -- - "keys_changed" 1201 -- procedure Handler (Window : access Gtk_Window_Record'Class); 1202 -- Emitted when the key accelerators or mnemonics are changed for the 1203 -- window. 1204 -- 1205 -- </signals> 1206 1207 Signal_Set_Focus : constant Glib.Signal_Name := "set_focus"; 1208 Signal_Frame_Event : constant Glib.Signal_Name := "frame_event"; 1209 Signal_Activate_Focus : constant Glib.Signal_Name := "activate_focus"; 1210 Signal_Activate_Default : constant Glib.Signal_Name := "activate_default"; 1211 Signal_Move_Focus : constant Glib.Signal_Name := "move_focus"; 1212 Signal_Keys_Changed : constant Glib.Signal_Name := "keys_changed"; 1213 1214private 1215 type Gtk_Window_Record is new Bin.Gtk_Bin_Record with null record; 1216 1217 Type_Property : constant Gtk.Enums.Property_Gtk_Window_Type := 1218 Gtk.Enums.Build ("type"); 1219 Title_Property : constant Glib.Properties.Property_String := 1220 Glib.Properties.Build ("title"); 1221 Allow_Shrink_Property : constant Glib.Properties.Property_Boolean := 1222 Glib.Properties.Build ("allow_shrink"); 1223 Allow_Grow_Property : constant Glib.Properties.Property_Boolean := 1224 Glib.Properties.Build ("allow_grow"); 1225 Modal_Property : constant Glib.Properties.Property_Boolean := 1226 Glib.Properties.Build ("modal"); 1227 Win_Pos_Property : constant Gtk.Enums.Property_Gtk_Window_Position := 1228 Gtk.Enums.Build ("window_position"); 1229 Default_Width_Property : constant Glib.Properties.Property_Int := 1230 Glib.Properties.Build ("default_width"); 1231 Default_Height_Property : constant Glib.Properties.Property_Int := 1232 Glib.Properties.Build ("default_height"); 1233 Destroy_With_Parent_Property : constant Glib.Properties.Property_Boolean := 1234 Glib.Properties.Build ("destroy_with_parent"); 1235 Has_Toplevel_Focus_Property : constant Glib.Properties.Property_Boolean := 1236 Glib.Properties.Build ("has_toplevel_focus"); 1237 Is_Active_Property : constant Glib.Properties.Property_Boolean := 1238 Glib.Properties.Build ("is_active"); 1239 Icon_Property : constant Glib.Properties.Property_Object := 1240 Glib.Properties.Build ("icon"); 1241 Icon_Name_Property : constant Glib.Properties.Property_String := 1242 Glib.Properties.Build ("icon-name"); 1243 Screen_Property : constant Glib.Properties.Property_Object := 1244 Glib.Properties.Build ("screen"); 1245 Type_Hint_Property : constant Gdk.Window.Property_Window_Type_Hint := 1246 Gdk.Window.Build ("type-hint"); 1247 Skip_Taskbar_Hint_Property : constant Glib.Properties.Property_Boolean := 1248 Glib.Properties.Build ("skip-taskbar-hint"); 1249 Skip_Pager_Hint_Property : constant Glib.Properties.Property_Boolean := 1250 Glib.Properties.Build ("skip-pager-hint"); 1251 Urgency_Hint_Property : constant Glib.Properties.Property_Boolean := 1252 Glib.Properties.Build ("urgency-hint"); 1253 Accept_Focus_Property : constant Glib.Properties.Property_Boolean := 1254 Glib.Properties.Build ("accept-focus"); 1255 Focus_On_Map_Property : constant Glib.Properties.Property_Boolean := 1256 Glib.Properties.Build ("focus-on-map"); 1257 Decorated_Property : constant Glib.Properties.Property_Boolean := 1258 Glib.Properties.Build ("decorated"); 1259 Gravity_Property : constant Gdk.Window.Property_Gravity := 1260 Gdk.Window.Build ("gravity"); 1261 Window_Position_Property : 1262 constant Gtk.Enums.Property_Gtk_Window_Position := 1263 Gtk.Enums.Build ("window-position"); 1264 Resizable_Property : constant Glib.Properties.Property_Boolean := 1265 Glib.Properties.Build ("resizable"); 1266 Role_Property : constant Glib.Properties.Property_String := 1267 Glib.Properties.Build ("role"); 1268 Deletable_Property : constant Glib.Properties.Property_Boolean := 1269 Glib.Properties.Build ("deletable"); 1270 Opacity_Property : constant Glib.Properties.Property_Double := 1271 Glib.Properties.Build ("opacity"); 1272 Startup_Id_Property : constant Glib.Properties.Property_String := 1273 Glib.Properties.Build ("startup-id"); 1274 Transient_For_Property : constant Glib.Properties.Property_Object := 1275 Glib.Properties.Build ("transient-for"); 1276 1277 pragma Import (C, Get_Type, "gtk_window_get_type"); 1278 pragma Import (C, Group_Get_Type, "gtk_window_group_get_type"); 1279end Gtk.Window; 1280 1281-- <example> 1282-- <include>../examples/documentation/banner.adb</include> 1283-- </example> 1284 1285-- No binding: gtk_window_get_screen 1286-- No binding: gtk_window_set_screen 1287-- No binding: gtk_window_add_embedded_xid 1288-- No binding: gtk_window_remove_embedded_xid 1289