ui/cocoa/BoxContainer.m

Fri, 10 Oct 2025 15:54:01 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 10 Oct 2025 15:54:01 +0200
changeset 830
13896bdaa151
parent 811
1391ba7e533f
child 846
ffa983c223c1
permissions
-rw-r--r--

add sourcelist event selection handler (Cocoa)

785
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 #import "BoxContainer.h"
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 @implementation BoxContainer
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 - (BoxContainer*)init:(NSUserInterfaceLayoutOrientation)orientation spacing:(int)spacing {
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 self = [super init];
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 _orientation = orientation;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 self.columnspacing = spacing;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 self.rowspacing = spacing;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 return self;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 }
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15
799
f8ff8df41713 fix grid spacing (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 785
diff changeset
16 - (void) addView:(NSView*)view margin:(NSEdgeInsets)margin {
785
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 UiLayout layout = self.uilayout;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 layout.hexpand = TRUE;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 layout.hfill = TRUE;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 } else {
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 layout.vexpand = TRUE;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 layout.vfill = TRUE;
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 }
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 self.uilayout = layout;
799
f8ff8df41713 fix grid spacing (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 785
diff changeset
26 [super addView:view margin:margin];
785
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
811
1391ba7e533f implement splitview window (Cocoa)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 799
diff changeset
28 self.container->newline = TRUE;
785
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 }
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 }
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
b943e3d618f0 create new BoxContainer based on GridLayout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 @end

mercurial