Crate native_windows_gui

Source

Re-exports§

pub extern crate stretch;

Modules§

keys
Windows virtual key code

Macros§

subclass_control
Automatically implements the functionnalities required to process an external struct as a NWG control

Structs§

AnimationTimer
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.
AnimationTimerBuilder
BaseTimerBuilder
Low level timer builder. Instanced by ControlBase::build_timer.
Bitmap
A wrapper over a bitmap file (*.bmp)
BitmapBuilder
Button
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.
ButtonBuilder
ButtonFlags
The button flags
CharEffects
The effets that can be applied to the text of a rich edit control
CharFormat
Contains information about character formatting in a rich edit control
CheckBox
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.
CheckBoxBuilder
CheckBoxFlags
The CheckBox flags
Clipboard
A global object that wraps the system clipboard. It can be used to set or get the system cliboard content.
ClipboardData
Wrapper over a clipboard global allocation handle. This value should be released with release or dropped before closing the clipboard.
ColorDialog
Displays a modal dialog box that allows the user to choose a specific color value.
ColorDialogBuilder
The builder for a ColorDialog object. Use ColorDialog::builder to create one.
ComboBox
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.
ComboBoxBuilder
ComboBoxFlags
The ComboBox flags
ControlBase
Control base is a low level interface to create base Windows handle (HWND, HMENU, TIMER, etc). This is used internally by every controls.
Cursor
A wrapper over a cursor file (*.cur)
CursorBuilder
DatePicker
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.
DatePickerBuilder
DatePickerFlags
The DatePickerFlags flags
DatePickerValue
A date struct that can be passed to a date time picker control. Fields are self explanatory.
DropFiles
Opaque type over one or more dragged files.
DynLayout
DynLayoutBuilder
Builder for a DynLayout struct
DynLayoutInner
A layout that lays out widgets This is the inner data shared between the callback and the application
DynLayoutItem
A control item in a DynLayout
EmbedResource
EmbedResource represent an embed resource file (“.rc”) inside on the executable module.
EmbedResourceBuilder
The EmbedResource builder. See EmbedResource docs.
EventHandler
An opaque structure that represent a window subclass hook.
ExternCanvas
An ExternCanvas is a window/children control that is painted to by an external API (such as OpenGL, Vulkan or DirectX).
ExternCanvasBuilder
ExternCanvasFlags
The extern canvas flags.
FileDialog
A file dialog control
FileDialogBuilder
FlexboxLayout
A flexbox layout that organizes the children control in a parent control. Flexbox uses the stretch library internally ( https://github.com/vislyhq/stretch ).
FlexboxLayoutBuilder
FlexboxLayoutChildren
FlexboxLayoutChildrenMut
A wrapper that expose the inner collection of a flexboxlayout.
FlexboxLayoutItem
Font
Represent a system font.
FontBuilder
Builds a font struct
FontDialog
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).
FontDialogBuilder
The builder for a FontDialog object. Use FontDialog::builder to create one.
FontInfo
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
Frame
A frame is a rectangle containing children controls. Frame is implemented as a custom control.
FrameBuilder
FrameFlags
The frame flags
GlobalCursor
A global object that wraps the system cursor. Requires the cursor feature.
GridLayout
A layout that lays out widgets in a grid NWG layouts use interior mutability to manage their controls.
GridLayoutBuilder
Builder for a GridLayout struct
GridLayoutInner
A layout that lays out widgets in a grid This is the inner data shared between the callback and the application
GridLayoutItem
A control item in a GridLayout
HmenuBuilder
Low level HMENU builder. Instanced by ControlBase::build_hmenu.
HwndBuilder
Low level HWND builder. Instanced by ControlBase::build_hwnd.
Icon
A wrapper over a icon file (*.ico)
IconBuilder
ImageData
Represents a source of pixel that can be read, but cannot be written back to.
ImageDecoder
A image decoder. Can load an extended number of image file format from a filename, from a file handle, or from a stream.
ImageDecoderBuilder
A blank builder for the image decoder
ImageFrame
An image frame is a control that displays a Bitmap or a Icon image resource.
ImageFrameBuilder
ImageFrameFlags
ImageList
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.
ImageListBuilder
ImageSource
Represents a image data source in read only mode.
InsertListViewColumn
Represents a column in a detailed list view
InsertListViewItem
Represents a list view item parameters
Label
A label is a single line of static text. Use \r\n to split the text on multiple lines.
LabelBuilder
LabelFlags
The label flags
ListBox
A list box is a control window that contains a simple list of items from which the user can choose.
ListBoxBuilder
ListBoxFlags
The listbox flags
ListView
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.
ListViewBuilder
ListViewColumn
The data of a list view column
ListViewColumnFlags
The format flags for a list view column. Not all combination are valid. The alignment of the leftmost column is always LEFT.
ListViewExFlags
The list view extended flags (to use with ListViewBuilder::ex_flags):
ListViewFlags
The list view flags:
ListViewItem
The data of a list view item
Locale
Represent a Windows locale. Can be used to fetch a lot of information regarding the locale.
MemFont
Menu
A windows menu. Can represent a menu in a window menubar, a context menu, or a submenu in another menu
MenuBuilder
MenuItem
A windows menu item. Can be added to a menubar or another menu.
MenuItemBuilder
MenuSeparator
A menu separator. Can be added between two menu item to separte them. Cannot be added to a menubar.
MessageParams
A structure that defines how a messagebox should look and behave.
MessageWindow
A message only top level window. At least one top level window is required to make a NWG application. See the module documentation
MessageWindowBuilder
MinMaxInfo
Monitor
Expose basic properties of the monitor(s) on the system and the virtual screen.
Notice
An invisible component that can be triggered by other thread.
NoticeBuilder
NoticeSender
NoticeSender sends message to its parent Notice from another thread
NumberSelect
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.
NumberSelectBuilder
NumberSelectFlags
The NumberSelect flags
OtherBuilder
Low level builder for controls without specific winapi contructors. Instanced by ControlBase::build_notice or ControlBase::build_tray_notification.
PaintData
Opaque type over a paint event’s data
ParaFormat
Contains information about paragraph formatting in a rich edit control
Plotters
A canvas-like control that act as a backend for the plotters library. The plotters control use direct2D to render to the canvas.
PlottersBackend
Direct2D backend for the plotters control
PlottersBuilder
PlottersDrawingArea
An object that can be used as a drawing area by the plotters library.
PopupMenuFlags
Menu flags to use with the Menu::popup_with_flags function. Using PopupMenuFlags::empty is the same as ALIGN_LEFT|ALIGN_TOP|LEFT_BUTTON
ProgressBar
A progress bar is a window that an application can use to indicate the progress of a lengthy operation.
ProgressBarBuilder
ProgressBarFlags
RadioButton
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.
RadioButtonBuilder
RadioButtonFlags
The radio button flags
RawEventHandler
An opaque structure that represent a window subclass hook.
RawResource
Represents a raw handle to a embed resource. Manipulating raw resources is inherently unsafe. RawResources are loaded using EmbedResource::raw and EmbedResource::raw_str
RichLabel
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.
RichLabelBuilder
RichLabelFlags
The rich label flags
RichTextBox
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.
RichTextBoxBuilder
RichTextBoxFlags
The rich text box flags
ScrollBar
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.
ScrollBarBuilder
ScrollBarFlags
The scroll bar flags
StatusBar
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.
StatusBarBuilder
Tab
A subwindow in a TabContainer widget. A Tab control can only be added as a child of a TabContainer.
TabBuilder
TabsContainer
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.
TabsContainerBuilder
TabsContainerFlags
TextBox
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.
TextBoxBuilder
TextBoxFlags
The text box flags
TextInput
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
TextInputBuilder
TextInputFlags
The text input flags
TimerDeprecated
WARNING: Use AnimationTimer instead. The winapi timer does not have a constant tick and will call your single threaded from another thread.
TimerBuilder
ToolTipTextData
A wrapper structure that sets the tooltip text on an OnTooltipText callback
Tooltip
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.
TooltipBuilder
TrackBar
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.
TrackBarBuilder
TrackBarFlags
The track bar flags
TrayNotification
A control that handle system tray notification. A TrayNotification wraps a single icon in the Windows system tray.
TrayNotificationBuilder
TrayNotificationFlags
TreeItem
A reference to an item in a TreeView
TreeItemState
A tree item state
TreeView
A tree-view control is a window that displays a hierarchical list of items.
TreeViewBuilder
Builder for a TreeView
TreeViewFlags
The tree view flags
TreeViewIterator
A structure to iterate over the items of a TreeView Requires the feature tree-view-iterator and tree-view
Window
A basic top level window. At least one top level window is required to make a NWG application.
WindowBuilder
WindowCloseData
Opaque type that manages if a window should be closed after an OnClose event
WindowFlags
The window flags.

