Crate native_windows_gui
source · [−]Re-exports
pub extern crate stretch;
Modules
Windows virtual key code
Macros
Automatically implements the functionnalities required to process an external struct as a NWG control
Structs
A timer is an invisible UI component that trigger the OnTimerTick
event at the specified interval.
Timers are mosty used to handle animations OR to create a timeout. To sync multithreaded action see the Notice
object.
Low level timer builder. Instanced by ControlBase::build_timer
.
A wrapper over a bitmap file (*.bmp)
A push button is a rectangle containing an application-defined text label.
Use ImageButton
if you need to have a button that ONLY contains an icon or a bitmap.
The button flags
The effets that can be applied to the text of a rich edit control
Contains information about character formatting in a rich edit control
A check box consists of a square box and an application-defined labe that indicates a choice the user can make by selecting the button. Applications typically display check boxes to enable the user to choose one or more options that are not mutually exclusive.
The CheckBox flags
A global object that wraps the system clipboard. It can be used to set or get the system cliboard content.
Wrapper over a clipboard global allocation handle.
This value should be released with release
or dropped before closing the clipboard.
Displays a modal dialog box that allows the user to choose a specific color value.
The builder for a ColorDialog
object. Use ColorDialog::builder
to create one.
A combo box consists of a list and a selection field. The list presents the options that a user can select, and the selection field displays the current selection.
The ComboBox flags
Control base is a low level interface to create base Windows handle (HWND, HMENU, TIMER, etc). This is used internally by every controls.
A wrapper over a cursor file (*.cur)
A date and time picker (DTP) control provides a simple and intuitive interface through which to exchange date and time information with a user. For example, with a DTP control you can ask the user to enter a date and then easily retrieve the selection.
The DatePickerFlags flags
A date struct that can be passed to a date time picker control. Fields are self explanatory.
Opaque type over one or more dragged files.
Builder for a DynLayout
struct
A layout that lays out widgets This is the inner data shared between the callback and the application
A control item in a DynLayout
EmbedResource represent an embed resource file (“.rc”) inside on the executable module.
The EmbedResource builder. See EmbedResource
docs.
An opaque structure that represent a window subclass hook.
An ExternCanvas
is a window/children control that is painted to by an external API (such as OpenGL, Vulkan or DirectX).
The extern canvas flags.
A file dialog control
A flexbox layout that organizes the children control in a parent control. Flexbox uses the stretch library internally ( https://github.com/vislyhq/stretch ).
A wrapper that expose the inner collection of a flexboxlayout.
Represent a system font.
Builds a font struct
The Font dialog box lets the user choose attributes for a logical font, such as font family and associated font style, point size, effects (underline, strikeout), and a script (or character set).
The builder for a FontDialog
object. Use FontDialog::builder
to create one.
Represent a font parameters. Returned by the font dialog when the user selected a font.
Can also be used to create a Font resource using Font::from_info
For more information on the parameters see: https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-logfonta
A frame is a rectangle containing children controls. Frame is implemented as a custom control.
The frame flags
A global object that wraps the system cursor.
Requires the cursor
feature.
A layout that lays out widgets in a grid NWG layouts use interior mutability to manage their controls.
Builder for a GridLayout
struct
A layout that lays out widgets in a grid This is the inner data shared between the callback and the application
A control item in a GridLayout
Low level HMENU builder. Instanced by ControlBase::build_hmenu
.
Low level HWND builder. Instanced by ControlBase::build_hwnd
.
A wrapper over a icon file (*.ico)
Represents a source of pixel that can be read, but cannot be written back to.
A image decoder. Can load an extended number of image file format from a filename, from a file handle, or from a stream.
A blank builder for the image decoder
An image frame is a control that displays a Bitmap
or a Icon
image resource.
An image list is a collection of images of the same size, each of which can be referred to by its index. Image lists are used in controls such as tabs container and tree view in order to add icon next to the items.
Represents a image data source in read only mode.
Represents a column in a detailed list view
Represents a list view item parameters
A label is a single line of static text. Use \r\n
to split the text on multiple lines.
The label flags
A list box is a control window that contains a simple list of items from which the user can choose.
The listbox flags
A list-view control is a window that displays a collection of items. List-view controls provide several ways to arrange and display items and are much more flexible than simple ListBox.
The data of a list view column
The format flags for a list view column. Not all combination are valid. The alignment of the leftmost column is always LEFT.
The list view extended flags (to use with ListViewBuilder::ex_flags):
The list view flags:
The data of a list view item
Represent a Windows locale. Can be used to fetch a lot of information regarding the locale.
A windows menu. Can represent a menu in a window menubar, a context menu, or a submenu in another menu
A windows menu item. Can be added to a menubar or another menu.
A menu separator. Can be added between two menu item to separte them. Cannot be added to a menubar.
A structure that defines how a messagebox should look and behave.
A message only top level window. At least one top level window is required to make a NWG application. See the module documentation
Expose basic properties of the monitor(s) on the system and the virtual screen.
An invisible component that can be triggered by other thread.
NoticeSender sends message to its parent Notice
from another thread
A NumberSelect control is a pair of arrow buttons that the user can click to increment or decrement a value. NumberSelect is implemented as a custom control because the one provided by winapi really sucks.
The NumberSelect flags
Low level builder for controls without specific winapi contructors.
Instanced by ControlBase::build_notice
or ControlBase::build_tray_notification
.
Opaque type over a paint event’s data
Contains information about paragraph formatting in a rich edit control
A canvas-like control that act as a backend for the plotters library. The plotters control use direct2D to render to the canvas.
Direct2D backend for the plotters control
An object that can be used as a drawing area by the plotters library.
Menu flags to use with the Menu::popup_with_flags
function.
Using PopupMenuFlags::empty
is the same as ALIGN_LEFT|ALIGN_TOP|LEFT_BUTTON
A progress bar is a window that an application can use to indicate the progress of a lengthy operation.
A radio button (also called option button) consists of a round button and an application-defined label, icon, or bitmap that indicates a choice the user can make by selecting the button. An application typically uses radio buttons in a group box to enable the user to choose one of a set of related but mutually exclusive options.
The radio button flags
An opaque structure that represent a window subclass hook.
Represents a raw handle to a embed resource. Manipulating raw resources is inherently unsafe.
RawResources
are loaded using EmbedResource::raw
and EmbedResource::raw_str
A rich label is a label that supports rich text. This control is built on top of the rich text box control and as such
require the rich-textbox
feature. Enable “MULTI_LINE” to support multi line labels.
The rich label flags
An edit control is a rectangular control window to permit the user to enter and edit text by typing on the keyboard
This control allow multi line input. For a single line of text, use TextInput
.
The rich text box flags
A window can display a data object, such as a document or a bitmap, that is larger than the window’s client area. When provided with a scroll bar, the user can scroll a data object in the client area to bring into view the portions of the object that extend beyond the borders of the window.
The scroll bar flags
A status bar is a horizontal window at the bottom of a parent window in which an application can display various kinds of status information. Status bar cannot stack, so there must be only one per window.
A subwindow in a TabContainer
widget. A Tab control can only be added as a child of a TabContainer
.
A tabs container is a frame-like control that can contain Tab
control.
Tabs are added by specifying the TabsContainer
as parent in the Tab
builder.
An edit control is a rectangular control window to permit the user to enter and edit text by typing on the keyboard
This control allow multi line input. For a single line of text, use TextInput
.
The text box flags
An edit control is a rectangular control window to permit the user to enter and edit text by typing on the keyboard
This control only allow a single line input. For block of text, use TextBox
.
Winapi documentation: https://docs.microsoft.com/en-us/windows/win32/controls/about-edit-controls#text-and-input-styles
The text input flags
WARNING: Use AnimationTimer instead. The winapi timer does not have a constant tick and will call your single threaded from another thread.
A wrapper structure that sets the tooltip text on an OnTooltipText
callback
Tooltips appear automatically, or pop up, when the user pauses the mouse pointer over a tool or some other UI element. The tooltip appears near the pointer and disappears when the user clicks a mouse button, moves the pointer away from the tool, or simply waits for a few seconds.
A trackbar is a window that contains a slider (sometimes called a thumb) in a channel, and optional tick marks. When the user moves the slider, using either the mouse or the direction keys, the trackbar sends notification messages to indicate the change.
The track bar flags
A control that handle system tray notification. A TrayNotification wraps a single icon in the Windows system tray.
A reference to an item in a TreeView
A tree item state
A tree-view control is a window that displays a hierarchical list of items.
Builder for a TreeView
The tree view flags
A structure to iterate over the items of a TreeView
Requires the feature tree-view-iterator
and tree-view
A basic top level window. At least one top level window is required to make a NWG application.
Opaque type that manages if a window should be closed after an OnClose event
The window flags.
Enums
Represents the check status of a checkbox
A list of container format implemented in WIC
Inner handle type used internally by each control.
Events are identifiers that are sent by controls on user interaction
Some events also have data that can be further processed by the event loop. See EventData
Events data sent by the controls.
Possible state of a tree item regarding the “expanded/collapsed” state
A enum that dictates how a file dialog should behave Members:
Text align constant on the horizontal axis
Represents a column sort indicator in a detailed list view
Items in a list view can be associated with multiple image list. This identify which image list to set/get using the ListView api.
The display style for the items in a list view
Enum of message box buttons (to use with MessageParams
)
Return value of message
. Define the button that the user clicked. If the user
cancelled the message box by clicking on X button of the window, MessageChoice::Cancel
is returned.
Enum of message box icons (to use with MessageParams
)
The value inside a number select and the limits of that value
Error enums used in the native window gui crate
List of system bitmaps. To use with the Image
resource.
List of system cursors. To use with the Image
resource.
List of system icons. To use with the Image
resource.
List of built-in system images identifiers. To use with the Image
resource.
Paragraph alignment
Type of line spacing
Options used for bulleted or numbered paragraphs.
Numbering style used with the numbering paragraphs. Used with ParamNumbering
Errors that can be returned when using the Plotters control
Represents the check status of a radio button
Raw resource type that can be stored into an embedded resource.
A select of default icon to show in a tooltip
Select the position of a new item that is about to be inserted in a TreeView
An action that can be applied to a tree item. Used in events
Text align constant on the vertical axis
Traits
A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.
A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.
Functions
Hook the window subclass with the default event dispatcher. The hook is applied to the control and its parent. All common controls send their events to their parent.
Set a window subclass the uses the process_raw_events
function of NWG.
The subclass is only applied to the control itself and NOT the children.
Dispatch system events in the current thread. This method will pause the thread until there are events to process.
Dispatch system events in the current thread AND execute a callback after each peeking attempt.
Unlike dispath_thread_events
, this method will not pause the thread while waiting for events.
Enable the Windows visual style in the application without having to use a manifest
Display a simple error message box. The message box has for style MessageButtons::Ok
and MessageIcons::Error
.
It is recommended to use modal_error_message
because it locks the window that creates the message box.
This method may be deprecated in the future
Display a message box and then panic. The message box has for style MessageButtons::Ok
and MessageIcons::Error
.
It is recommended to use modal_fatal_message
because it locks the window that creates the message box.
This method may be deprecated in the future
Hook the window subclass with the default event dispatcher. The hook is applied to the window and all it’s children (recursively).
Check if a raw handler with the specified handler_id is currently bound on the control. This function will panic if the handle parameter is not a window control.
Initializes some application wide GUI settings. This includes default styling and common controls resources.
Ensure that the dll containing the winapi controls is loaded. Also register the custom classes used by NWG
Create an application wide message box.
It is recommended to use modal_message
because it locks the window that creates the message box.
This method may be deprecated in the future
Display a simple error message box. The message box has for style MessageButtons::Ok
and MessageIcons::Error
.
Display a message box and then panic. The message box has for style MessageButtons::Ok
and MessageIcons::Error
.
Display a simple message box. The message box has for style MessageButtons::Ok
and MessageIcons::Info
.
Create a message box for a selected window. The window will be locked until the user close the message box.
Display a simple message box. The message box has for style MessageButtons::Ok
and MessageIcons::Info
.
It is recommended to use modal_info_message
because it locks the window that creates the message box.
This method may be deprecated in the future
Break the events loop running on the current thread
Free all associated callbacks with the event handler.
Remove the raw event handler from the associated window. Calling unbind twice or trying to unbind an handler after destroying its parent will cause the function to panic.