summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <an2048@gmail.com>2019-05-01 17:31:54 +0200
committerAlexander Neumann <an2048@gmail.com>2019-05-01 17:31:54 +0200
commit41a835dfa001d5cfe645d0666c63a29bb03a7205 (patch)
tree4015b4a5c3ee1a383c856a53b1b69b92107368e1
parentMerge pull request #497 from zx2c4-forks/jd/tableview (diff)
downloadwireguard-windows-41a835dfa001d5cfe645d0666c63a29bb03a7205.tar.xz
wireguard-windows-41a835dfa001d5cfe645d0666c63a29bb03a7205.zip
Add DoubleBuffering getter and declarative stuff
-rw-r--r--declarative/builder.go4
-rw-r--r--declarative/checkbox.go1
-rw-r--r--declarative/combobox.go1
-rw-r--r--declarative/composite.go1
-rw-r--r--declarative/customwidget.go1
-rw-r--r--declarative/dateedit.go1
-rw-r--r--declarative/datelabel.go1
-rw-r--r--declarative/dialog.go2
-rw-r--r--declarative/gradientcomposite.go1
-rw-r--r--declarative/groupbox.go1
-rw-r--r--declarative/imageview.go1
-rw-r--r--declarative/interfaces.go1
-rw-r--r--declarative/label.go1
-rw-r--r--declarative/lineedit.go1
-rw-r--r--declarative/lineerrorpresenter.go1
-rw-r--r--declarative/linklabel.go1
-rw-r--r--declarative/listbox.go1
-rw-r--r--declarative/mainwindow.go2
-rw-r--r--declarative/numberedit.go1
-rw-r--r--declarative/numberlabel.go1
-rw-r--r--declarative/progressbar.go1
-rw-r--r--declarative/pushbutton.go1
-rw-r--r--declarative/radiobutton.go1
-rw-r--r--declarative/radiobuttongroupbox.go1
-rw-r--r--declarative/scrollview.go1
-rw-r--r--declarative/separator.go1
-rw-r--r--declarative/slider.go1
-rw-r--r--declarative/splitbutton.go1
-rw-r--r--declarative/splitter.go1
-rw-r--r--declarative/tableview.go1
-rw-r--r--declarative/tabpage.go1
-rw-r--r--declarative/tabwidget.go1
-rw-r--r--declarative/textedit.go1
-rw-r--r--declarative/textlabel.go1
-rw-r--r--declarative/toolbar.go1
-rw-r--r--declarative/toolbutton.go1
-rw-r--r--declarative/treeview.go1
-rw-r--r--declarative/webview.go1
-rw-r--r--window.go10
39 files changed, 53 insertions, 0 deletions
diff --git a/declarative/builder.go b/declarative/builder.go
index a0d423a3..da0a7788 100644
--- a/declarative/builder.go
+++ b/declarative/builder.go
@@ -202,6 +202,10 @@ func (b *Builder) InitWidget(d Widget, w walk.Window, customInit func() error) e
w.SizeChanged().Attach(handler)
}
+ if db := b.bool("DoubleBuffering"); db {
+ w.SetDoubleBuffering(true)
+ }
+
if rtl := b.bool("RightToLeftReading"); rtl {
w.SetRightToLeftReading(true)
}
diff --git a/declarative/checkbox.go b/declarative/checkbox.go
index 40c40f6b..5c551c38 100644
--- a/declarative/checkbox.go
+++ b/declarative/checkbox.go
@@ -15,6 +15,7 @@ type CheckBox struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/combobox.go b/declarative/combobox.go
index 473446ef..28694645 100644
--- a/declarative/combobox.go
+++ b/declarative/combobox.go
@@ -19,6 +19,7 @@ type ComboBox struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/composite.go b/declarative/composite.go
index 065f501a..d466b26b 100644
--- a/declarative/composite.go
+++ b/declarative/composite.go
@@ -16,6 +16,7 @@ type Composite struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/customwidget.go b/declarative/customwidget.go
index 44dbb84b..8dd3c5ce 100644
--- a/declarative/customwidget.go
+++ b/declarative/customwidget.go
@@ -23,6 +23,7 @@ type CustomWidget struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/dateedit.go b/declarative/dateedit.go
index 41eb3683..9a933c81 100644
--- a/declarative/dateedit.go
+++ b/declarative/dateedit.go
@@ -19,6 +19,7 @@ type DateEdit struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/datelabel.go b/declarative/datelabel.go
index d2c63ab1..0591fec7 100644
--- a/declarative/datelabel.go
+++ b/declarative/datelabel.go
@@ -15,6 +15,7 @@ type DateLabel struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/dialog.go b/declarative/dialog.go
index f869b773..a42edb3f 100644
--- a/declarative/dialog.go
+++ b/declarative/dialog.go
@@ -15,6 +15,7 @@ type Dialog struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
@@ -77,6 +78,7 @@ func (d Dialog) Create(owner walk.Form) error {
// Window
Background: d.Background,
ContextMenuItems: d.ContextMenuItems,
+ DoubleBuffering: d.DoubleBuffering,
Enabled: d.Enabled,
Font: d.Font,
MaxSize: d.MaxSize,
diff --git a/declarative/gradientcomposite.go b/declarative/gradientcomposite.go
index 70746d7b..7527b20a 100644
--- a/declarative/gradientcomposite.go
+++ b/declarative/gradientcomposite.go
@@ -16,6 +16,7 @@ type GradientComposite struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/groupbox.go b/declarative/groupbox.go
index 9b23ed87..0d60b998 100644
--- a/declarative/groupbox.go
+++ b/declarative/groupbox.go
@@ -15,6 +15,7 @@ type GroupBox struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/imageview.go b/declarative/imageview.go
index 392f2698..8e208824 100644
--- a/declarative/imageview.go
+++ b/declarative/imageview.go
@@ -26,6 +26,7 @@ type ImageView struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/interfaces.go b/declarative/interfaces.go
index 13e4d690..8f300ac7 100644
--- a/declarative/interfaces.go
+++ b/declarative/interfaces.go
@@ -89,6 +89,7 @@ type formInfo struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/label.go b/declarative/label.go
index afb219f5..68d31a24 100644
--- a/declarative/label.go
+++ b/declarative/label.go
@@ -15,6 +15,7 @@ type Label struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/lineedit.go b/declarative/lineedit.go
index 2c59ff6c..d4f52e7f 100644
--- a/declarative/lineedit.go
+++ b/declarative/lineedit.go
@@ -23,6 +23,7 @@ type LineEdit struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/lineerrorpresenter.go b/declarative/lineerrorpresenter.go
index 4f4bc8de..49a5d4f4 100644
--- a/declarative/lineerrorpresenter.go
+++ b/declarative/lineerrorpresenter.go
@@ -15,6 +15,7 @@ type LineErrorPresenter struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/linklabel.go b/declarative/linklabel.go
index 7ba20991..16ad4505 100644
--- a/declarative/linklabel.go
+++ b/declarative/linklabel.go
@@ -15,6 +15,7 @@ type LinkLabel struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/listbox.go b/declarative/listbox.go
index 6e97d8b7..41e9208d 100644
--- a/declarative/listbox.go
+++ b/declarative/listbox.go
@@ -20,6 +20,7 @@ type ListBox struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/mainwindow.go b/declarative/mainwindow.go
index 2731b223..cb967701 100644
--- a/declarative/mainwindow.go
+++ b/declarative/mainwindow.go
@@ -13,6 +13,7 @@ type MainWindow struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
@@ -70,6 +71,7 @@ func (mw MainWindow) Create() error {
// Window
Background: mw.Background,
ContextMenuItems: mw.ContextMenuItems,
+ DoubleBuffering: mw.DoubleBuffering,
Enabled: mw.Enabled,
Font: mw.Font,
MaxSize: mw.MaxSize,
diff --git a/declarative/numberedit.go b/declarative/numberedit.go
index 25461706..c0d8e637 100644
--- a/declarative/numberedit.go
+++ b/declarative/numberedit.go
@@ -15,6 +15,7 @@ type NumberEdit struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/numberlabel.go b/declarative/numberlabel.go
index db5477e9..d3bf2141 100644
--- a/declarative/numberlabel.go
+++ b/declarative/numberlabel.go
@@ -15,6 +15,7 @@ type NumberLabel struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/progressbar.go b/declarative/progressbar.go
index 933ca149..c621ae20 100644
--- a/declarative/progressbar.go
+++ b/declarative/progressbar.go
@@ -15,6 +15,7 @@ type ProgressBar struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/pushbutton.go b/declarative/pushbutton.go
index 2b86c446..1e9e037d 100644
--- a/declarative/pushbutton.go
+++ b/declarative/pushbutton.go
@@ -15,6 +15,7 @@ type PushButton struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/radiobutton.go b/declarative/radiobutton.go
index 5e35a58b..d617fa76 100644
--- a/declarative/radiobutton.go
+++ b/declarative/radiobutton.go
@@ -15,6 +15,7 @@ type RadioButton struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/radiobuttongroupbox.go b/declarative/radiobuttongroupbox.go
index 1df041cf..9bdfa238 100644
--- a/declarative/radiobuttongroupbox.go
+++ b/declarative/radiobuttongroupbox.go
@@ -15,6 +15,7 @@ type RadioButtonGroupBox struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/scrollview.go b/declarative/scrollview.go
index ffb5aa5f..4334ce3c 100644
--- a/declarative/scrollview.go
+++ b/declarative/scrollview.go
@@ -15,6 +15,7 @@ type ScrollView struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/separator.go b/declarative/separator.go
index 976fadc4..3079aa94 100644
--- a/declarative/separator.go
+++ b/declarative/separator.go
@@ -15,6 +15,7 @@ type HSeparator struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/slider.go b/declarative/slider.go
index 35378ef7..4bb9fecc 100644
--- a/declarative/slider.go
+++ b/declarative/slider.go
@@ -15,6 +15,7 @@ type Slider struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/splitbutton.go b/declarative/splitbutton.go
index ca9c07a5..71ae6b4a 100644
--- a/declarative/splitbutton.go
+++ b/declarative/splitbutton.go
@@ -15,6 +15,7 @@ type SplitButton struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/splitter.go b/declarative/splitter.go
index 01b28000..a893f228 100644
--- a/declarative/splitter.go
+++ b/declarative/splitter.go
@@ -15,6 +15,7 @@ type HSplitter struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/tableview.go b/declarative/tableview.go
index 23c836be..27b3ebf1 100644
--- a/declarative/tableview.go
+++ b/declarative/tableview.go
@@ -16,6 +16,7 @@ type TableView struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/tabpage.go b/declarative/tabpage.go
index f00008ef..2d1757bf 100644
--- a/declarative/tabpage.go
+++ b/declarative/tabpage.go
@@ -15,6 +15,7 @@ type TabPage struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/tabwidget.go b/declarative/tabwidget.go
index ac9d89a5..d4d5213f 100644
--- a/declarative/tabwidget.go
+++ b/declarative/tabwidget.go
@@ -15,6 +15,7 @@ type TabWidget struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/textedit.go b/declarative/textedit.go
index 5cdc2989..923a209e 100644
--- a/declarative/textedit.go
+++ b/declarative/textedit.go
@@ -16,6 +16,7 @@ type TextEdit struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/textlabel.go b/declarative/textlabel.go
index ec0b2064..8108ebf6 100644
--- a/declarative/textlabel.go
+++ b/declarative/textlabel.go
@@ -30,6 +30,7 @@ type TextLabel struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/toolbar.go b/declarative/toolbar.go
index 93547626..d996bf35 100644
--- a/declarative/toolbar.go
+++ b/declarative/toolbar.go
@@ -24,6 +24,7 @@ type ToolBar struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/toolbutton.go b/declarative/toolbutton.go
index df1ed915..aa6556ba 100644
--- a/declarative/toolbutton.go
+++ b/declarative/toolbutton.go
@@ -15,6 +15,7 @@ type ToolButton struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/treeview.go b/declarative/treeview.go
index d0b3bc97..1a6ac949 100644
--- a/declarative/treeview.go
+++ b/declarative/treeview.go
@@ -15,6 +15,7 @@ type TreeView struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/declarative/webview.go b/declarative/webview.go
index c9c3b12f..651fa4a5 100644
--- a/declarative/webview.go
+++ b/declarative/webview.go
@@ -15,6 +15,7 @@ type WebView struct {
Background Brush
ContextMenuItems []MenuItem
+ DoubleBuffering bool
Enabled Property
Font Font
MaxSize Size
diff --git a/window.go b/window.go
index b15b79a1..8760d296 100644
--- a/window.go
+++ b/window.go
@@ -86,6 +86,10 @@ type Window interface {
// of.
Disposing() *Event
+ // DoubleBuffering returns whether double buffering of the
+ // drawing is enabled, which may help reduce flicker.
+ DoubleBuffering() bool
+
// DPI returns the current DPI value of the Window.
DPI() int
@@ -774,6 +778,12 @@ func (wb *WindowBase) SetCursor(value Cursor) {
wb.cursor = value
}
+// DoubleBuffering returns whether double buffering of the
+// drawing is enabled, which may help reduce flicker.
+func (wb *WindowBase) DoubleBuffering() bool {
+ return wb.hasExtendedStyleBits(win.WS_EX_COMPOSITED)
+}
+
// SetDoubleBuffering enables or disables double buffering of the
// drawing, which may help reduce flicker.
func (wb *WindowBase) SetDoubleBuffering(enabled bool) error {