Skip to content

Commit

Permalink
Working on the inspector demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjpettet committed Dec 16, 2022
1 parent 0da4a53 commit 50a0773
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 10 deletions.
46 changes: 45 additions & 1 deletion src/Demo Windows/UI Controls/Inspector/WinInspector.xojo_window
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,47 @@ Begin DemoWindow WinInspector
Visible = True
Width = 300
End
Begin DesktopTextField TextField1
AllowAutoDeactivate= True
AllowFocusRing = True
AllowSpellChecking= False
AllowTabs = False
BackgroundColor = &cFFFFFF
Bold = False
Enabled = True
FontName = "System"
FontSize = 0.0
FontUnit = 0
Format = ""
HasBorder = True
Height = 22
Hint = "Placeholder"
Index = -2147483648
Italic = False
Left = 355
LockBottom = False
LockedInPosition= False
LockLeft = True
LockRight = False
LockTop = True
MaximumCharactersAllowed= 0
Password = False
ReadOnly = False
Scope = 0
TabIndex = 1
TabPanelIndex = 0
TabStop = True
Text = ""
TextAlignment = 0
TextColor = &c000000
Tooltip = ""
Top = 31
Transparent = False
Underline = False
ValidationMask = ""
Visible = True
Width = 80
End
End
#tag EndDesktopWindow

Expand All @@ -65,7 +106,10 @@ End
Inspector.AddSection(frameSection)

// Type.
frameSection.AddItem(New XUIInspectorPopupItem("frame.type", "Type", Array("Document", "Movable Modal", "Modal Dialog"), True))
frameSection.AddItem(New XUIInspectorPopupItem("frame.type", "Type", Array("Document", "Movable Modal", "Modal Dialog"), True, 150))

// Title.
frameSection.AddItem(New XUIInspectorTextFieldItem("frame.title", "Title", 150, "Enter a title"))

End Sub
#tag EndEvent
Expand Down
2 changes: 0 additions & 2 deletions src/Welcome Window/WinWelcome.xojo_window
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ End
#tag WindowCode
#tag Event
Sub Opening()
#Pragma Warning "TODO: XUIInspector demo"

// Centre this window on its display.
Self.Center

Expand Down
2 changes: 1 addition & 1 deletion src/XUI.xojo_project
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Interface=XUIInspectorItemKeyHandler;XUI/XUIInspector/Items/XUIInspectorItemKeyH
Interface=XUIInspectorItem;XUI/XUIInspector/Items/XUIInspectorItem.xojo_code;&h000000002CCDEFFF;&h000000002CB847FF;false
Class=XUIInspectorCheckBoxItem;XUI/XUIInspector/Items/XUIInspectorCheckBoxItem.xojo_code;&h00000000271837FF;&h000000002CB847FF;false
Class=XUIInspectorPopupItem;XUI/XUIInspector/Items/XUIInspectorPopupItem.xojo_code;&h0000000037381FFF;&h000000002CB847FF;false
Class=XUIInspectorButtonItem;XUI/XUIInspector/Items/XUIInspectorButtonItem.xojo_code;&h00000000455DD7FF;&h000000002CB847FF;false
Class=XUIInspectorFullWidthButtonItem;XUI/XUIInspector/Items/XUIInspectorFullWidthButtonItem.xojo_code;&h00000000455DD7FF;&h000000002CB847FF;false
Class=XUIInspectorTextFieldItem;XUI/XUIInspector/Items/XUIInspectorTextFieldItem.xojo_code;&h000000002EB16FFF;&h000000002CB847FF;false
Folder=Misc;XUI/XUIInspector/Misc;&h0000000071DEAFFF;&h000000007F4C67FF;false
Class=XUIInspectorMouseUpData;XUI/XUIInspector/Misc/XUIInspectorMouseUpData.xojo_code;&h000000006D23FFFF;&h0000000071DEAFFF;false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#tag Class
Protected Class XUIInspectorButtonItem
Protected Class XUIInspectorFullWidthButtonItem
Implements XUIInspectorItem
#tag Method, Flags = &h0
Function Bounds() As Rect
Expand All @@ -22,9 +22,9 @@ Implements XUIInspectorItem
#tag EndMethod

