]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/util/SimpleUxContext.java
1 package org
.argeo
.cms
.util
;
3 import org
.argeo
.cms
.ui
.UxContext
;
4 import org
.eclipse
.swt
.graphics
.Point
;
5 import org
.eclipse
.swt
.graphics
.Rectangle
;
6 import org
.eclipse
.swt
.widgets
.Display
;
8 public class SimpleUxContext
implements UxContext
{
10 private Point small
= new Point(400, 400);
12 public SimpleUxContext() {
13 this(Display
.getCurrent().getBounds());
16 public SimpleUxContext(Rectangle rect
) {
17 this.size
= new Point(rect
.width
, rect
.height
);
20 public SimpleUxContext(Point size
) {
25 public boolean isPortrait() {
26 return size
.x
>= size
.y
;
30 public boolean isLandscape() {
31 return size
.x
< size
.y
;
35 public boolean isSquare() {
36 return size
.x
== size
.y
;
40 public boolean isSmall() {
41 return size
.x
<= small
.x
|| size
.y
<= small
.y
;
45 public boolean isMasterData() {
46 // TODO make it configurable