Documentation
¶
Overview ¶
Package wingui https://docs.microsoft.com/zh-cn/windows/win32/controls/progress-bar-control#using-progress-bars
* wingui Golang GUI library
Usage ¶
### Simple usage:
Generate x.syso file from rc or res file use `windres.exe` tool.
genereate syso:
`windres -i emptyProject/Debug/resource.res -O coff -o vsui.syso`
or
`windres -i ui/ui.rc -O coff -o ui.syso`
main.go ```go package main
import "github.com/whtiehack/wingui"
func main() { dlg, _ := wingui.NewDialog(101, 0, nil) dlg.SetIcon(105) btnok, _ := wingui.BindNewButton(1002, dlg) btncancel, _ := wingui.BindNewButton(1003, dlg) btnok.OnClicked = func() { dlg.Close() } btncancel.OnClicked = btnok.OnClicked dlg.Show() // This invoke is optional. wingui.SetCurrentDialog(dlg.Handle()) wingui.MessageLoop() }
```
run: `go run .`
Don't use `go run main.go`, because golang can't load x.syso files.
Index ¶
- func InitHInstance(lpModuleName string)
- func MessageLoop()
- func NewModalDialog(idd uintptr, parent win.HWND, dialogConfig *DialogConfig, ...) int
- func RGB(r, g, b uintptr) win.COLORREF
- func SetCurrentDialog(h win.HWND)
- type Bitmap
- type Button
- func (b *Button) Click()
- func (b *Button) GetCheck() int
- func (b *Button) GetImage(t int) uintptr
- func (b *Button) GetNote() (str string)
- func (b *Button) GetState() int
- func (b *Button) SetCheck(state int)
- func (b *Button) SetDontClick(state bool)
- func (b *Button) SetDropDownState(state bool)
- func (b *Button) SetImage(t int, handle uintptr) uintptr
- func (b *Button) SetNote(note string)
- func (b *Button) SetShield(state bool)
- func (b *Button) SetState(highlight bool)
- func (b *Button) SetStyle(style int, redrawn bool)
- func (b *Button) WndProc(msg uint32, wParam, lParam uintptr) uintptr
- type ComboBox
- func (cb *ComboBox) AddString(str string) (idx int, err error)
- func (cb *ComboBox) DeleteString(idx int) (leftCount int, err error)
- func (cb *ComboBox) GetCount() int
- func (cb *ComboBox) GetCurSel() int
- func (cb *ComboBox) GetItemData(index int) (data uintptr, err error)
- func (cb *ComboBox) GetLbText(idx int) (str string)
- func (cb *ComboBox) InsertString(idx int, str string) (err error)
- func (cb *ComboBox) ResetContent() int
- func (cb *ComboBox) SelectString(str string, startIdx int) int
- func (cb *ComboBox) SetCurSel(value int) error
- func (cb *ComboBox) SetItemData(index int, data uintptr) error
- func (cb *ComboBox) WndProc(msg uint32, wParam, lParam uintptr) uintptr
- type Dialog
- type DialogConfig
- type Edit
- type Image
- type ListBox
- func (lb *ListBox) AddString(str string) (idx int, err error)
- func (lb *ListBox) DeleteString(idx int) (leftCount int, err error)
- func (lb *ListBox) GetCount() int
- func (lb *ListBox) GetCurSel() int
- func (lb *ListBox) GetItemData(index int) (data uintptr, err error)
- func (lb *ListBox) GetSel(idx int) bool
- func (lb *ListBox) GetSelectedIndexes() []int
- func (lb *ListBox) GetText(idx int) (str string)
- func (lb *ListBox) InsertString(idx int, str string) (err error)
- func (lb *ListBox) ResetContent() int
- func (lb *ListBox) SelectString(str string, startIdx int) int
- func (lb *ListBox) SetCurSel(idx int) error
- func (lb *ListBox) SetItemData(index int, data uintptr) error
- func (lb *ListBox) SetSel(idx int, sel bool) error
- func (lb *ListBox) WndProc(msg uint32, wParam, lParam uintptr) uintptr
- type ModalDialogCallBack
- type ProgressBar
- func (pb *ProgressBar) DeltaPos(delta int) int
- func (pb *ProgressBar) GetBarColor() int
- func (pb *ProgressBar) GetBkColor() int
- func (pb *ProgressBar) GetPos() int
- func (pb *ProgressBar) GetRange() (low int, high int)
- func (pb *ProgressBar) GetState() int
- func (pb *ProgressBar) GetStep() int
- func (pb *ProgressBar) SetBarColor(color int) int
- func (pb *ProgressBar) SetBkColor(color int) int
- func (pb *ProgressBar) SetMarquee(enable bool, time int)
- func (pb *ProgressBar) SetPit() int
- func (pb *ProgressBar) SetPos(pos int) int
- func (pb *ProgressBar) SetRange(low, high int) int
- func (pb *ProgressBar) SetRange32(low, high int) int
- func (pb *ProgressBar) SetState(state int) int
- func (pb *ProgressBar) SetStep(step int) int
- type Rectangle
- type Size
- type Static
- type TabControl
- type TrackBar
- func (tb *TrackBar) ClearSel(redraw bool)
- func (tb *TrackBar) ClearTics(redraw bool)
- func (tb *TrackBar) GetBuddy(isLeftOrTop bool) win.HWND
- func (tb *TrackBar) GetChannelRect() win.RECT
- func (tb *TrackBar) GetLineSize() int
- func (tb *TrackBar) GetNumTics() int
- func (tb *TrackBar) GetPageSize() int
- func (tb *TrackBar) GetPos() int
- func (tb *TrackBar) GetRangeMax() int
- func (tb *TrackBar) GetRangeMin() int
- func (tb *TrackBar) GetSelEnd() int
- func (tb *TrackBar) GetSelStart() int
- func (tb *TrackBar) GetThumbLength() int
- func (tb *TrackBar) GetThumbRect() win.RECT
- func (tb *TrackBar) GetTic(idx int) int
- func (tb *TrackBar) GetTicPos(idx int) int
- func (tb *TrackBar) GetTooltips() win.HWND
- func (tb *TrackBar) SetBuddy(isLeftOrTop bool, hWnd win.HWND) win.HWND
- func (tb *TrackBar) SetLineSize(size int) int
- func (tb *TrackBar) SetPageSize(newSize int) int
- func (tb *TrackBar) SetPos(redraw bool, newPos int)
- func (tb *TrackBar) SetPosNotify(newPos int)
- func (tb *TrackBar) SetRange(redraw bool, min, max uint16)
- func (tb *TrackBar) SetRangeMax(redraw bool, max int)
- func (tb *TrackBar) SetRangeMin(redraw bool, min int)
- func (tb *TrackBar) SetSel(redraw bool, start, end uint16)
- func (tb *TrackBar) SetSelEnd(redraw bool, end int)
- func (tb *TrackBar) SetSelStart(redraw bool, start int)
- func (tb *TrackBar) SetThumbLength(length int)
- func (tb *TrackBar) SetTic(position int) bool
- func (tb *TrackBar) SetTicFreq(frequency int)
- func (tb *TrackBar) SetTipSide(flag int) int
- func (tb *TrackBar) SetTooltips(hWnd win.HWND)
- func (tb *TrackBar) SetUnicodeFormat(unicode int) int
- func (tb *TrackBar) WndProc(msg uint32, wParam, lParam uintptr) uintptr
- type Widget
- type WindowBase
- func (w *WindowBase) AsWindowBase() *WindowBase
- func (w *WindowBase) BoundsPixels() Rectangle
- func (w *WindowBase) Close()
- func (w *WindowBase) GetWindowRect() win.RECT
- func (w *WindowBase) GetWindowText() string
- func (w *WindowBase) Handle() win.HWND
- func (w *WindowBase) Hide()
- func (w *WindowBase) Init(hwnd win.HWND, idd uintptr)
- func (w *WindowBase) IsEnabled() bool
- func (w *WindowBase) IsVisible() bool
- func (w *WindowBase) SendMessage(msg uint32, wParam, lParam uintptr) uintptr
- func (w *WindowBase) SetBounds(value Rectangle)
- func (w *WindowBase) SetDisabled(disable bool)
- func (w *WindowBase) SetEnabled(b bool)
- func (w *WindowBase) SetFocus()
- func (w *WindowBase) SetIcon(iconType int, icon uintptr, loadIcon bool)
- func (w *WindowBase) SetText(str string)
- func (w *WindowBase) SetVisible(value bool)
- func (w *WindowBase) SetWindowText(title string)
- func (w *WindowBase) Show()
- func (w *WindowBase) ShowFullScreen()
- func (w *WindowBase) ShowMaximized()
- func (w *WindowBase) ShowMinimized()
- func (w *WindowBase) ShowNormal()
- func (w *WindowBase) Text() string
- func (w *WindowBase) WndProc(msg uint32, wParam, lParam uintptr) uintptr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitHInstance ¶
func InitHInstance(lpModuleName string)
InitHInstance init hInstance,used by Dialog APIs.
func NewModalDialog ¶
func NewModalDialog(idd uintptr, parent win.HWND, dialogConfig *DialogConfig, cb ModalDialogCallBack) int
NewModalDialog create a new modal Dialog.
func SetCurrentDialog ¶
SetCurrentDialog make sure Message Loop could process dialog msg correct,such as Tabstop msg. This is a optional method.
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap struct
func NewBitmapFromFile ¶
NewBitmapFromFile create a new Bitmap from file. Could use jpg file :)
func NewBitmapFromResource ¶
NewBitmapFromResource create a new Bitmap from resource.
func NewBitmapFromResourceId ¶
NewBitmapFromResourceId create a new Bitmap from resource ID.
type Button ¶
type Button struct { WindowBase OnClicked func() OnDoubleClicked func() }
Button a widget for Dialog. base of all button type.
func BindNewButton ¶
BindNewButton create a new Button and bind to target dlg.
func (*Button) Click ¶
func (b *Button) Click()
Click simulates the user clicking a button. This message causes the button to receive the WM_LBUTTONDOWN and WM_LBUTTONUP messages, and the button's parent window to receive a BN_CLICKED notification code.
func (*Button) GetCheck ¶
GetCheck gets the check state of a radio button or check box.
checked return 1, unchecked return 0
if Button has BS_3STATE or BS_AUTO3STATE style, may be return 2
BST_CHECKED 1
BST_INDETERMINATE 2
BST_UNCHECKED 0
func (*Button) GetImage ¶
GetImage retrieves a handle to the image (icon or bitmap) associated with the button. t is the type of image to associate with the button. This parameter can be one of the following values: - IMAGE_BITMAP - IMAGE_ICON
The return value is a handle to the image, if any; otherwise, it is NULL.
func (*Button) GetNote ¶
GetNote gets the text of the note associated with a command link button. CommandLink button
func (*Button) GetState ¶
GetState retrieves the state of a button or check box.
The return value specifies the current state of the button. It is a combination of the following values.
Return code and description:
BST_CHECKED The button is checked.
BST_DROPDOWNPUSHED Windows Vista. The button is in the drop-down state. Applies only if the button has the TBSTYLE_DROPDOWN style.
BST_FOCUS The button has the keyboard focus.
BST_HOT The button is hot; that is, the mouse is hovering over it.
BST_INDETERMINATE The state of the button is indeterminate. Applies only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_PUSHED The button is being shown in the pushed state.
BST_UNCHECKED No special state. Equivalent to zero.
func (*Button) SetCheck ¶
SetCheck Sets the check state of a radio button or check box, state is the check state. This parameter can be one of the following values.
Value Meaning: BST_CHECKED 1 Sets the button state to checked.
BST_INDETERMINATE 2 Sets the button state to grayed, indicating an indeterminate state. Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_UNCHECKED 0 Sets the button state to cleared.
func (*Button) SetDontClick ¶
SetDontClick sets a flag on a radio button that controls the generation of BN_CLICKED messages when the button receives focus. notice: WINVER >= 0x0600
func (*Button) SetDropDownState ¶
SetDropDownState sets the drop down state for a button with style TBSTYLE_DROPDOWN. state is a BOOL that is TRUE for state of BST_DROPDOWNPUSHED, or FALSE otherwise.
func (*Button) SetImage ¶
SetImage associates a new image (icon or bitmap) with the button. t is the type of image to associate with the button. This parameter can be one of the following values: - IMAGE_BITMAP - IMAGE_ICON
handle is a handle (HICON or HBITMAP) to the image to associate with the button.
The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL.
func (*Button) SetShield ¶
SetShield sets the elevation required state for a specified button or command link to display an elevated icon. state is a BOOL that is TRUE to draw an elevated icon, or FALSE otherwise.
func (*Button) SetState ¶
SetState sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it. Highlighting affects only the appearance of a button. It has no effect on the check state of a radio button or check box.
A button is automatically highlighted when the user positions the cursor over it and presses and holds the left mouse button. The highlighting is removed when the user releases the mouse button.
func (*Button) SetStyle ¶
SetStyle sets the style of a button. The button style can be a combination of button styles. For a table of button styles,
Constant Description:
BS_3STATE Creates a button that is the same as a check box, except that the box can be grayed as well as checked or cleared. Use the grayed state to show that the state of the check box is not determined.
BS_AUTO3STATE Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, indeterminate, and cleared.
BS_AUTOCHECKBOX Creates a button that is the same as a check box, except that the check state automatically toggles between checked and cleared each time the user selects the check box.
BS_AUTORADIOBUTTON Creates a button that is the same as a radio button, except that when the user selects it, the system automatically sets the button's check state to checked and automatically sets the check state for all other buttons in the same group to cleared.
BS_BITMAP Specifies that the button displays a bitmap. See the Remarks section for its interaction with BS_ICON.
BS_BOTTOM Places text at the bottom of the button rectangle.
BS_CENTER Centers text horizontally in the button rectangle.
BS_CHECKBOX Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).
BS_COMMANDLINK Creates a command link button that behaves like a BS_PUSHBUTTON style button, but the command link button has a green arrow on the left pointing to the button text. A caption for the button text can be set by sending the BCM_SETNOTE message to the button.
BS_DEFCOMMANDLINK Creates a command link button that behaves like a BS_PUSHBUTTON style button. If the button is in a dialog box, the user can select the command link button by pressing the ENTER key, even when the command link button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.
BS_DEFPUSHBUTTON Creates a push button that behaves like a BS_PUSHBUTTON style button, but has a distinct appearance. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.
BS_DEFSPLITBUTTON Creates a split button that behaves like a BS_PUSHBUTTON style button, but also has a distinctive appearance. If the split button is in a dialog box, the user can select the split button by pressing the ENTER key, even when the split button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.
BS_GROUPBOX Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper left corner.
BS_ICON Specifies that the button displays an icon. See the Remarks section for its interaction with BS_BITMAP.
BS_FLAT Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image.
BS_LEFT Left-justifies the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left justified on the right side of the check box or radio button.
BS_LEFTTEXT Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.
BS_MULTILINE Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.
BS_NOTIFY Enables a button to send BN_KILLFOCUS and BN_SETFOCUS notification codes to its parent window.
Note that buttons send the BN_CLICKED notification code regardless of whether it has this style. To get BN_DBLCLK notification codes, the button must have the BS_RADIOBUTTON or BS_OWNERDRAW style.
BS_OWNERDRAW Creates an owner-drawn button. The owner window receives a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.
BS_PUSHBUTTON Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.
BS_PUSHLIKE Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.
BS_RADIOBUTTON Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.
BS_RIGHT Right-justifies text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right justified on the right side of the check box or radio button.
BS_RIGHTBUTTON Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.
BS_SPLITBUTTON Creates a split button. A split button has a drop down arrow.
BS_TEXT Specifies that the button displays text.
BS_TOP Places text at the top of the button rectangle.
BS_TYPEMASK Do not use this style. A composite style bit that results from using the OR operator on BS_* style bits. It can be used to mask out valid BS_* bits from a given bitmask. Note that this is out of date and does not correctly include all valid styles. Thus, you should not use this style.
BS_USERBUTTON Obsolete, but provided for compatibility with 16-bit versions of Windows. Applications should use BS_OWNERDRAW instead.
BS_VCENTER Places text in the middle (vertically) of the button rectangle.
https://docs.microsoft.com/zh-cn/windows/win32/controls/button-styles
type ComboBox ¶
type ComboBox struct { WindowBase // OnSelChange OnSelChange func() }
ComboBox a ComboBox widget for Dialog.
func BindNewComboBox ¶
BindNewComboBox create a new ComboBox and bind to target dlg.
func NewComboBox ¶
NewComboBox create a new ComboBox,need bind to Dialog before use.
func (*ComboBox) AddString ¶
AddString adds a string to the list box of a combo box. If the combo box does not have the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted. The return value idx is the zero-based index to the string in the list box of the combo box.
func (*ComboBox) DeleteString ¶
DeleteString deletes a string in the list box of a combo box. The return value leftCount is a count of the strings remaining in the list
func (*ComboBox) GetItemData ¶
GetItemData sends a CB_GETITEMDATA message to a combo box to retrieve the application-supplied value associated with the specified item in the combo box.
func (*ComboBox) InsertString ¶
InsertString Inserts a string or item data into the list of a combo box. Unlike the CB_ADDSTRING message, the CB_INSERTSTRING message does not cause a list with the CBS_SORT style to be sorted.
func (*ComboBox) ResetContent ¶
ResetContent removes all items from the list box and edit control of a combo box.
func (*ComboBox) SelectString ¶
SelectString Searches the list of a combo box for an item that begins with the characters in a specified string. If a matching item is found, it is selected and copied to the edit control. If has error or not find,return -1
func (*ComboBox) SetItemData ¶
SetItemData sends a CB_SETITEMDATA message to set the value associated with the specified item in a combo box.
type Dialog ¶
type Dialog struct { WindowBase // if return true,will eat message. OnClose func() bool OnDestroy func() // contains filtered or unexported fields }
Dialog is main windows struct.
func (*Dialog) BindWidgets ¶
BindWidgets bind dialog items.
type DialogConfig ¶
DialogConfig TODO.
type Edit ¶
type Edit struct { WindowBase OnChanged func() }
Edit a widget for Dialog.
func BindNewEdit ¶
BindNewEdit create a new Edit and bind to dlg.
func (*Edit) ReplaceSelectedText ¶
ReplaceSelectedText replace Text.
func (*Edit) SetTextSelection ¶
SetTextSelection set Edit selection
func (*Edit) TextSelection ¶
TextSelection get Edit selection.
type Image ¶
type Image struct { WindowBase // OnClicked must set appearance Notify to true before use. OnClicked func() }
Image a static image widget for Dialog.
func BindNewImage ¶
BindNewStatic create a new Image and bind to target dlg.
func (*Image) LoadBitmap ¶
LoadBitmap show Bitmap on window. Don't forget to set the type to Bitmap
type ListBox ¶
type ListBox struct { WindowBase // TOxDO: notify method OnDoubleClick func() OnSelChange func() }
ListBox a ListBox widget for Dialog.
func BindNewListBox ¶
BindNewListBox create a new ListBox and bind to target dlg.
func NewListBox ¶
NewListBox create a new ListBox,need bind to Dialog before use.
func (*ListBox) AddString ¶
AddString Adds a string to a list box. If the list box does not have the LBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list and the list is sorted.
func (*ListBox) DeleteString ¶
DeleteString deletes a string in a list box. The return value leftCount is a count of the strings remaining in the list
func (*ListBox) GetCurSel ¶
GetCurSel gets the index of the currently selected item, if any, in a single-selection list box.
If there is no selection, the return value is -1.
func (*ListBox) GetItemData ¶
GetItemData gets the application-defined value associated with the specified list box item.
func (*ListBox) GetSel ¶
GetSel gets the selection state of an item. If selected , return true;otherwise return false
func (*ListBox) GetSelectedIndexes ¶
GetSelectedIndexes gets the current selected items index. The return value is the array of index selected. If the list box is a single-selection list box, the return value is nil.
func (*ListBox) InsertString ¶
InsertString inserts a string or item data into a list box. Unlike the LB_ADDSTRING message, the LB_INSERTSTRING message does not cause a list with the LBS_SORT style to be sorted.
func (*ListBox) ResetContent ¶
ResetContent removes all items from a list box.
func (*ListBox) SelectString ¶
SelectString searches a list box for an item that begins with the characters in a specified string. If a matching item is found, the item is selected.
func (*ListBox) SetCurSel ¶
SetCurSel selects a string and scrolls it into view, if necessary. When the new string is selected, the list box removes the highlight from the previously selected string. Use this message only with single-selection list boxes. You cannot use it to set or remove a selection in a multiple-selection list box.
func (*ListBox) SetItemData ¶
SetItemData sets a value associated with the specified item in a list box.
func (*ListBox) SetSel ¶
SetSel selects an item in a multiple-selection list box and, if necessary, scrolls the item into view. Use this message only with multiple-selection list boxes.
If idx parameter is -1, the selection is added to or removed from all items, depending on the value of wParam, and no scrolling occurs.
type ModalDialogCallBack ¶
type ModalDialogCallBack func(dlg *Dialog)
ModalDialogCallBack is modal dialog callback
type ProgressBar ¶
type ProgressBar struct {
WindowBase
}
ProgressBar a widget for Dialog. Progress Bar
func BindNewProgressBar ¶
func BindNewProgressBar(idd uintptr, dlg *Dialog) (*ProgressBar, error)
BindNewProgressBar create a new ProgressBar and bind to target dlg.
func NewProgressBar ¶
func NewProgressBar(idd uintptr) *ProgressBar
NewProgressBar create a new ProgressBar,need bind to Dialog before use.
func (*ProgressBar) DeltaPos ¶
func (pb *ProgressBar) DeltaPos(delta int) int
DeltaPos Advances the current position of a progress bar by a specified increment and redraws the bar to reflect the new position.
Returns the previous position.
If the increment results in a value outside the range of the control, the position is set to the nearest boundary.
The behavior of this message is undefined if it is sent to a control that has the PBS_MARQUEE style.
func (*ProgressBar) GetBarColor ¶
func (pb *ProgressBar) GetBarColor() int
GetBarColor Gets the color of the progress bar.
Returns the color of the progress bar.
This is the color set by the PBM_SETBARCOLOR message. The default value is CLR_DEFAULT, which is defined in commctrl.h.
This function only affects the classic mode, not any visual style.
func (*ProgressBar) GetBkColor ¶ added in v0.0.4
func (pb *ProgressBar) GetBkColor() int
GetBkColor Gets the background color of the progress bar.
Returns the background color of the progress bar.
This is the color set by the PBM_SETBKCOLOR message. The default value is CLR_DEFAULT, which is defined in commctrl.h.
This function only affects the classic mode, not any visual style.
func (*ProgressBar) GetPos ¶ added in v0.0.4
func (pb *ProgressBar) GetPos() int
GetPos Retrieves the current position of the progress bar.
Returns a UINT value that represents the current position of the progress bar.
func (*ProgressBar) GetRange ¶ added in v0.0.4
func (pb *ProgressBar) GetRange() (low int, high int)
GetRange Retrieves information about the current high and low limits of a given progress bar control.
func (*ProgressBar) GetState ¶ added in v0.0.4
func (pb *ProgressBar) GetState() int
GetState Gets the state of the progress bar.
Returns the current state of the progress bar. One of the following values.
Return code Description PBST_NORMAL In progress. PBST_ERROR Error. PBST_PAUSED Paused.
func (*ProgressBar) GetStep ¶ added in v0.0.4
func (pb *ProgressBar) GetStep() int
GetStep Retrieves the step increment from a progress bar. The step increment is the amount by which the progress bar increases its current position whenever it receives a PBM_STEPIT message. By default, the step increment is set to 10.
Returns the current step increment.
func (*ProgressBar) SetBarColor ¶ added in v0.0.4
func (pb *ProgressBar) SetBarColor(color int) int
SetBarColor Sets the color of the progress indicator bar in the progress bar control.
The COLORREF value that specifies the new progress indicator bar color. Specifying the CLR_DEFAULT value causes the progress bar to use its default progress indicator bar color.
Returns the previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color is the default color.
func (*ProgressBar) SetBkColor ¶ added in v0.0.4
func (pb *ProgressBar) SetBkColor(color int) int
SetBkColor Sets the background color in the progress bar.
COLORREF value that specifies the new background color. Specify the CLR_DEFAULT value to cause the progress bar to use its default background color.
Returns the previous background color, or CLR_DEFAULT if the background color is the default color.
Remarks When visual styles are enabled, this message has no effect.
func (*ProgressBar) SetMarquee ¶ added in v0.0.4
func (pb *ProgressBar) SetMarquee(enable bool, time int)
SetMarquee Sets the progress bar to marquee mode. This causes the progress bar to move like a marquee.
enable,indicates whether to turn the marquee mode on or off.
Time, in milliseconds, between marquee animation updates. If this parameter is zero, the marquee animation is updated every 30 milliseconds.
Remarks Use this message when you do not know the amount of progress toward completion but wish to indicate that progress is being made. Send the PBM_SETMARQUEE message to start or stop the animation.
func (*ProgressBar) SetPit ¶ added in v0.0.4
func (pb *ProgressBar) SetPit() int
SetPit Advances the current position for a progress bar by the step increment and redraws the bar to reflect the new position. An application sets the step increment by sending the PBM_SETSTEP message.
Returns the previous position.
When the position exceeds the maximum range value, this message resets the current position so that the progress indicator starts over again from the beginning.
func (*ProgressBar) SetPos ¶ added in v0.0.4
func (pb *ProgressBar) SetPos(pos int) int
SetPos Sets the current position for a progress bar and redraws the bar to reflect the new position.
pos:Signed integer that becomes the new position.
Returns the previous position.
Remarks If pos is outside the range of the control, the position is set to the closest boundary. Do not send this message to a control that has the PBS_MARQUEE style.
func (*ProgressBar) SetRange ¶ added in v0.0.4
func (pb *ProgressBar) SetRange(low, high int) int
SetRange Sets the minimum and maximum values for a progress bar and redraws the bar to reflect the new range.
The low specifies the minimum range value, and the high specifies the maximum range value. The minimum range value must not be negative. By default, the minimum value is zero. The maximum range value must be greater than the minimum range value. By default, the maximum range value is 100.
Returns the previous range values if successful, or zero otherwise. The LOWORD specifies the previous minimum value, and the HIWORD specifies the previous maximum value. Remarks If you do not set the range values, the system sets the minimum value to 0 and the maximum value to 100. Because this message expresses the range as a 16-bit unsigned integer, it can extend from 0 to 65,535. The minimum value in the range can be from 0 to 65,535. Likewise, the maximum value can be from 0 to 65,535. To set a larger range, call PBM_SETRANGE32.
func (*ProgressBar) SetRange32 ¶ added in v0.0.4
func (pb *ProgressBar) SetRange32(low, high int) int
SetRange32 Sets the minimum and maximum values for a progress bar to 32-bit values, and redraws the bar to reflect the new range.
func (*ProgressBar) SetState ¶ added in v0.0.4
func (pb *ProgressBar) SetState(state int) int
SetState Sets the state of the progress bar.
State of the progress bar that is being set. One of the following values. Value Meaning PBST_NORMAL In progress. PBST_ERROR Error. PBST_PAUSED Paused.
Returns the previous state.
func (*ProgressBar) SetStep ¶ added in v0.0.4
func (pb *ProgressBar) SetStep(step int) int
SetStep Specifies the step increment for a progress bar. The step increment is the amount by which the progress bar increases its current position whenever it receives a PBM_STEPIT message. By default, the step increment is set to 10.
step: New step increment.
Returns the previous step increment.
type Static ¶
type Static struct { WindowBase // Color must set before Dialog init,Widget should bind use DialogConfig. Color win.COLORREF //BkMode must set same as Color BkMode int32 // OnClicked must set appearance Notify to true before use. OnClicked func() }
Static a static label widget for Dialog.
func BindNewStatic ¶
BindNewStatic create a new Static and bind to target dlg.
type TabControl ¶ added in v0.0.4
type TabControl struct { WindowBase // contains filtered or unexported fields }
TabControl a widget for Dialog. Tab Control
func BindTabControl ¶ added in v0.0.4
func BindTabControl(idd uintptr, dlg *Dialog) (*TabControl, error)
BindTabControl create a new TabControl and bind to target dlg.
func NewTabControl ¶ added in v0.0.4
func NewTabControl(idd uintptr) *TabControl
NewTabControl create a new TabControl, need bind to Dialog before use.
func (*TabControl) InsertItemText ¶ added in v0.0.6
func (tc *TabControl) InsertItemText(text string, dlg *Dialog)
TODO: direct newdialog InsertItemText insert tab with text
type TrackBar ¶
type TrackBar struct {
WindowBase
}
TrackBar a widget for Dialog. TrackBar
func BindNewTrackBar ¶
BindNewTrackBar create a new TrackBar and bind to target dlg.
func NewTrackBar ¶
NewTrackBar create a new TrackBar,need bind to Dialog before use.
func (*TrackBar) ClearSel ¶
ClearSel clears the current selection range in a trackbar. redraw if this parameter is TRUE, the trackbar is redrawn after the selection is cleared.
func (*TrackBar) ClearTics ¶
ClearTics removes the current tick marks from a trackbar. This message does not remove the first and last tick marks, which are created automatically by the trackbar. redraw if this parameter is TRUE, the trackbar is redrawn after the selection is cleared.
func (*TrackBar) GetBuddy ¶
GetBuddy retrieves the handle to a trackbar control buddy window at a given location. The specified location is relative to the control's orientation (horizontal or vertical). isLeftOrTop indicating which buddy window handle will be retrieved, by relative location. This value can be one of the following: - TRUE - Retrieves the handle to the buddy to the left of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy above the trackbar. - FALSE - Retrieves the handle to the buddy to the right of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy below the trackbar.
func (*TrackBar) GetChannelRect ¶
Retrieves the size and position of the bounding rectangle for a trackbar's channel. (The channel is the area over which the slider moves. It contains the highlight when a range is selected.) Return value is a RECT structure. This structure with the channel's bounding rectangle, in client coordinates of the trackbar's window.
func (*TrackBar) GetLineSize ¶
GetLineSize retrieves the number of logical positions the trackbar's slider moves in response to keyboard input from the arrow keys, such as the or keys. The logical positions are the integer increments in the trackbar's range of minimum to maximum slider positions. Returns a 32-bit value that specifies the line size for the trackbar. The default setting for the line size is 1. The trackbar also sends a WM_HSCROLL or WM_VSCROLL message with the TB_LINEUP and TB_LINEDOWN notification codes to its parent window when the user presses the arrow keys.
func (*TrackBar) GetNumTics ¶
GetNumTics retrieves the number of tick marks in a trackbar. If no tick flag is set, it returns 2 for the beginning and ending ticks. If TBS_NOTICKS is set, it returns zero. Otherwise, it takes the difference between the range minimum and maximum, divides by the tick frequency, and adds 2.
The TBM_GETNUMTICS message counts all of the tick marks, including the first and last tick marks created by the trackbar.
func (*TrackBar) GetPageSize ¶
GetPageSize retrieves the number of logical positions the trackbar's slider moves in response to keyboard input, such as the or keys, or mouse input, such as clicks in the trackbar's channel. The logical positions are the integer increments in the trackbar's range of minimum to maximum slider positions.
Returns a 32-bit value that specifies the page size for the trackbar. Remarks: The trackbar also sends a WM_HSCROLL or WM_VSCROLL message with the TB_PAGEUP and TB_PAGEDOWN notification codes to its parent window when it receives keyboard or mouse input that scrolls the page.
func (*TrackBar) GetPos ¶
GetPos retrieves the current logical position of the slider in a trackbar. The logical positions are the integer values in the trackbar's range of minimum to maximum slider positions. Returns a 32-bit value that specifies the current logical position of the trackbar's slider.
func (*TrackBar) GetRangeMax ¶
GetRangeMax retrieves the maximum position for the slider in a trackbar. Returns a 32-bit value that specifies the maximum position in the trackbar's range of minimum to maximum slider positions.
func (*TrackBar) GetRangeMin ¶
GetRangeMin retrieves the minimum position for the slider in a trackbar. Returns a 32-bit value that specifies the minimum position in the trackbar's range of minimum to maximum slider positions
func (*TrackBar) GetSelEnd ¶
GetSelEnd retrieves the ending position of the current selection range in a trackbar. Returns a 32-bit value that specifies the ending position of the current selection range. A trackbar can have a selection range only if you specified the TBS_ENABLESELRANGE style when you created it.
func (*TrackBar) GetSelStart ¶
GetSelStart retrieves the starting position of the current selection range in a trackbar. Returns a 32-bit value that specifies the starting position of the current selection range. A trackbar can have a selection range only if you specified the TBS_ENABLESELRANGE style when you created it.
func (*TrackBar) GetThumbLength ¶
GetThumbLength retrieves the length of the slider in a trackbar. Returns the length, in pixels, of the slider.
func (*TrackBar) GetThumbRect ¶
GetThumbRect retrieves the size and position of the bounding rectangle for the slider in a trackbar.
func (*TrackBar) GetTic ¶
GetTic retrieves the logical position of a tick mark in a trackbar. The logical position can be any of the integer values in the trackbar's range of minimum to maximum slider positions. idx is a zero-based index identifying a tick mark. Valid indexes are in the range from zero to two less than the tick count returned by the TBM_GETNUMTICS message. Returns the logical position of the specified tick mark, or -1 if wParam does not specify a valid index.
func (*TrackBar) GetTicPos ¶
GetTicPos retrieves the current physical position of a tick mark in a trackbar. idx is a zero-based index identifying a tick mark. The positions of the first and last tick marks are not directly available via this message. Returns the distance, in client coordinates, from the left or top of the trackbar's client area to the specified tick mark. The return value is the x-coordinate of the tick mark for a horizontal trackbar or the y-coordinate for a vertical trackbar. If wParam is not a valid index, the return value is -1. Remarks Because the first and last tick marks are not available through this message, valid indexes are offset from their tick position on the trackbar. If the difference between TBM_GETRANGEMIN and TBM_GETRANGEMAX is less than two, then there is no valid index and this message will fail. The following illustrates the relation between the ticks on a trackbar, the ticks available through this message, and their zero-based indexes. 0 1 2 3 4 5 6 7 8 9 // Tick positions seen on the trackbar. 1 2 3 4 5 6 7 8 // Tick positions whose position can be identified. 0 1 2 3 4 5 6 7 // Index numbers for the identifiable positions.
func (*TrackBar) GetTooltips ¶
GetTooltips retrieves the handle to the tooltip control assigned to the trackbar, if any. Returns the handle to the tooltip control assigned to the trackbar, or NULL if tooltips are not in use. If the trackbar control does not use the TBS_TOOLTIPS style, the return value is NULL.
func (*TrackBar) SetBuddy ¶
SetBuddy assigns a window as the buddy window for a trackbar control. Trackbar buddy windows are automatically displayed in a location relative to the control's orientation (horizontal or vertical). isLeftOrTop indicating which buddy window handle will be retrieved, by relative location. This value can be one of the following: - TRUE - Retrieves the handle to the buddy to the left of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy above the trackbar. - FALSE - Retrieves the handle to the buddy to the right of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy below the trackbar.
hWnd is a Handle to the window that will be set as the trackbar control's buddy. Returns the handle to the window that was previously assigned to the control at that location.
func (*TrackBar) SetLineSize ¶
SetLineSize sets the number of logical positions the trackbar's slider moves in response to keyboard input from the arrow keys, such as the or keys. The logical positions are the integer increments in the trackbar's range of minimum to maximum slider positions. size is new line size. Returns a 32-bit value that specifies the previous line size.
Remarks The default setting for the line size is 1.
The trackbar also sends a WM_HSCROLL or WM_VSCROLL message with the TB_LINEUP and TB_LINEDOWN notification codes to its parent window when the user presses the arrow keys.
func (*TrackBar) SetPageSize ¶
SetPageSize sets the number of logical positions the trackbar's slider moves in response to keyboard input, such as the or keys, or mouse input, such as clicks in the trackbar's channel. The logical positions are the integer increments in the trackbar's range of minimum to maximum slider positions. Returns a 32-bit value that specifies the previous page size.
Remarks The trackbar also sends a WM_HSCROLL or WM_VSCROLL message with the TB_PAGEUP and TB_PAGEDOWN notification codes to its parent window when it receives keyboard or mouse input that scrolls the page.
func (*TrackBar) SetPos ¶
SetPos sets the current logical position of the slider in a trackbar.
newPose is new logical position of the slider. Valid logical positions are the integer values in the trackbar's range of minimum to maximum slider positions. If this value is outside the control's maximum and minimum range, the position is set to the maximum or minimum value.
func (*TrackBar) SetPosNotify ¶
SetPosNotify sets the current logical position of the slider in a trackbar. newPost New logical position of the slider. Valid logical positions are the integer values in the trackbar's range of minimum to maximum slider positions. If this value is outside the control's maximum and minimum range, the position is set to the maximum or minimum value.
Remarks Calling TBM_SETPOSNOTIFY will set the trackbar slider location like TBM_SETPOS would, but it will also cause the trackbar to notify its parent of a move via a WM_HSCROLL or WM_VSCROLL message.
func (*TrackBar) SetRange ¶
SetRange sets the range of minimum and maximum logical positions for the slider in a trackbar.
Remarks If the current slider position is outside the new range, the TBM_SETRANGE message sets the slider position to the new maximum or minimum value.
Because this message takes two 16-bit unsigned integer values, the maximum range that this message can specify is from 0 to 65,535. To specify larger range values, use the TBM_SETRANGEMIN and TBM_SETRANGEMAX messages.
func (*TrackBar) SetRangeMax ¶
SetRangeMax Sets the maximum logical position for the slider in a trackbar. max Maximum position for the slider.
Remarks If the current slider position is greater than the new maximum, the TBM_SETRANGEMAX message sets the slider position to the new maximum value.
func (*TrackBar) SetRangeMin ¶
SetRangeMin Sets the minimum logical position for the slider in a trackbar. min Minimum position for the slider.
Remarks If the current slider position is less than the new minimum, the TBM_SETRANGEMIN message sets the slider position to the new minimum value.
func (*TrackBar) SetSel ¶
SetSel Sets the starting and ending positions for the available selection range in a trackbar.
func (*TrackBar) SetSelEnd ¶
SetSelEnd Sets the ending logical position of the current selection range in a trackbar. This message is ignored if the trackbar does not have the TBS_ENABLESELRANGE style. end Ending logical position of the selection range.
func (*TrackBar) SetSelStart ¶
SetSelStart Sets the starting logical position of the current selection range in a trackbar. This message is ignored if the trackbar does not have the TBS_ENABLESELRANGE style. start Starting position of the selection range.
func (*TrackBar) SetThumbLength ¶
SetThumbLength sets the length of the slider in a trackbar. This message is ignored if the trackbar does not have the TBS_FIXEDLENGTH style.\ length, in pixels, of the slider.
func (*TrackBar) SetTic ¶
SetTic sets a tick mark in a trackbar at the specified logical position. position is position of the tick mark. This parameter can be any of the integer values in the trackbar's range of minimum to maximum slider positions. Returns TRUE if the tick mark is set, or FALSE otherwise.
func (*TrackBar) SetTicFreq ¶
SetTicFreq Sets the interval frequency for tick marks in a trackbar. For example, if the frequency is set to two, a tick mark is displayed for every other increment in the trackbar's range. The default setting for the frequency is one; that is, every increment in the range is associated with a tick mark. frequency is frequency of the tick marks. Remarks The trackbar must have the TBS_AUTOTICKS style to use this message.
func (*TrackBar) SetTipSide ¶
SetTipSide positions a tooltip control used by a trackbar control. Trackbar controls that use the TBS_TOOLTIPS style display tooltips. flag representing the location at which to display the tooltip control. This value can be one of the following: TBTS_TOP The tooltip control will be positioned above the trackbar. This flag is for use with horizontal trackbars. TBTS_LEFT The tooltip control will be positioned to the left of the trackbar. This flag is for use with vertical trackbars. TBTS_BOTTOM The tooltip control will be positioned below the trackbar. This flag is for use with horizontal trackbars. TBTS_RIGHT The tooltip control will be positioned to the right of the trackbar. This flag is for use with vertical trackbars.
Returns a value that represents the tooltip control's previous location. The return value equals one of the possible values for flag.
func (*TrackBar) SetTooltips ¶
SetTooltips assigns a tooltip control to a trackbar control. hWnd is a handle to an existing tooltip control. Remarks When a trackbar control is created with the TBS_TOOLTIPS style, it creates a default tooltip control that appears next to the slider, displaying the slider's current position.
func (*TrackBar) SetUnicodeFormat ¶
SetUnicodeFormat sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control.
unicode Determines the character set that is used by the control. If this value is nonzero, the control will use Unicode characters. If this value is zero, the control will use ANSI characters. Return value Returns the previous Unicode format flag for the control.
type Widget ¶
type Widget interface { WndProc(msg uint32, wParam, lParam uintptr) uintptr AsWindowBase() *WindowBase }
Widget inspect dialog item.
type WindowBase ¶
type WindowBase struct { // Subclassing indicate that this window need Subclass, // make sure set this flag before bind to Dialog. Subclassing bool // contains filtered or unexported fields }
WindowBase is an interface that provides operations common to all windows. if need subclass window ,must set Subclassing to true. hwnd,if custom window could set by Init. idd Reource Id. if custom window could set zero by Init
func (*WindowBase) AsWindowBase ¶
func (w *WindowBase) AsWindowBase() *WindowBase
AsWindowBase return a *WindowBase.
func (*WindowBase) BoundsPixels ¶
func (w *WindowBase) BoundsPixels() Rectangle
BoundsPixels returns the outer bounding box Rectangle of the *WindowBase, including decorations. The coordinates are relative to the screen.
func (*WindowBase) GetWindowRect ¶
func (w *WindowBase) GetWindowRect() win.RECT
GetWindowRect get window rect
func (*WindowBase) GetWindowText ¶
func (w *WindowBase) GetWindowText() string
GetWindowText get text.
func (*WindowBase) Init ¶
func (w *WindowBase) Init(hwnd win.HWND, idd uintptr)
Init could init new WindowBase by youself .
func (*WindowBase) IsEnabled ¶
func (w *WindowBase) IsEnabled() bool
IsEnabled check windows is enabled.
func (*WindowBase) IsVisible ¶
func (w *WindowBase) IsVisible() bool
IsVisible check window is visible.
func (*WindowBase) SendMessage ¶
func (w *WindowBase) SendMessage(msg uint32, wParam, lParam uintptr) uintptr
SendMessage sends a message to the window and returns the result.
func (*WindowBase) SetBounds ¶
func (w *WindowBase) SetBounds(value Rectangle)
SetBounds set window rect.
func (*WindowBase) SetDisabled ¶
func (w *WindowBase) SetDisabled(disable bool)
SetDisabled reverse of SetEnabled
func (*WindowBase) SetEnabled ¶
func (w *WindowBase) SetEnabled(b bool)
SetEnabled set window enable status.
func (*WindowBase) SetIcon ¶
func (w *WindowBase) SetIcon(iconType int, icon uintptr, loadIcon bool)
SetIcon set window icon. IconType: 1 - ICON_BIG; 0 - ICON_SMALL Icon: Resource Id or Icon Handle LoadIcon: If Icon is ResourceId then invoke LoadIcon
func (*WindowBase) SetText ¶
func (w *WindowBase) SetText(str string)
SetText alias to SetWindowText
func (*WindowBase) SetVisible ¶
func (w *WindowBase) SetVisible(value bool)
SetVisible set window visible status.
func (*WindowBase) SetWindowText ¶
func (w *WindowBase) SetWindowText(title string)
SetWindowText set text
func (*WindowBase) ShowFullScreen ¶
func (w *WindowBase) ShowFullScreen()
ShowFullScreen ShowFullScreen
func (*WindowBase) ShowMaximized ¶
func (w *WindowBase) ShowMaximized()
ShowMaximized show maximized btn.
func (*WindowBase) ShowMinimized ¶
func (w *WindowBase) ShowMinimized()
ShowMinimized show minimized btn.