aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS/ShiftOSWindow.vb
diff options
context:
space:
mode:
authorAlphaBeta0110 <[email protected]>2015-03-15 11:33:28 +0100
committerAlphaBeta0110 <[email protected]>2015-03-15 11:33:28 +0100
commitbfb1b2199ee039ac76223300548555981f466df2 (patch)
tree387e1fe0739a22d02f79e12063388fcddc9fbe07 /ShiftOS/ShiftOSWindow.vb
parentbcf104ffcf521ad7cdd467be1b6885084f0080b7 (diff)
downloadshiftos-bfb1b2199ee039ac76223300548555981f466df2.tar.gz
shiftos-bfb1b2199ee039ac76223300548555981f466df2.tar.bz2
shiftos-bfb1b2199ee039ac76223300548555981f466df2.zip
.. how did I manage to upload everything but the code
Diffstat (limited to 'ShiftOS/ShiftOSWindow.vb')
-rw-r--r--ShiftOS/ShiftOSWindow.vb189
1 files changed, 189 insertions, 0 deletions
diff --git a/ShiftOS/ShiftOSWindow.vb b/ShiftOS/ShiftOSWindow.vb
new file mode 100644
index 0000000..44560fb
--- /dev/null
+++ b/ShiftOS/ShiftOSWindow.vb
@@ -0,0 +1,189 @@
+Public Class ShiftOSWindow
+ Public Property RolledUp As Boolean = False
+ Public Property Resizable As Boolean = True
+ Public Shadows Property MinimumSize As Size = New Size(0, 0)
+ Private _heightBeforeRollup As Integer
+
+ ' Window title changed
+ Private Sub Me_TextChanged(sender As Object, e As EventArgs) Handles MyBase.TextChanged
+ lbtitletext.Text = Text
+ End Sub
+#Region "Close Button"
+ Private Sub closebutton_Click(sender As Object, e As EventArgs) Handles closebutton.Click
+ Me.Close()
+ End Sub
+
+ Private Sub closebutton_MouseEnter(sender As Object, e As EventArgs) Handles closebutton.MouseEnter, closebutton.MouseUp
+ closebutton.BackgroundImage = Skins.closebtnhover
+ End Sub
+
+ Private Sub closebutton_MouseLeave(sender As Object, e As EventArgs) Handles closebutton.MouseLeave
+ closebutton.BackgroundImage = Skins.closebtn
+ End Sub
+
+ Private Sub closebutton_MouseDown(sender As Object, e As EventArgs) Handles closebutton.MouseDown
+ closebutton.BackgroundImage = Skins.closebtnclick
+ End Sub
+#End Region
+#Region "Minimize Button"
+ Private Sub minimizebutton_Click(sender As Object, e As EventArgs) Handles minimizebutton.Click
+ ShiftOSDesktop.minimizeprogram(Me, False)
+ End Sub
+#End Region
+#Region "Rollup Button"
+ Private Sub rollupbutton_Click(sender As Object, e As EventArgs) Handles rollupbutton.Click
+ rollupanddown()
+ End Sub
+
+ Private Sub rollupbutton_MouseEnter(sender As Object, e As EventArgs) Handles rollupbutton.MouseEnter, rollupbutton.MouseUp
+ rollupbutton.BackgroundImage = Skins.rollbtnhover
+ End Sub
+
+ Private Sub rollupbutton_MouseLeave(sender As Object, e As EventArgs) Handles rollupbutton.MouseLeave
+ rollupbutton.BackgroundImage = Skins.rollbtn
+ End Sub
+
+ Private Sub rollupbutton_MouseDown(sender As Object, e As EventArgs) Handles rollupbutton.MouseDown
+ rollupbutton.BackgroundImage = Skins.rollbtnclick
+ End Sub
+ Private Sub rollupanddown()
+ If RolledUp Then
+ pgleft.Show()
+ pgbottom.Show()
+ pgright.Show()
+ Me.Height = _heightBeforeRollup
+ Me.MinimumSize = New Size(MinimumSize.Width, MinimumSize.Height)
+ Else
+ Me.MinimumSize = New Size(0, 0)
+ pgleft.Hide()
+ pgbottom.Hide()
+ pgright.Hide()
+ _heightBeforeRollup = Me.Height
+ Me.Height = Me.titlebar.Height
+ End If
+ End Sub
+#End Region
+#Region "Resizing"
+ Private Sub pullside_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullside.Tick
+ Me.Width = Cursor.Position.X - Me.Location.X
+ End Sub
+
+ Private Sub pullbottom_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullbottom.Tick
+ Me.Height = Cursor.Position.Y - Me.Location.Y
+ End Sub
+
+ Private Sub pullbs_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles pullbs.Tick
+ Me.Width = Cursor.Position.X - Me.Location.X
+ Me.Height = Cursor.Position.Y - Me.Location.Y
+ End Sub
+
+ 'delete this for non-resizable windows
+ Private Sub Rightpull_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgright.MouseDown
+ If Resizable Then
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullside.Start()
+ End If
+ End If
+ End Sub
+
+ Private Sub RightCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgright.MouseEnter
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ Cursor = Cursors.SizeWE
+ End If
+ End Sub
+
+ Private Sub bottomCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgbottom.MouseEnter
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ Cursor = Cursors.SizeNS
+ End If
+ End Sub
+
+ Private Sub CornerCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgbottomrcorner.MouseEnter
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ Cursor = Cursors.SizeNWSE
+ End If
+ End Sub
+
+ Private Sub SizeCursoroff_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgright.MouseLeave, pgbottom.MouseLeave, pgbottomrcorner.MouseLeave
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ Cursor = Cursors.Default
+ End If
+ End Sub
+
+ Private Sub rightpull_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgright.MouseUp
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullside.Stop()
+ End If
+ End Sub
+
+ Private Sub bottompull_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgbottom.MouseDown
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullbottom.Start()
+ End If
+ End Sub
+
+ Private Sub buttompull_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgbottom.MouseUp
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullbottom.Stop()
+ End If
+ End Sub
+
+ Private Sub bspull_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgbottomrcorner.MouseDown
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullbs.Start()
+ End If
+ End Sub
+
+ Private Sub bspull_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pgbottomrcorner.MouseUp
+ If ShiftOSDesktop.boughtresizablewindows = True Then
+ pullbs.Stop()
+ End If
+ End Sub
+ Private Sub Me_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
+ If ShiftOSDesktop.boughtwindowborders = True Then
+ closebutton.Location = New Point(titlebar.Size.Width - Skins.closebtnfromside - closebutton.Size.Width, Skins.closebtnfromtop)
+ rollupbutton.Location = New Point(titlebar.Size.Width - Skins.rollbtnfromside - rollupbutton.Size.Width, Skins.rollbtnfromtop)
+ minimizebutton.Location = New Point(titlebar.Size.Width - Skins.minbtnfromside - minimizebutton.Size.Width, Skins.minbtnfromtop)
+ Select Case Skins.titletextpos
+ Case "Left"
+ lbtitletext.Location = New Point(Skins.titletextfromside, Skins.titletextfromtop)
+ Case "Centre"
+ lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop)
+ End Select
+ lbtitletext.ForeColor = Skins.titletextcolour
+ Else
+ closebutton.Location = New Point(titlebar.Size.Width - Skins.closebtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - closebutton.Size.Width, Skins.closebtnfromtop)
+ rollupbutton.Location = New Point(titlebar.Size.Width - Skins.rollbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - rollupbutton.Size.Width, Skins.rollbtnfromtop)
+ minimizebutton.Location = New Point(titlebar.Size.Width - Skins.minbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - minimizebutton.Size.Width, Skins.minbtnfromtop)
+ Select Case Skins.titletextpos
+ Case "Left"
+ lbtitletext.Location = New Point(Skins.titletextfromside + pgtoplcorner.Width, Skins.titletextfromtop)
+ Case "Centre"
+ lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop)
+ End Select
+ lbtitletext.ForeColor = Skins.titletextcolour
+ End If
+ End Sub
+#End Region
+#Region "Moveable Windows"
+ Private Sub titlebar_MouseDown(sender As Object, e As MouseEventArgs) Handles titlebar.MouseDown, lbtitletext.MouseDown, pnlicon.MouseDown, pgtoplcorner.MouseDown, pgtoprcorner.MouseDown
+ ' Handle Draggable Windows
+ If ShiftOSDesktop.boughtdraggablewindows = True Then
+ If e.Button = MouseButtons.Left Then
+ titlebar.Capture = False
+ lbtitletext.Capture = False
+ pnlicon.Capture = False
+ pgtoplcorner.Capture = False
+ pgtoprcorner.Capture = False
+ Const WM_NCLBUTTONDOWN As Integer = &HA1S
+ Const HTCAPTION As Integer = 2
+ Dim msg As Message =
+ Message.Create(Me.Handle, WM_NCLBUTTONDOWN,
+ New IntPtr(HTCAPTION), IntPtr.Zero)
+ Me.DefWndProc(msg)
+ End If
+ ShiftOSDesktop.log = ShiftOSDesktop.log & My.Computer.Clock.LocalTime & " User dragged " & Me.Name & " to " & Me.Location.ToString & Environment.NewLine
+ End If
+ End Sub
+#End Region
+End Class \ No newline at end of file