aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gwin/label/main.c
blob: 175c0d6ed4cdec4c99844c33e0d7b1fdee6a46ab (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
 * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *    * Neither the name of the <organization> nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "gfx.h"

GListener	gl;
GHandle		ghLabel1, ghLabel2;

static void createWidgets(void) {
	GWidgetInit	wi;

	// Apply some default values for GWIN
	wi.customDraw = 0;
	wi.customParam = 0;
	wi.customStyle = 0;
	wi.g.show = TRUE;

	// Create the IP label
	wi.g.width = 200; wi.g.height = 20; wi.g.x = 10, wi.g.y = 80;
	wi.text = "192.168.1.42";
	ghLabel1 = gwinLabelCreate(NULL, &wi);
	gwinLabelSetAttribute(ghLabel1, 100, "Current IP:");

	// Create the DHCP label
	wi.g.width = 200; wi.g.height = 20; wi.g.x = 10, wi.g.y = 100;
	wi.text = "Off";
	ghLabel2 = gwinLabelCreate(NULL, &wi);
	gwinLabelSetAttribute(ghLabel2, 100, "DHCP:");
}

int main(void) {
	GEvent* pe;

	// Initialize the display
	gfxInit();

	// Set the widget defaults
	gwinSetDefaultFont(gdispOpenFont("*"));
	gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
	gdispClear(White);

	// Attach the mouse input
	gwinAttachMouse(0);

	// create the widget
	createWidgets();

	// We want to listen for widget events
	geventListenerInit(&gl);
	gwinAttachListener(&gl);

	while(1) {
		// Get an Event
		pe = geventEventWait(&gl, TIME_INFINITE);
	}

	return 0;
}
/span> overflow. -- Issue a warning in case of non-logical value. function TO_UNSIGNED (ARG, SIZE : NATURAL) return UNSIGNED; -- Convert ARG to unsigned. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function TO_SIGNED (ARG : INTEGER; SIZE : NATURAL) return SIGNED; -- Convert ARG to signed. -- Result index range is SIZE - 1 downto 0. -- Issue a warning if value is truncated. function resize (ARG : UNSIGNED; NEW_SIZE: natural) return UNSIGNED; function resize (ARG : SIGNED; NEW_SIZE: natural) return SIGNED; -- Result index range is NEW_SIZE - 1 downto 0 (unless null array). -- For SIGNED, the sign of the result is the sign of ARG. function "=" (L, R : UNSIGNED) return BOOLEAN; function "=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "/=" (L, R : UNSIGNED) return BOOLEAN; function "/=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "/=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<" (L, R : UNSIGNED) return BOOLEAN; function "<" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "<=" (L, R : UNSIGNED) return BOOLEAN; function "<=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function "<=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">" (L, R : UNSIGNED) return BOOLEAN; function ">" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function ">=" (L, R : UNSIGNED) return BOOLEAN; function ">=" (L : UNSIGNED; R : NATURAL) return BOOLEAN; function ">=" (L : NATURAL; R : UNSIGNED) return BOOLEAN; function "=" (L, R : SIGNED) return BOOLEAN; function "=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "/=" (L, R : SIGNED) return BOOLEAN; function "/=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "/=" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<" (L, R : SIGNED) return BOOLEAN; function "<" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<" (L : INTEGER; R : SIGNED) return BOOLEAN; function "<=" (L, R : SIGNED) return BOOLEAN; function "<=" (L : SIGNED; R : INTEGER) return BOOLEAN; function "<=" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">" (L, R : SIGNED) return BOOLEAN; function ">" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">" (L : INTEGER; R : SIGNED) return BOOLEAN; function ">=" (L, R : SIGNED) return BOOLEAN; function ">=" (L : SIGNED; R : INTEGER) return BOOLEAN; function ">=" (L : INTEGER; R : SIGNED) return BOOLEAN; -- Issue a warning in case of non-logical value. function "-" (ARG : SIGNED) return SIGNED; -- Compute -ARG. -- Result index range is Arg'length - 1 downto 0. function "abs" (ARG : SIGNED) return SIGNED; -- Compute abs ARG. -- Result index range is Arg'length - 1 downto 0. function "+" (L, R : UNSIGNED) return UNSIGNED; function "+" (L, R : SIGNED) return SIGNED; function "-" (L, R : UNSIGNED) return UNSIGNED; function "-" (L, R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is max (L'Length, R'Length) - 1 downto 0. -- Issue a warning in case of non-logical value. function "+" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "+" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "+" (L : SIGNED; R : INTEGER) return SIGNED; function "+" (L : INTEGER; R : SIGNED) return SIGNED; function "-" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "-" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "-" (L : SIGNED; R : INTEGER) return SIGNED; function "-" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L +/- R. -- Result index range is V'Length - 1 downto 0, where V is the vector -- parameter. -- Issue a warning in case of non-logical value. -- Issue a warning if value is truncated. function "*" (L, R : UNSIGNED) return UNSIGNED; function "*" (L, R : SIGNED) return SIGNED; -- Compute L * R -- Result index range is L'Length + R'Length - 1 downto 0. function "*" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "*" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L * R -- R is converted to a vector of length L'length function "*" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "*" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L * R -- L is converted to a vector of length R'length function "/" (L, R : UNSIGNED) return UNSIGNED; function "/" (L, R : SIGNED) return SIGNED; function "rem" (L, R : UNSIGNED) return UNSIGNED; function "rem" (L, R : SIGNED) return SIGNED; function "mod" (L, R : UNSIGNED) return UNSIGNED; function "mod" (L, R : SIGNED) return SIGNED; -- Compute L op R -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "/" (L : SIGNED; R : INTEGER) return SIGNED; function "rem" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "rem" (L : SIGNED; R : INTEGER) return SIGNED; function "mod" (L : UNSIGNED; R : NATURAL) return UNSIGNED; function "mod" (L : SIGNED; R : INTEGER) return SIGNED; -- Compute L op R. -- Result index range is L'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. function "/" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "/" (L : INTEGER; R : SIGNED) return SIGNED; function "rem" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "rem" (L : INTEGER; R : SIGNED) return SIGNED; function "mod" (L : NATURAL; R : UNSIGNED) return UNSIGNED; function "mod" (L : INTEGER; R : SIGNED) return SIGNED; -- Compute L op R. -- Result index range is R'Length - 1 downto 0. -- Issue a warning in case of non-logical value. -- Issue an error if R is 0. -- Result may be truncated. function "not" (l : UNSIGNED) return UNSIGNED; function "not" (l : SIGNED) return SIGNED; function "and" (l, r : UNSIGNED) return UNSIGNED; function "and" (l, r : SIGNED) return SIGNED; function "nand" (l, r : UNSIGNED) return UNSIGNED; function "nand" (l, r : SIGNED) return SIGNED; function "or" (l, r : UNSIGNED) return UNSIGNED; function "or" (l, r : SIGNED) return SIGNED; function "nor" (l, r : UNSIGNED) return UNSIGNED; function "nor" (l, r : SIGNED) return SIGNED; function "xor" (l, r : UNSIGNED) return UNSIGNED; function "xor" (l, r : SIGNED) return SIGNED; function "xnor" (l, r : UNSIGNED) return UNSIGNED; function "xnor" (l, r : SIGNED) return SIGNED; -- Compute L OP R. -- Result index range is L'Length - 1 downto 0. -- No specific handling of null array: the index range of the result -- would be -1 downto 0 (without warning). This it not what is specified -- in 1076.3, but corresponds to the standard implementation. -- No specific handling of non-logical values. Behaviour is compatible -- with std_logic_1164. function shift_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function shift_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function shift_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function rotate_left (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_left (ARG : SIGNED; COUNT: NATURAL) return SIGNED; function rotate_right (ARG : UNSIGNED; COUNT: NATURAL) return UNSIGNED; function rotate_right (ARG : SIGNED; COUNT: NATURAL) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "sll" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "sll" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "srl" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "srl" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0. function "rol" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "rol" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; function "ror" (ARG : UNSIGNED; COUNT: INTEGER) return UNSIGNED; function "ror" (ARG : SIGNED; COUNT: INTEGER) return SIGNED; -- Result index range is ARG'Length - 1 downto 0.