Enums§

Calendar
CheckBoxState
Represents the check status of a checkbox
ClipboardFormat
ContainerFormat
A list of container format implemented in WIC
ControlHandle
Inner handle type used internally by each control.
Event
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
EventData
Events data sent by the controls.
ExpandState
Possible state of a tree item regarding the “expanded/collapsed” state
FileDialogAction
A enum that dictates how a file dialog should behave Members:
FirstDayOfYear
HTextAlign
Text align constant on the horizontal axis
ListViewColumnSortArrow
Represents a column sort indicator in a detailed list view
ListViewImageListType
Items in a list view can be associated with multiple image list. This identify which image list to set/get using the ListView api.
ListViewStyle
The display style for the items in a list view
MeasurementSystem
MessageButtons
Enum of message box buttons (to use with MessageParams )
MessageChoice
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.
MessageIcons
Enum of message box icons (to use with MessageParams )
MousePressEvent
NegativeCurrency
NegativeNumberMode
NumberSelectData
The value inside a number select and the limits of that value
NwgError
Error enums used in the native window gui crate
OemBitmap
List of system bitmaps. To use with the Image resource.
OemCursor
List of system cursors. To use with the Image resource.
OemIcon
List of system icons. To use with the Image resource.
OemImage
List of built-in system images identifiers. To use with the Image resource.
ParaAlignment
Paragraph alignment
ParaLineSpacing
Type of line spacing
ParaNumbering
Options used for bulleted or numbered paragraphs.
ParaNumberingStyle
Numbering style used with the numbering paragraphs. Used with ParamNumbering
PlottersError
Errors that can be returned when using the Plotters control
PositiveCurrency
ProgressBarState
RadioButtonState
Represents the check status of a radio button
RawResourceType
Raw resource type that can be stored into an embedded resource.
TooltipIcon
A select of default icon to show in a tooltip
TreeInsert
Select the position of a new item that is about to be inserted in a TreeView
TreeItemAction
An action that can be applied to a tree item. Used in events
UnderlineType
VTextAlign
Text align constant on the vertical axis

