From 8e051c0f14eedca22f7891f3e70f2fdc7a08ffc0 Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 8 Aug 2020 15:53:06 +0200 Subject: [PATCH] add panels --- app/Main.hs | 64 ++++++++++++++++++++++++++++++++++++++++++------ assets/theme.css | 19 ++++++++++++++ 2 files changed, 75 insertions(+), 8 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index e04946e..b6fb628 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -114,11 +114,11 @@ main = do uiGrid <- GTK.gridNew GTK.setContainerChild baseOverlay uiGrid - logo <- GTK.boxNew GTK.OrientationVertical 0 - titleBar <- GTK.boxNew GTK.OrientationHorizontal 0 - toolBar <- GTK.boxNew GTK.OrientationVertical 0 - mainPane <- GTK.panedNew GTK.OrientationHorizontal - panelGrid <- GTK.gridNew + logo <- GTK.boxNew GTK.OrientationVertical 0 + titleBar <- GTK.boxNew GTK.OrientationHorizontal 0 + toolBar <- GTK.boxNew GTK.OrientationVertical 0 + mainPane <- GTK.panedNew GTK.OrientationHorizontal + panelBox <- GTK.boxNew GTK.OrientationVertical 0 GTK.gridAttach uiGrid logo 0 0 1 2 GTK.gridAttach uiGrid titleBar 1 0 2 1 @@ -127,8 +127,8 @@ main = do mainView <- GTK.boxNew GTK.OrientationVertical 0 - GTK.panedPack1 mainPane mainView True False - GTK.panedPack2 mainPane panelGrid False False + GTK.panedPack1 mainPane mainView True False + GTK.panedPack2 mainPane panelBox False False fileBar <- GTK.scrolledWindowNew ( Nothing @GTK.Adjustment ) ( Nothing @GTK.Adjustment ) viewportGrid <- GTK.gridNew @@ -420,7 +420,55 @@ main = do --------------------------------------------------------- -- Panels - widgetAddClass panelGrid "panels" + widgetAddClass panelBox "panels" + + pane1 <- GTK.panedNew GTK.OrientationVertical + GTK.boxPackStart panelBox pane1 True True 0 + + panels1 <- GTK.notebookNew + panels2 <- GTK.notebookNew + + GTK.notebookSetGroupName panels1 ( Just "Panel" ) + GTK.notebookSetGroupName panels2 ( Just "Panel" ) + + GTK.panedPack1 pane1 panels1 True True + GTK.panedPack2 pane1 panels2 True True + + strokesPanel <- GTK.boxNew GTK.OrientationVertical 0 + brushesPanel <- GTK.boxNew GTK.OrientationVertical 0 + transformPanel <- GTK.boxNew GTK.OrientationVertical 0 + + strokesTab <- GTK.labelNew ( Just "Strokes" ) + brushesTab <- GTK.labelNew ( Just "Brushes" ) + transformTab <- GTK.labelNew ( Just "Transform" ) + + for_ [ strokesTab, brushesTab, transformTab ] \ tab -> do + widgetAddClasses tab [ "plain", "text", "panelTab" ] + + for_ [ strokesPanel, brushesPanel, transformPanel ] \ panel -> do + widgetAddClass panel "panel" + + void $ GTK.notebookAppendPage panels1 strokesPanel ( Just strokesTab ) + void $ GTK.notebookAppendPage panels1 brushesPanel ( Just brushesTab ) + + void $ GTK.notebookAppendPage panels2 transformPanel ( Just transformTab ) + + GTK.notebookSetTabReorderable panels1 strokesPanel True + GTK.notebookSetTabDetachable panels1 strokesPanel True + GTK.notebookSetTabReorderable panels1 brushesPanel True + GTK.notebookSetTabDetachable panels1 brushesPanel True + + GTK.notebookSetTabReorderable panels2 transformPanel True + GTK.notebookSetTabDetachable panels2 transformPanel True + + strokesContent <- GTK.labelNew ( Just "Strokes tab content..." ) + brushesContent <- GTK.labelNew ( Just "Brushes tab content..." ) + transformContent <- GTK.labelNew ( Just "Transform tab content..." ) + + GTK.boxPackStart strokesPanel strokesContent True True 0 + GTK.boxPackStart brushesPanel brushesContent True True 0 + GTK.boxPackStart transformPanel transformContent True True 0 + --------------------------------------------------------- -- Info bar diff --git a/assets/theme.css b/assets/theme.css index 9907f40..c5d37e1 100644 --- a/assets/theme.css +++ b/assets/theme.css @@ -319,6 +319,25 @@ tooltip { font-size: 12px; } +.panels tab { + padding-left: 6px; + padding-right: 6px; + border-top: 2px solid rgb(41, 40, 40); +} + +.panels tab:hover { + border-color: rgb(72,70,61); +} + +.panels tab:active, .panels tab:checked { + background-color: rgb(72,70,61); + border-color: rgb(234,223,204); +} + +.panel { + background-color: rgb(72,70,61); +} + /* Info bar */ .infoBar { min-height: 40px;