### GtkPageSetup Example: Running the Page Setup Dialog Source: https://docs.gtk.org/gtk3/class.PageSetup Demonstrates how to display the GtkPageSetup dialog and retrieve the user's selections. ```APIDOC ## Example: Running the Page Setup Dialog ### Function `do_page_setup` ### Description This function shows the `GtkPageSetup` dialog to the user. If the user makes changes and confirms, it updates the `page_setup` variable with the new settings. It also handles the initialization and potential unreferencing of `GtkPrintSettings` and `GtkPageSetup` objects. ### Usage ```c static GtkPrintSettings *settings = NULL; static GtkPageSetup *page_setup = NULL; static void do_page_setup (void) { GtkPageSetup *new_page_setup; if (settings == NULL) settings = gtk_print_settings_new (); new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); if (page_setup) g_object_unref (page_setup); page_setup = new_page_setup; } ``` ### Notes - Printing support was added in GTK+ 2.10. - The `main_window` variable is assumed to be a valid `GtkWindow` handle. ``` -------------------------------- ### Basic GTK Window and Main Loop Setup Source: https://docs.gtk.org/gtk3/treeview-tutorial This C code snippet demonstrates the fundamental setup for a GTK application window. It initializes a new toplevel window, connects the 'delete_event' signal to quit the main loop, adds a view to the window, makes all widgets visible, and starts the GTK main event loop. ```c window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "delete_event", gtk_main_quit, NULL); /* dirty */ view = create_view_and_model(); gtk_container_add(GTK_CONTAINER(window), view); gtk_widget_show_all(window); gtk_main(); return 0; } ``` -------------------------------- ### GtkCellRenderer::editing-started Signal Source: https://docs.gtk.org/gtk3/signal.CellRenderer.editing-started This signal gets emitted when a cell starts to be edited. It's used for special setup on the editable widget. ```APIDOC ## GtkCellRenderer::editing-started ### Description This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup on `editable`, e.g. adding a `GtkEntryCompletion` or setting up additional columns in a `GtkComboBox`. See `gtk_cell_editable_start_editing()` for information on the lifecycle of the `editable` and a way to do setup that doesn’t depend on the `renderer`. Note that GTK+ doesn’t guarantee that cell renderers will continue to use the same kind of widget for editing in future releases, therefore you should check the type of `editable` before doing any specific setup. Default handler: The default handler is called before the handlers added via `g_signal_connect()`. Available since: 2.6 ### Method Not applicable (this is a signal). ### Endpoint Not applicable (this is a signal). ### Parameters #### Signal Parameters - **editable** (GtkCellEditable) - The `GtkCellEditable`. - **path** (gchar*) - The path identifying the edited cell. The value is a NUL terminated UTF-8 string. - **user_data** (gpointer) - User data passed when the signal was connected. ### Request Example ```json { "description": "Example for a signal emission, not a request body." } ``` ### Response #### Success Response This signal does not have a success response in the typical API sense, as it's an event. #### Response Example ```json { "description": "Example for a signal emission, not a response body." } ``` ``` -------------------------------- ### Create and Display a Basic GTK Window Source: https://docs.gtk.org/gtk3/getting_started This C code snippet demonstrates the fundamental steps to create a simple GTK application that displays an empty window. It includes the necessary GTK header, initializes a GtkApplication, sets window properties like title and size, and shows the window. The program structure involves a main function to set up the application and an activate function to build the UI. ```c #include static void activate (GtkApplication* app, gpointer user_data) { GtkWidget *window; window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "Window"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); gtk_widget_show_all (window); } int main (int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } ``` -------------------------------- ### Get GtkGestureDrag Start Point Source: https://docs.gtk.org/gtk3/class.GesturePan If a GtkGestureDrag (and by extension, GtkGesturePan) is active, this function retrieves the starting coordinates of the drag. These coordinates are relative to the window. ```c bool gtk_gesture_drag_get_start_point (GtkGestureDrag *gesture, gdouble *x, gdouble *y); // If the gesture is active, this function returns TRUE and fills in x and y with the drag start coordinates, in window-relative coordinates. // since: 3.14 ``` -------------------------------- ### Setting up GTK+ Menus and Actions Source: https://docs.gtk.org/gtk3/getting_started This snippet shows how to retrieve a menu model from a GtkBuilder object, set it for a GtkMenuButton, and create a GSettings action. It demonstrates basic GTK+ UI setup and action creation. ```c menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu")); gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->gears), menu); g_object_unref (builder); action = g_settings_create_action (priv->settings, "show-words"); g_action_map_add_action (G_ACTION_MAP (win), action); g_object_unref (action); ``` -------------------------------- ### Get Drag Start Point - C Source: https://docs.gtk.org/gtk3/method.GestureDrag.get_start_point Retrieves the starting coordinates of an active drag gesture in window-relative coordinates. Requires a GtkGestureDrag object and pointers to store the x and y coordinates. Returns TRUE if the gesture is active, FALSE otherwise. ```c gboolean gtk_gesture_drag_get_start_point ( GtkGestureDrag* gesture, gdouble* x, gdouble* y ) ``` -------------------------------- ### GTK GtkTreeView 'Hello World' Example (C) Source: https://docs.gtk.org/gtk3/treeview-tutorial A basic GTK 'Hello World' example using the GtkTreeView widget. It demonstrates creating a GtkListStore, adding rows with name and age data, and configuring a GtkTreeView to display these columns. This snippet requires the GTK library. ```c #include enum { COL_NAME = 0, COL_AGE, NUM_COLS } ; static GtkTreeModel * create_and_fill_model (void) { GtkListStore *store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_UINT); /* Append a row and fill in some data */ GtkTreeIter iter; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Heinz El-Mann", COL_AGE, 51, -1); /* append another row and fill in some data */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Jane Doe", COL_AGE, 23, -1); /* ... and a third row */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Joe Bungop", COL_AGE, 91, -1); return GTK_TREE_MODEL (store); } static GtkWidget * create_view_and_model (void) { GtkWidget *view = gtk_tree_view_new (); GtkCellRenderer *renderer; /* --- Column #1 --- */ renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, "Name", renderer, "text", COL_NAME, NULL); /* --- Column #2 --- */ renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, "Age", renderer, "text", COL_AGE, NULL); GtkTreeModel *model = create_and_fill_model (); gtk_tree_view_set_model (GTK_TREE_VIEW (view), model); /* The tree view has acquired its own reference to the * model, so we can drop ours. That way the model will * be freed automatically when the tree view is destroyed */ g_object_unref (model); return view; } int main (int argc, char **argv) { gtk_init (&argc, &argv); GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", gtk_main_quit, NULL); GtkWidget *view = create_view_and_model (); gtk_container_add (GTK_CONTAINER (window), view); gtk_widget_show_all (window); gtk_main (); return 0; } ``` -------------------------------- ### Main GTK Application Setup in C Source: https://docs.gtk.org/gtk3/treeview-tutorial This C function initializes the GTK library, creates a main window, connects a delete event to quit the application, creates a GTK Tree View using the `create_view_and_model` function, adds the view to the window, shows all widgets, and starts the GTK main loop. It requires GTK initialization and standard C libraries. ```c int main (int argc, char **argv) { GtkWidget *window; GtkWidget *view; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "delete_event", gtk_main_quit, NULL); /* dirty */ view = create_view_and_model(); gtk_container_add(GTK_CONTAINER(window), view); gtk_widget_show_all(window); gtk_main(); return 0; } ``` -------------------------------- ### Get Embed Page Setup - GtkPrintOperation (C) Source: https://docs.gtk.org/gtk3/method.PrintOperation.get_embed_page_setup Retrieves the value of the `GtkPrintOperation:embed-page-setup` property. This property determines whether page setup selection combos are embedded. The function returns a boolean value indicating the state. ```c gboolean gtk_print_operation_get_embed_page_setup ( GtkPrintOperation* op ) ``` -------------------------------- ### Get End Position of GtkCssSection (C) Source: https://docs.gtk.org/gtk3/method.CssSection.get_end_position Retrieves the byte offset from the start of the current line for a GtkCssSection. This value might change if the section is not fully parsed, especially during parsing errors. The position and line can be identical to the start if parsing fails. ```c guint gtk_css_section_get_end_position ( const GtkCssSection* section ) ``` -------------------------------- ### GtkPageSetup to Key File Source: https://docs.gtk.org/gtk3/method.PageSetup.to_key_file Adds the page setup from a GtkPageSetup object to a GKeyFile. ```APIDOC ## void gtk_page_setup_to_key_file ### Description This function adds the page setup from `setup` to `key_file`. Available since: 2.12 ### Method `void` ### Endpoint N/A (This is a function, not a REST endpoint) ### Parameters #### Parameters - **setup** (GtkPageSetup*) - The GtkPageSetup object to save. - **key_file** (GKeyFile*) - Required - The GKeyFile to save the page setup to. The data is owned by the caller of the method. - **group_name** (const gchar*) - Optional - The group to add the settings to in `key_file`, or `NULL` to use the default name “Page Setup”. The argument can be `NULL`. The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. ### Request Example ```json { "setup": "", "key_file": "", "group_name": "Page Setup Group" } ``` ### Response #### Success Response (void) This function does not return a value. #### Response Example N/A ``` -------------------------------- ### Create GtkApplicationWindow with Menubar (C) Source: https://docs.gtk.org/gtk3/class.ApplicationWindow Example demonstrating how to create a GtkApplicationWindow with a menubar using GtkBuilder and GtkApplication. This involves creating a GtkApplication, building a menubar from an XML string, setting it for the application, and then creating the application window. ```c GtkApplication *app = gtk_application_new ("org.gtk.test", 0); GtkBuilder *builder = gtk_builder_new_from_string ( "" " " " " " " " " " " " " "", -1); GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")); gtk_application_set_menubar (GTK_APPLICATION (app), menubar); g_object_unref (builder); // ... GtkWidget *window = gtk_application_window_new (app); ``` -------------------------------- ### Get GtkLabel Selection Bounds (C) Source: https://docs.gtk.org/gtk3/method.Label.get_selection_bounds Retrieves the start and end character offsets of the selected text within a GtkLabel. It returns TRUE if a non-empty selection exists, otherwise FALSE. The start and end parameters are output arguments that will be populated by the function. ```c gboolean gtk_label_get_selection_bounds ( GtkLabel* label, gint* start, gint* end ) ``` -------------------------------- ### Get Start Position of GtkCssSection (C) Source: https://docs.gtk.org/gtk3/method.CssSection.get_start_position Retrieves the byte offset from the start of the current line for a given GtkCssSection. This function is available since GTK version 3.2. It takes a constant pointer to a GtkCssSection as input and returns a guint representing the byte offset. ```c guint gtk_css_section_get_start_position ( const GtkCssSection* section ) ``` -------------------------------- ### Compile a GTK Application using GCC Source: https://docs.gtk.org/gtk3/getting_started This command demonstrates how to compile a GTK application written in C using GCC. It utilizes `pkg-config` to fetch the necessary compiler and linker flags for the `gtk+-3.0` library, ensuring all GTK dependencies are correctly included during the build process. The output is an executable file named `example-0`. ```bash gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0` ``` -------------------------------- ### Get Default Page Setup - C (GTK+ 3) Source: https://docs.gtk.org/gtk3/method.PrintOperation.get_default_page_setup This C code snippet demonstrates how to retrieve the default page setup from a `GtkPrintOperation` object. It requires a pointer to a `GtkPrintOperation` instance and returns a pointer to a `GtkPageSetup` object. The returned object is owned by the `GtkPrintOperation` instance. ```c GtkPageSetup* gtk_print_operation_get_default_page_setup ( GtkPrintOperation* op ) ``` -------------------------------- ### Create and Display a GTK+ 3 Window with a Button Source: https://docs.gtk.org/gtk3/getting_started This C code snippet initializes a GTK+ 3 application, creates a window, adds a button with the label 'Hello World', and connects signals to handle button clicks. The button click either prints 'Hello World' to the console or destroys the window. It assumes the existence of a 'print_hello' function. ```c GtkWidget *button; GtkWidget *button_box; window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "Window"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_container_add (GTK_CONTAINER (window), button_box); button = gtk_button_new_with_label ("Hello World"); g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL); g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window); gtk_container_add (GTK_CONTAINER (button_box), button); gtk_widget_show_all (window); } int main (int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } ``` -------------------------------- ### Load Gears Menu UI in C Source: https://docs.gtk.org/gtk3/getting_started Initializes an ExampleAppWindow by loading a GTKBuilder UI file that defines the gears menu. This C code snippet demonstrates how to instantiate a GtkBuilder object from a resource and load the specified UI file. ```c // ... static void example_app_window_init (ExampleAppWindow *win) { // ... builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui"); ``` -------------------------------- ### Get Font Family from GtkFontChooser (C) Source: https://docs.gtk.org/gtk3/method.FontChooser.get_font_family Retrieves the PangoFontFamily for the font selected in a GtkFontChooser widget. This function is available since GTK+ 3.2. It returns NULL if the selected font is not installed. The returned PangoFontFamily object is owned by the GtkFontChooser instance and should not be modified or freed. ```c PangoFontFamily* gtk_font_chooser_get_font_family ( GtkFontChooser* fontchooser ) ``` -------------------------------- ### Run Page Setup Dialog in GTK Source: https://docs.gtk.org/gtk3/class.PageSetup Launches the GTK page setup dialog to allow users to configure page layout. It returns a new GtkPageSetup object based on user selections, or NULL if the dialog is canceled. This function is useful for interactive printing configuration. ```c static GtkSettings *settings = NULL; static GtkPageSetup *page_setup = NULL; static void do_page_setup (void) { GtkPageSetup *new_page_setup; if (settings == NULL) settings = gtk_print_settings_new (); new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); if (page_setup) g_object_unref (page_setup); page_setup = new_page_setup; } ``` -------------------------------- ### GtkScale Get Has Origin Source: https://docs.gtk.org/gtk3/method.Scale.get_has_origin Retrieves whether the GtkScale widget has an origin. This is useful for understanding the scale's behavior regarding its starting point. ```APIDOC ## GET /gtk_scale/has_origin ### Description Returns whether the scale has an origin. ### Method GET ### Endpoint /gtk_scale/has_origin ### Parameters #### Path Parameters - **scale** (GtkScale*) - Required - The GtkScale object. ### Response #### Success Response (200) - **has_origin** (boolean) - TRUE if the scale has an origin. #### Response Example ```json { "has_origin": true } ``` ``` -------------------------------- ### GtkPrintOperationget_embed_page_setup Source: https://docs.gtk.org/gtk3/method.PrintOperation.get_embed_page_setup Gets the value of the GtkPrintOperation:embed-page-setup property. This property determines whether page setup selection combos are embedded. ```APIDOC ## GtkPrintOperationget_embed_page_setup ### Description Gets the value of `GtkPrintOperation:embed-page-setup` property. ### Method GET ### Endpoint /websites/gtk_gtk3/print_operation/get_embed_page_setup ### Parameters #### Path Parameters - **op** (GtkPrintOperation*) - Required - The GtkPrintOperation object. ### Request Example ```json { "op": "" } ``` ### Response #### Success Response (200) - **return_value** (boolean) - Whether page setup selection combos are embedded. #### Response Example ```json { "return_value": true } ``` ``` -------------------------------- ### Gtk.Widget:margin-start Source: https://docs.gtk.org/gtk3/class.Image Sets or gets the margin on the start side of the widget, supporting both left-to-right and right-to-left text directions. Available since 3.12. ```APIDOC ## Gtk.Widget:margin-start ### Description Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions. Available since 3.12. ### Method GET/SET (property) ### Endpoint /websites/gtk_gtk3/widgets/Gtk.Widget:margin-start ### Parameters #### Query Parameters - **value** (integer) - Required - The margin value for the start side. ### Request Example ```json { "value": 5 } ``` ### Response #### Success Response (200) - **value** (integer) - The current start margin value. ``` -------------------------------- ### Create a GTK 'Hello World' Application with a Button Source: https://docs.gtk.org/gtk3/getting_started This C code snippet illustrates a 'Hello World' GTK application that includes a button. When the button is clicked, it prints 'Hello World' to the console using `g_print`. This example builds upon the basic window creation by adding interactive elements and signal handling for button clicks. ```c #include static void print_hello (GtkWidget *widget, gpointer data) { g_print ("Hello World\n"); } static void activate (GtkApplication *app, gpointer user_data) { GtkWidget *window; ``` -------------------------------- ### GtkApplication Example for Uniqueness Source: https://docs.gtk.org/gtk3/migrating-libunique This C code snippet shows how to implement single-instance application behavior using GtkApplication. It initializes GtkApplication, connects to the 'activate' signal, and runs the application. The activate function handles showing existing windows or creating a new one. ```c static void activate (GtkApplication *app) { GList *list; GtkWidget *window; list = gtk_application_get_windows (app); if (list) { gtk_window_present (GTK_WINDOW (list->data)); } else { window = create_my_window (); gtk_window_set_application (GTK_WINDOW (window), app); gtk_widget_show (window); } } int main (int argc, char *argv[]) { GtkApplication *app; gint status; app = gtk_application_new ("org.gtk.TestApplication", 0); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } ``` -------------------------------- ### GtkGestureDrag Class Methods Source: https://docs.gtk.org/gtk3/class.GestureDrag This section details the primary methods for interacting with GtkGestureDrag, including creating a new gesture, retrieving drag offsets, and getting start points. ```APIDOC ## GtkGestureDrag ### Description `GtkGestureDrag` is a `GtkGesture` implementation that recognizes drag operations. The drag operation itself can be tracked throught the `GtkGestureDrag::drag-begin`, `GtkGestureDrag::drag-update` and `GtkGestureDrag::drag-end` signals, or the relevant coordinates be extracted through `gtk_gesture_drag_get_offset()` and gtk_gesture_drag_get_start_point(). ### Constructors #### gtk_gesture_drag_new ##### Description Returns a newly created `GtkGesture` that recognizes drags. ##### Method `gtk_gesture_drag_new` ##### Since 3.14 ### Instance Methods #### gtk_gesture_drag_get_offset ##### Description If the `gesture` is active, this function returns `TRUE` and fills in `x` and `y` with the coordinates of the current point, as an offset to the starting drag point. ##### Method `gtk_gesture_drag_get_offset(x: Float, y: Float) ##### Since 3.14 #### gtk_gesture_drag_get_start_point ##### Description If the `gesture` is active, this function returns `TRUE` and fills in `x` and `y` with the drag start coordinates, in window-relative coordinates. ##### Method `gtk_gesture_drag_get_start_point(x: Float, y: Float) ##### Since 3.14 ``` -------------------------------- ### GtkModelButton Example Usage Source: https://docs.gtk.org/gtk3/class.ModelButton An example demonstrating how to use GtkModelButton within a GtkPopoverMenu. ```APIDOC ## Example ```xml True 10 True view.cut Cut True view.copy Copy True view.paste Paste ``` ``` -------------------------------- ### GtkIconTheme Get Example Icon Name Source: https://docs.gtk.org/gtk3/method.IconTheme.get_example_icon_name Retrieves the name of an icon that is representative of the current theme. This is useful for displaying a preview of the icon theme to the user. ```APIDOC ## GET /websites/gtk_gtk3/icon_theme/example_icon_name ### Description Gets the name of an icon that is representative of the current theme (for instance, to use when presenting a list of themes to the user.). ### Method GET ### Endpoint /websites/gtk_gtk3/icon_theme/example_icon_name ### Parameters #### Path Parameters - **icon_theme** (GtkIconTheme*) - Required - The GtkIconTheme object. ### Response #### Success Response (200) - **icon_name** (char*) - The name of an example icon or NULL. Free with g_free(). #### Response Example { "icon_name": "example-icon-name" } ``` -------------------------------- ### GtkPageSetup Instance Methods Source: https://docs.gtk.org/gtk3/class.PageSetup Methods for manipulating and retrieving information from a GtkPageSetup object, including margins, orientation, and paper size. ```APIDOC ## GtkPageSetup Instance Methods ### gtk_page_setup_copy Copies a `GtkPageSetup` object. **Since:** 2.10 ### gtk_page_setup_get_bottom_margin Gets the bottom margin in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the margin measurement. **Returns:** The bottom margin value. **Since:** 2.10 ### gtk_page_setup_get_left_margin Gets the left margin in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the margin measurement. **Returns:** The left margin value. **Since:** 2.10 ### gtk_page_setup_get_orientation Gets the page orientation of the `GtkPageSetup`. **Returns:** The `GtkPageOrientation`. **Since:** 2.10 ### gtk_page_setup_get_page_height Returns the page height in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the height measurement. **Returns:** The page height value. **Since:** 2.10 ### gtk_page_setup_get_page_width Returns the page width in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the width measurement. **Returns:** The page width value. **Since:** 2.10 ### gtk_page_setup_get_paper_height Returns the paper height in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the height measurement. **Returns:** The paper height value. **Since:** 2.10 ### gtk_page_setup_get_paper_size Gets the paper size of the `GtkPageSetup`. **Returns:** A `GtkPaperSize` object. **Since:** 2.10 ### gtk_page_setup_get_paper_width Returns the paper width in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the width measurement. **Returns:** The paper width value. **Since:** 2.10 ### gtk_page_setup_get_right_margin Gets the right margin in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the margin measurement. **Returns:** The right margin value. **Since:** 2.10 ### gtk_page_setup_get_top_margin Gets the top margin in the specified units. **Parameters:** - `unit` (GtkUnit) - The unit for the margin measurement. **Returns:** The top margin value. **Since:** 2.10 ### gtk_page_setup_load_file Loads page setup information from a file. **Parameters:** - `file_name` (string) - The path to the file. **Since:** 2.14 ### gtk_page_setup_load_key_file Loads page setup information from a group in a key file. **Parameters:** - `key_file` (GKeyFile) - The GKeyFile object. - `group_name` (string) - The name of the group to load from. **Since:** 2.14 ### gtk_page_setup_set_bottom_margin Sets the bottom margin of the `GtkPageSetup`. **Parameters:** - `margin` (double) - The desired bottom margin value. - `unit` (GtkUnit) - The unit for the margin measurement. **Since:** 2.10 ### gtk_page_setup_set_left_margin Sets the left margin of the `GtkPageSetup`. **Parameters:** - `margin` (double) - The desired left margin value. - `unit` (GtkUnit) - The unit for the margin measurement. **Since:** 2.10 ### gtk_page_setup_set_orientation Sets the page orientation of the `GtkPageSetup`. **Parameters:** - `orientation` (GtkPageOrientation) - The desired page orientation. **Since:** 2.10 ### gtk_page_setup_set_paper_size Sets the paper size of the `GtkPageSetup` without changing the margins. **Parameters:** - `size` (GtkPaperSize) - The `GtkPaperSize` to set. **Since:** 2.10 ### gtk_page_setup_set_paper_size_and_default_margins Sets the paper size and adjusts margins accordingly. **Parameters:** - `size` (GtkPaperSize) - The `GtkPaperSize` to set. **Since:** 2.10 ### gtk_page_setup_set_right_margin Sets the right margin of the `GtkPageSetup`. **Parameters:** - `margin` (double) - The desired right margin value. - `unit` (GtkUnit) - The unit for the margin measurement. **Since:** 2.10 ### gtk_page_setup_set_top_margin Sets the top margin of the `GtkPageSetup`. **Parameters:** - `margin` (double) - The desired top margin value. - `unit` (GtkUnit) - The unit for the margin measurement. **Since:** 2.10 ### gtk_page_setup_to_file Saves the page setup information to a file. **Parameters:** - `file_name` (string) - The path to the file where the setup will be saved. **Since:** 2.12 ### gtk_page_setup_to_gvariant Serializes the page setup to a GVariant. **Returns:** A `GVariant` representing the page setup. **Since:** 3.22 ### gtk_page_setup_to_key_file Adds the page setup information to a key file. **Parameters:** - `key_file` (GKeyFile) - The GKeyFile object. - `group_name` (string) - The name of the group to add the setup information to. **Since:** 2.12 ``` -------------------------------- ### AtkImage Methods (Vala) Source: https://docs.gtk.org/gtk3/class.RadioButtonAccessible Shows Vala code examples for methods inherited from the Atk.Image interface, including getting the image description and the image locale. ```vala // Get a textual description of this image. atk_image_get_image_description(); // Retrieves the locale identifier associated to the AtkImage. atk_image_get_image_locale(); ``` -------------------------------- ### GtkFontChooser get_font_family Source: https://docs.gtk.org/gtk3/method.FontChooser.get_font_family Retrieves the PangoFontFamily representing the selected font family from a GtkFontChooser widget. Returns NULL if the selected font is not installed. ```APIDOC ## GET /websites/gtk_gtk3/font_family ### Description Gets the `PangoFontFamily` representing the selected font family. Font families are a collection of font faces. If the selected font is not installed, returns `NULL`. ### Method GET ### Endpoint /websites/gtk_gtk3/font_family ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **font_family** (PangoFontFamily | null) - A `PangoFontFamily` representing the selected font family, or `NULL` if the font is not installed. The returned object is owned by the instance and must not be modified or freed. #### Response Example ```json { "font_family": "PangoFontFamily_Object_Reference" } ``` #### Error Response None specified ``` -------------------------------- ### GtkApplicationWindow Instance Methods Source: https://docs.gtk.org/gtk3/class.ApplicationWindow Details on methods specific to GtkApplicationWindow for managing help overlays, window IDs, and menu bar visibility. ```APIDOC ## gtk_application_window_get_help_overlay ### Description Gets the `GtkShortcutsWindow` that has been set up with a prior call to gtk_application_window_set_help_overlay(). ### Method GET ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) - **GtkShortcutsWindow** - The associated GtkShortcutsWindow, or NULL if none is set. #### Response Example None ``` ```APIDOC ## gtk_application_window_get_id ### Description Returns the unique ID of the window. If the window has not yet been added to a `GtkApplication`, returns `0`. ### Method GET ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) - **unsigned int** - The unique ID of the window. #### Response Example None ``` ```APIDOC ## gtk_application_window_get_show_menubar ### Description Returns whether the window will display a menubar for the app menu and menubar as needed. ### Method GET ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) - **boolean** - TRUE if the menubar is shown, FALSE otherwise. #### Response Example None ``` ```APIDOC ## gtk_application_window_set_help_overlay ### Description Associates a shortcuts window with the application window, and sets up an action with the name win.show-help-overlay to present it. ### Method SET ### Endpoint N/A ### Parameters #### Request Body - **help_overlay** (GtkShortcutsWindow) - The GtkShortcutsWindow to associate, or NULL to remove any existing one. ### Request Example ```json { "help_overlay": "" } ``` ### Response #### Success Response (200) None #### Response Example None ``` ```APIDOC ## gtk_application_window_set_show_menubar ### Description Sets whether the window will display a menubar for the app menu and menubar as needed. ### Method SET ### Endpoint N/A ### Parameters #### Request Body - **show_menubar** (boolean) - TRUE to show the menubar, FALSE to hide it. ### Request Example ```json { "show_menubar": true } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get GtkWidget Start Margin (C) Source: https://docs.gtk.org/gtk3/method.Widget.get_margin_start Retrieves the value of the 'GtkWidget:margin-start' property for a given GtkWidget. This function is part of the GTK+ 3 library and is available since version 3.12. It takes a pointer to a GtkWidget as input and returns an integer representing the start margin. ```c gint gtk_widget_get_margin_start ( GtkWidget* widget ) ``` -------------------------------- ### GtkModelButton Example in GtkPopoverMenu Source: https://docs.gtk.org/gtk3/class.ModelButton An XML example demonstrating the usage of GtkModelButton within a GtkPopoverMenu. It shows how to associate actions like 'view.cut', 'view.copy', and 'view.paste' with GtkModelButton instances. ```xml True 10 True view.cut Cut True view.copy Copy True view.paste Paste ``` -------------------------------- ### Gtkprint_run_page_setup_dialog Source: https://docs.gtk.org/gtk3/func.print_run_page_setup_dialog Runs a page setup dialog, allowing the user to modify page setup parameters. ```APIDOC ## Gtkprint_run_page_setup_dialog ### Description Runs a page setup dialog, letting the user modify the values from `page_setup`. If the user cancels the dialog, the returned `GtkPageSetup` is identical to the passed in `page_setup`, otherwise it contains the modifications done in the dialog. Note that this function may use a recursive mainloop to show the page setup dialog. See `gtk_print_run_page_setup_dialog_async()` if this is a problem. ### Method GET (or similar, depending on context as this is a function call) ### Endpoint N/A (This is a function call, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` GtkPageSetup* new_page_setup = gtk_print_run_page_setup_dialog(parent_window, current_page_setup, print_settings); ``` ### Response #### Success Response (200) - **GtkPageSetup** (GtkPageSetup) - A new `GtkPageSetup` object containing the user's modifications or the original `page_setup` if canceled. The caller takes ownership. #### Response Example ``` // Assuming a GtkPageSetup object is returned and assigned to new_page_setup ``` ``` -------------------------------- ### Handle Screen Changed Event - GTK Source: https://docs.gtk.org/gtk3/class.Paned The ::screen-changed signal gets emitted when the screen of a widget has changed. This might happen in multi-monitor setups or when displays are reconfigured. ```C g_signal_connect(widget, "screen-changed", G_CALLBACK(on_screen_changed), NULL); ``` -------------------------------- ### Creating GtkBuilder Instance from File (C) Source: https://docs.gtk.org/gtk3/class.Builder Illustrates how to create a GtkBuilder instance by loading a UI description from a file. This is a common method for initializing UI elements. ```c GtkBuilder* builder = gtk_builder_new_from_file ("your_ui_file.glade"); ``` -------------------------------- ### Get Item Row Index (C) Source: https://docs.gtk.org/gtk3/class.IconView Returns the row index (starting from 0) where a specific item, identified by its GtkTreePath, is currently displayed within the GtkIconView. ```c gtk_icon_view_get_item_row ``` -------------------------------- ### Get Item Column Index (C) Source: https://docs.gtk.org/gtk3/class.IconView Returns the column index (starting from 0) where a specific item, identified by its GtkTreePath, is currently displayed within the GtkIconView. ```c gtk_icon_view_get_item_column ``` -------------------------------- ### GtkTreeStore Constructor Example (C) Source: https://docs.gtk.org/gtk3/class.TreeStore This C code snippet shows how to create a new GtkTreeStore with a specified number of columns and their data types. It utilizes standard GObject fundamental types. ```c GtkTreeStore* tree_store = gtk_tree_store_new(n_columns, type1, type2, ...); ``` -------------------------------- ### Create GtkPageSetup from File (C) Source: https://docs.gtk.org/gtk3/ctor.PageSetup.new_from_file Reads the page setup from the specified file. Returns a new GtkPageSetup object or NULL if an error occurs. Requires GTK+ 2.12 or later. ```c GtkPageSetup* gtk_page_setup_new_from_file ( const gchar* file_name, GError** error ) ``` -------------------------------- ### Get GtkGestureDrag Offset Source: https://docs.gtk.org/gtk3/class.GesturePan If a GtkGestureDrag (and by extension, GtkGesturePan) is active, this function returns the current offset of the drag. The offset is calculated relative to the starting point of the drag. ```c bool gtk_gesture_drag_get_offset (GtkGestureDrag *gesture, gdouble *x, gdouble *y); // If the gesture is active, this function returns TRUE and fills in x and y with the coordinates of the current point, as an offset to the starting drag point. // since: 3.14 ``` -------------------------------- ### GtkMenuShell Instance Methods Source: https://docs.gtk.org/gtk3/class.MenuShell Documentation for instance methods available on GtkMenuShell objects, including methods for activating items, manipulating the menu item list, and managing menu state. ```APIDOC ## GtkMenuShell Instance Methods ### Activate Item #### `gtk_menu_shell_activate_item(menu_item)` Activates the specified menu item within the menu shell. ### Append Item #### `gtk_menu_shell_append(menu_item)` Adds a new `GtkMenuItem` to the end of the menu shell's item list. ### Bind Model #### `gtk_menu_shell_bind_model(model, callback, user_data)` Establishes a binding between a `GtkMenuShell` and a `GMenuModel`. *Since: 3.6* ### Cancel Selection #### `gtk_menu_shell_cancel()` Cancels the current selection within the menu shell. *Since: 2.4* ### Deactivate #### `gtk_menu_shell_deactivate()` Deactivates the menu shell, making it inactive. ### Deselect Item #### `gtk_menu_shell_deselect()` Deselects the currently selected item in the menu shell, if any. ### Get Parent Shell #### `gtk_menu_shell_get_parent_shell()` Gets the parent menu shell of this menu shell. *Since: 3.0* ### Get Selected Item #### `gtk_menu_shell_get_selected_item()` Gets the currently selected menu item. *Since: 3.0* ### Get Take Focus #### `gtk_menu_shell_get_take_focus()` Returns `TRUE` if the menu shell will take keyboard focus when popped up. *Since: 2.8* ### Insert Item #### `gtk_menu_shell_insert(menu_item, position)` Adds a new `GtkMenuItem` at the specified `position` in the menu shell's item list. ### Prepend Item #### `gtk_menu_shell_prepend(menu_item)` Adds a new `GtkMenuItem` to the beginning of the menu shell's item list. ### Select First Visible Item #### `gtk_menu_shell_select_first(select_again)` Selects the first visible or selectable child of the menu shell. Tearoff items are not selected unless they are the only item. *Since: 2.2* ### Select Item #### `gtk_menu_shell_select_item(menu_item)` Selects the specified menu item within the menu shell. ### Set Take Focus #### `gtk_menu_shell_set_take_focus(take_focus)` If `take_focus` is `TRUE`, the menu shell will take keyboard focus upon popup, enabling keyboard navigation. Default is `TRUE`. *Since: 2.8* ``` -------------------------------- ### Setup GTK Widget as Drag Source (C) Source: https://docs.gtk.org/gtk3/method.Widget.drag_source_set Configures a GTK widget to act as a drag source. This function requires the widget to have an associated window. It takes parameters for the starting button mask, supported drag targets, the number of targets, and the allowed drag actions. ```c void gtk_drag_source_set ( GtkWidget* widget, GdkModifierType start_button_mask, const GtkTargetEntry* targets, gint n_targets, GdkDragAction actions ) ``` -------------------------------- ### Configuring GTK Build with ./configure Source: https://docs.gtk.org/gtk3/building How to run the `./configure` script to prepare the GTK build for your system. The `--prefix` option specifies the installation directory, allowing customization of where the libraries and binaries are placed. ```shell ./configure --prefix=/opt/gtk ``` -------------------------------- ### Get Text Buffer Bounds (C) Source: https://docs.gtk.org/gtk3/method.TextBuffer.get_bounds Retrieves the first and last iterators representing the entire content of a GtkTextBuffer. The buffer's content lies within the range specified by the start and end iterators. This function requires a GtkTextBuffer and two GtkTextIter pointers to store the start and end positions. ```c void gtk_text_buffer_get_bounds ( GtkTextBuffer* buffer, GtkTextIter* start, GtkTextIter* end ) ``` -------------------------------- ### GtkPageSetup: new_from_key_file Source: https://docs.gtk.org/gtk3/ctor.PageSetup.new_from_key_file Reads the page setup from a specified group in a GKeyFile. Restores a GtkPageSetup object. Returns NULL if an error occurs. ```APIDOC ## GtkPageSetup: new_from_key_file ### Description Reads the page setup from the group `group_name` in the key file `key_file`. Returns a new `GtkPageSetup` object with the restored page setup, or `NULL` if an error occurred. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **GtkPageSetup*** - The restored `GtkPageSetup` object. The caller takes ownership and is responsible for freeing it. #### Response Example None ### Errors - If an error occurs, a `GError` object will be returned via the `error` parameter. ``` -------------------------------- ### GET /gtk_toolbar_get_item_index Source: https://docs.gtk.org/gtk3/method.Toolbar.get_item_index Retrieves the position (index) of a specific GtkToolItem within a GtkToolbar. The index starts from 0. It's an error if the item is not part of the toolbar. ```APIDOC ## GET /gtk_toolbar_get_item_index ### Description Returns the position of `item` on the toolbar, starting from 0. It is an error if `item` is not a child of the toolbar. ### Method GET ### Endpoint /gtk_toolbar_get_item_index ### Parameters #### Query Parameters - **toolbar** (GtkToolbar*) - Required - The GtkToolbar to search within. - **item** (GtkToolItem*) - Required - The GtkToolItem whose index is to be found. ### Response #### Success Response (200) - **return_value** (gint) - The zero-based index of the item on the toolbar. #### Response Example ```json { "return_value": 0 } ``` ```