Traits§

NativeUi
A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.
PartialUi
A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.

Functions§

bind_event_handler
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.
bind_raw_event_handler
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_thread_events
Dispatch system events in the current thread. This method will pause the thread until there are events to process.
dispatch_thread_events_with_callback
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.
dpi
enable_visual_styles
Enable the Windows visual style in the application without having to use a manifest
error_message
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
fatal_message
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
full_bind_event_handler
Hook the window subclass with the default event dispatcher. The hook is applied to the window and all it’s children (recursively).
has_raw_handler
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.
init
Initializes some application wide GUI settings. This includes default styling and common controls resources.
init_common_controls
Ensure that the dll containing the winapi controls is loaded. Also register the custom classes used by NWG
message
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
modal_error_message
Display a simple error message box. The message box has for style MessageButtons::Ok and MessageIcons::Error.
modal_fatal_message
Display a message box and then panic. The message box has for style MessageButtons::Ok and MessageIcons::Error .
modal_info_message
Display a simple message box. The message box has for style MessageButtons::Ok and MessageIcons::Info.
modal_message
Create a message box for a selected window. The window will be locked until the user close the message box.
scale_factor
set_dpi_awarenessDeprecated
simple_message
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
stop_thread_dispatch
Break the events loop running on the current thread
unbind_event_handler
Free all associated callbacks with the event handler.
unbind_raw_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.