-
Notifications
You must be signed in to change notification settings - Fork 11
/
layout_rectangles.py
65 lines (46 loc) · 2.34 KB
/
layout_rectangles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from juce_init import START_JUCE_COMPONENT
import popsicle as juce
class MainContentComponent(juce.Component):
header = juce.TextButton()
sidebar = juce.TextButton()
limeContent = juce.TextButton()
grapefruitContent = juce.TextButton()
lemonContent = juce.TextButton()
orangeContent = juce.TextButton()
footer = juce.TextButton()
def __init__(self):
super().__init__()
self.header.setColour(juce.TextButton.buttonColourId, juce.Colours.cornflowerblue)
self.header.setButtonText("Header")
self.addAndMakeVisible(self.header)
self.footer.setColour(juce.TextButton.buttonColourId, juce.Colours.cornflowerblue)
self.footer.setButtonText("Footer")
self.addAndMakeVisible(self.footer)
self.sidebar.setColour(juce.TextButton.buttonColourId, juce.Colours.grey)
self.sidebar.setButtonText("Sidebar")
self.addAndMakeVisible(self.sidebar)
self.limeContent.setColour(juce.TextButton.buttonColourId, juce.Colours.lime)
self.addAndMakeVisible(self.limeContent)
self.grapefruitContent.setColour(juce.TextButton.buttonColourId, juce.Colours.yellowgreen)
self.addAndMakeVisible(self.grapefruitContent)
self.lemonContent.setColour(juce.TextButton.buttonColourId, juce.Colours.yellow)
self.addAndMakeVisible(self.lemonContent)
self.orangeContent.setColour(juce.TextButton.buttonColourId, juce.Colours.orange)
self.addAndMakeVisible(self.orangeContent)
self.setSize(400, 400)
def paint(self, g):
g.fillAll(juce.Colours.darkgrey)
def resized(self):
area = self.getLocalBounds()
headerFooterHeight = 36
self.header.setBounds(area.removeFromTop(headerFooterHeight))
self.footer.setBounds(area.removeFromBottom(headerFooterHeight))
sidebarWidth = 80
self.sidebar.setBounds(area.removeFromLeft(sidebarWidth))
contentItemHeight = 24
self.limeContent.setBounds(area.removeFromTop(contentItemHeight))
self.grapefruitContent.setBounds(area.removeFromTop(contentItemHeight))
self.lemonContent.setBounds(area.removeFromTop(contentItemHeight))
self.orangeContent.setBounds(area.removeFromTop(contentItemHeight))
if __name__ == "__main__":
START_JUCE_COMPONENT(MainContentComponent, name="Advanced GUI layout techniques")