From bfb1b2199ee039ac76223300548555981f466df2 Mon Sep 17 00:00:00 2001 From: AlphaBeta0110 Date: Sun, 15 Mar 2015 11:33:28 +0100 Subject: [PATCH] .. how did I manage to upload everything but the code --- ShiftOS/ShiftOSWindow.Designer.vb | 237 ++++++++++++++++++++++++++++++ ShiftOS/ShiftOSWindow.vb | 189 ++++++++++++++++++++++++ 2 files changed, 426 insertions(+) create mode 100644 ShiftOS/ShiftOSWindow.Designer.vb create mode 100644 ShiftOS/ShiftOSWindow.vb diff --git a/ShiftOS/ShiftOSWindow.Designer.vb b/ShiftOS/ShiftOSWindow.Designer.vb new file mode 100644 index 0000000..60a23c4 --- /dev/null +++ b/ShiftOS/ShiftOSWindow.Designer.vb @@ -0,0 +1,237 @@ + +Partial Class ShiftOSWindow + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Me.pgleft = New System.Windows.Forms.Panel() + Me.pgbottomlcorner = New System.Windows.Forms.Panel() + Me.pgright = New System.Windows.Forms.Panel() + Me.pgbottomrcorner = New System.Windows.Forms.Panel() + Me.titlebar = New System.Windows.Forms.Panel() + Me.minimizebutton = New System.Windows.Forms.Panel() + Me.pnlicon = New System.Windows.Forms.PictureBox() + Me.rollupbutton = New System.Windows.Forms.Panel() + Me.closebutton = New System.Windows.Forms.Panel() + Me.lbtitletext = New System.Windows.Forms.Label() + Me.pgtoplcorner = New System.Windows.Forms.Panel() + Me.pgtoprcorner = New System.Windows.Forms.Panel() + Me.pgbottom = New System.Windows.Forms.Panel() + Me.pgcontents = New System.Windows.Forms.Panel() + Me.pullbs = New System.Windows.Forms.Timer(Me.components) + Me.pullbottom = New System.Windows.Forms.Timer(Me.components) + Me.pullside = New System.Windows.Forms.Timer(Me.components) + Me.pgleft.SuspendLayout() + Me.pgright.SuspendLayout() + Me.titlebar.SuspendLayout() + CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'pgleft + ' + Me.pgleft.BackColor = System.Drawing.Color.Gray + Me.pgleft.Controls.Add(Me.pgbottomlcorner) + Me.pgleft.Dock = System.Windows.Forms.DockStyle.Left + Me.pgleft.Location = New System.Drawing.Point(0, 30) + Me.pgleft.Name = "pgleft" + Me.pgleft.Size = New System.Drawing.Size(2, 313) + Me.pgleft.TabIndex = 16 + ' + 'pgbottomlcorner + ' + Me.pgbottomlcorner.BackColor = System.Drawing.Color.Red + Me.pgbottomlcorner.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottomlcorner.Location = New System.Drawing.Point(0, 311) + Me.pgbottomlcorner.Name = "pgbottomlcorner" + Me.pgbottomlcorner.Size = New System.Drawing.Size(2, 2) + Me.pgbottomlcorner.TabIndex = 14 + ' + 'pgright + ' + Me.pgright.BackColor = System.Drawing.Color.Gray + Me.pgright.Controls.Add(Me.pgbottomrcorner) + Me.pgright.Dock = System.Windows.Forms.DockStyle.Right + Me.pgright.Location = New System.Drawing.Point(807, 30) + Me.pgright.Name = "pgright" + Me.pgright.Size = New System.Drawing.Size(2, 313) + Me.pgright.TabIndex = 17 + ' + 'pgbottomrcorner + ' + Me.pgbottomrcorner.BackColor = System.Drawing.Color.Red + Me.pgbottomrcorner.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottomrcorner.Location = New System.Drawing.Point(0, 311) + Me.pgbottomrcorner.Name = "pgbottomrcorner" + Me.pgbottomrcorner.Size = New System.Drawing.Size(2, 2) + Me.pgbottomrcorner.TabIndex = 15 + ' + 'titlebar + ' + Me.titlebar.BackColor = System.Drawing.Color.Gray + Me.titlebar.Controls.Add(Me.minimizebutton) + Me.titlebar.Controls.Add(Me.pnlicon) + Me.titlebar.Controls.Add(Me.rollupbutton) + Me.titlebar.Controls.Add(Me.closebutton) + Me.titlebar.Controls.Add(Me.lbtitletext) + Me.titlebar.Controls.Add(Me.pgtoplcorner) + Me.titlebar.Controls.Add(Me.pgtoprcorner) + Me.titlebar.Dock = System.Windows.Forms.DockStyle.Top + Me.titlebar.ForeColor = System.Drawing.Color.White + Me.titlebar.Location = New System.Drawing.Point(0, 0) + Me.titlebar.Name = "titlebar" + Me.titlebar.Size = New System.Drawing.Size(809, 30) + Me.titlebar.TabIndex = 14 + ' + 'minimizebutton + ' + Me.minimizebutton.BackColor = System.Drawing.Color.Black + Me.minimizebutton.Location = New System.Drawing.Point(246, 5) + Me.minimizebutton.Name = "minimizebutton" + Me.minimizebutton.Size = New System.Drawing.Size(22, 22) + Me.minimizebutton.TabIndex = 24 + ' + 'pnlicon + ' + Me.pnlicon.BackColor = System.Drawing.Color.Transparent + Me.pnlicon.Image = Global.ShiftOS.My.Resources.Resources.iconTextPad + Me.pnlicon.Location = New System.Drawing.Point(8, 8) + Me.pnlicon.Name = "pnlicon" + Me.pnlicon.Size = New System.Drawing.Size(16, 16) + Me.pnlicon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.pnlicon.TabIndex = 24 + Me.pnlicon.TabStop = False + Me.pnlicon.Visible = False + ' + 'rollupbutton + ' + Me.rollupbutton.BackColor = System.Drawing.Color.Black + Me.rollupbutton.Location = New System.Drawing.Point(274, 3) + Me.rollupbutton.Name = "rollupbutton" + Me.rollupbutton.Size = New System.Drawing.Size(22, 22) + Me.rollupbutton.TabIndex = 22 + ' + 'closebutton + ' + Me.closebutton.BackColor = System.Drawing.Color.Black + Me.closebutton.Location = New System.Drawing.Point(302, 3) + Me.closebutton.Name = "closebutton" + Me.closebutton.Size = New System.Drawing.Size(22, 22) + Me.closebutton.TabIndex = 20 + ' + 'lbtitletext + ' + Me.lbtitletext.AutoSize = True + Me.lbtitletext.BackColor = System.Drawing.Color.Transparent + Me.lbtitletext.Font = New System.Drawing.Font("Felix Titling", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbtitletext.Location = New System.Drawing.Point(26, 7) + Me.lbtitletext.Name = "lbtitletext" + Me.lbtitletext.Size = New System.Drawing.Size(89, 18) + Me.lbtitletext.TabIndex = 19 + Me.lbtitletext.Text = "Template" + ' + 'pgtoplcorner + ' + Me.pgtoplcorner.BackColor = System.Drawing.Color.Red + Me.pgtoplcorner.Dock = System.Windows.Forms.DockStyle.Left + Me.pgtoplcorner.Location = New System.Drawing.Point(0, 0) + Me.pgtoplcorner.Name = "pgtoplcorner" + Me.pgtoplcorner.Size = New System.Drawing.Size(2, 30) + Me.pgtoplcorner.TabIndex = 17 + ' + 'pgtoprcorner + ' + Me.pgtoprcorner.BackColor = System.Drawing.Color.Red + Me.pgtoprcorner.Dock = System.Windows.Forms.DockStyle.Right + Me.pgtoprcorner.Location = New System.Drawing.Point(807, 0) + Me.pgtoprcorner.Name = "pgtoprcorner" + Me.pgtoprcorner.Size = New System.Drawing.Size(2, 30) + Me.pgtoprcorner.TabIndex = 16 + ' + 'pgbottom + ' + Me.pgbottom.BackColor = System.Drawing.Color.Gray + Me.pgbottom.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottom.Location = New System.Drawing.Point(2, 341) + Me.pgbottom.Name = "pgbottom" + Me.pgbottom.Size = New System.Drawing.Size(805, 2) + Me.pgbottom.TabIndex = 18 + ' + 'pgcontents + ' + Me.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill + Me.pgcontents.Location = New System.Drawing.Point(2, 30) + Me.pgcontents.Name = "pgcontents" + Me.pgcontents.Size = New System.Drawing.Size(805, 311) + Me.pgcontents.TabIndex = 15 + ' + 'pullbs + ' + Me.pullbs.Interval = 1 + ' + 'pullbottom + ' + Me.pullbottom.Interval = 1 + ' + 'pullside + ' + Me.pullside.Interval = 1 + ' + 'ShiftOSWindow + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(809, 343) + Me.Controls.Add(Me.pgcontents) + Me.Controls.Add(Me.pgbottom) + Me.Controls.Add(Me.pgright) + Me.Controls.Add(Me.pgleft) + Me.Controls.Add(Me.titlebar) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None + Me.Name = "ShiftOSWindow" + Me.Text = "ShiftOSWindow" + Me.TopMost = True + Me.pgleft.ResumeLayout(False) + Me.pgright.ResumeLayout(False) + Me.titlebar.ResumeLayout(False) + Me.titlebar.PerformLayout() + CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents pgleft As System.Windows.Forms.Panel + Friend WithEvents pgbottomlcorner As System.Windows.Forms.Panel + Friend WithEvents pgright As System.Windows.Forms.Panel + Friend WithEvents pgbottomrcorner As System.Windows.Forms.Panel + Friend WithEvents titlebar As System.Windows.Forms.Panel + Friend WithEvents pgtoplcorner As System.Windows.Forms.Panel + Friend WithEvents pgtoprcorner As System.Windows.Forms.Panel + Friend WithEvents pgbottom As System.Windows.Forms.Panel + Friend WithEvents pgcontents As System.Windows.Forms.Panel + Friend WithEvents lbtitletext As System.Windows.Forms.Label + Friend WithEvents closebutton As System.Windows.Forms.Panel + Friend WithEvents rollupbutton As System.Windows.Forms.Panel + Friend WithEvents pnlicon As System.Windows.Forms.PictureBox + Friend WithEvents minimizebutton As System.Windows.Forms.Panel + Friend WithEvents pullbs As System.Windows.Forms.Timer + Friend WithEvents pullbottom As System.Windows.Forms.Timer + Friend WithEvents pullside As System.Windows.Forms.Timer +End Class 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