#tag Method, Flags = &h0
Sub Constructor(id As String, caption As String)
Sub Constructor(id As String, buttonCaption As String)
mID = id
Self.Caption = caption
Self.Caption = buttonCaption

End Sub
#tag EndMethod
Expand Down
2 changes: 1 addition & 1 deletion src/XUI/XUIInspector/Items/XUIInspectorPopupItem.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Implements XUIInspectorItem
g.DrawText(Caption, HPADDING, captionBaseline, captionW, True)

// Regardless of whether the popup menu is open or closed, we always draw the closed popup box.
DrawPopupBox(x + HPADDING + captionW + POPUP_CAPTION_PADDING, y, g, style)
DrawPopupBox(x + HPADDING + captionW + POPUP_CAPTION_PADDING, y + VPADDING, g, style)

g.RestoreState

Expand Down
4 changes: 2 additions & 2 deletions src/XUI/XUIInspector/XUIInspector.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ Inherits NSScrollViewCanvas
Sub Constructor()
Super.Constructor

// Ensure we have at least a blank style.
Self.Style = New XUIInspectorStyle
// Start with the default style.
Self.Style = XUIInspectorStyle.Default

// Setup the timer that handles refreshing.
mRefreshTimer = New Timer
Expand Down
36 changes: 36 additions & 0 deletions src/XUI/XUIInspector/XUIInspectorStyle.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,42 @@ Protected Class XUIInspectorStyle
End Sub
#tag EndMethod

#tag Method, Flags = &h0, Description = 52657475726E73207468652064656661756C74207374796C6520666F722074686520696E73706563746F722E
Shared Function Default() As XUIInspectorStyle
/// Returns the default style for the inspector.
///
/// Feel free to create your own.

Var style As New XUIInspectorStyle

Const ALMOST_BLACK = &c171717
Const LIGHT_GREY = &cCACBCB
Const DARK_GREY = &c353636
Const LIGHT_SELECTION_BLUE = &cA4CBFE
Const DARK_SELECTION_BLUE = &c304F77
Const LIGHT_ACCENT_BLUE = &c3D71E3
Const DARK_ACCENT_BLUE = &c3968D4
Const LIGHT_PLACEHOLDER_GREY = &cBFBFC1
Const DARK_PLACEHOLDER_GREY = &c252626

style.AccentColor = New ColorGroup(LIGHT_ACCENT_BLUE, DARK_ACCENT_BLUE)
style.BackgroundColor = New ColorGroup(Color.White, ALMOST_BLACK)
style.BorderColor = New ColorGroup(LIGHT_GREY, DARK_GREY)
style.ControlBackgroundColor = New ColorGroup(Color.White, ALMOST_BLACK)
style.ControlBorderColor = New ColorGroup(LIGHT_GREY, DARK_GREY)
style.FocusColor = New ColorGroup(LIGHT_ACCENT_BLUE, DARK_ACCENT_BLUE)
style.PlaceholderTextColor = New ColorGroup(LIGHT_PLACEHOLDER_GREY, DARK_PLACEHOLDER_GREY)
style.SectionBackColor = New ColorGroup(LIGHT_PLACEHOLDER_GREY, DARK_PLACEHOLDER_GREY)
style.SelectionColor = New ColorGroup(LIGHT_SELECTION_BLUE, DARK_SELECTION_BLUE)
style.TextColor = New ColorGroup(Color.Black, Color.White)

style.FontName = "System"
style.FontSize = 12

Return style
End Function
#tag EndMethod


#tag Note, Name = About
`XUIInspector` is highly customisable. This class contains the various properties that can be
Expand Down

0 comments on commit 50a0773

Please sign in to comment.