Check-in [7508c51408]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the list demo set some alternative fonts.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7508c514088f7e74c13ed8830a98c40796a8d396
User & Date: stephanie.gawroriski 2019-05-20 12:35:31
Context
2019-05-21
17:09
Add base for the about command in the launcher. check-in: 6f99172144 user: stephanie.gawroriski tags: trunk
2019-05-20
12:35
In the list demo set some alternative fonts. check-in: 7508c51408 user: stephanie.gawroriski tags: trunk
12:10
Implement part of copy area. check-in: 3b901912d8 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/midp-lcdui/cc/squirreljme/runtime/lcdui/phoneui/DrawingMethod.java.

130
131
132
133
134
135
136




137
138
139
140
141
142
143
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
			int focusdx = __s.focusdx;
			int n = list.size();
			if (focusdx < 0)
				focusdx = 0;
			else if (focusdx >= n)
				focusdx = n - 1;
			




			// Draw all list items
			for (int i = 0; i < n; i++)
			{
				// Reset X draw
				dx = 0;
				
				// Get item properties
................................................................................
				Image vi = list.getImage(i);
				Font vf = list.getFont(i);
				boolean ve = list.isEnabled(i);
				boolean vl = list.isSelected(i);
				
				// Use a default fallback font?
				if (vf == null)
					vf = Font.getFont(StandardMetrics.LIST_ITEM_FONT, 0,
						StandardMetrics.LIST_ITEM_HEIGHT);
				
				// Height of this item
				int ih = vf.getPixelSize();
				
				// Increase height for the image size?
				if (vi != null)
				{







>
>
>
>







 







|
<







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
			int focusdx = __s.focusdx;
			int n = list.size();
			if (focusdx < 0)
				focusdx = 0;
			else if (focusdx >= n)
				focusdx = n - 1;
			
			// Default font
			Font dfont = Font.getFont(StandardMetrics.LIST_ITEM_FONT, 0,
				StandardMetrics.LIST_ITEM_HEIGHT);
			
			// Draw all list items
			for (int i = 0; i < n; i++)
			{
				// Reset X draw
				dx = 0;
				
				// Get item properties
................................................................................
				Image vi = list.getImage(i);
				Font vf = list.getFont(i);
				boolean ve = list.isEnabled(i);
				boolean vl = list.isSelected(i);
				
				// Use a default fallback font?
				if (vf == null)
					vf = dfont;

				
				// Height of this item
				int ih = vf.getPixelSize();
				
				// Increase height for the image size?
				if (vi != null)
				{

Changes to runt/apis/midp-lcdui/javax/microedition/lcdui/List.java.

294
295
296
297
298
299
300

301
302
303
304
305
306
307
...
308
309
310
311
312
313
314








315

316
317






318
319
320
321
322
323
324
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/09
	 */
	@Override
	public void setEnabled(int __i, boolean __e)

	{
		this._items.get(__i)._disabled = !__e;
		
		// Update display
		Display d = this._display;
		if (d != null)
			d._phoneui.repaint();
................................................................................
	}
	
	public void setFitPolicy(int __a)
	{
		throw new todo.TODO();
	}
	








	public void setFont(int __a, Font __b)

	{
		throw new todo.TODO();






	}
	
	public void setSelectCommand(Command __a)
	{
		throw new todo.TODO();
	}
	







>







 







>
>
>
>
>
>
>
>
|
>

<
>
>
>
>
>
>







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326

327
328
329
330
331
332
333
334
335
336
337
338
339
	
	/**
	 * {@inheritDoc}
	 * @since 2018/12/09
	 */
	@Override
	public void setEnabled(int __i, boolean __e)
		throws IndexOutOfBoundsException
	{
		this._items.get(__i)._disabled = !__e;
		
		// Update display
		Display d = this._display;
		if (d != null)
			d._phoneui.repaint();
................................................................................
	}
	
	public void setFitPolicy(int __a)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Sets the font of the given item.
	 *
	 * @param __i The item to set.
	 * @param __f The font to use, {@code null} clears it and uses the default.
	 * @throws IndexOutOfBoundsException If the item is not within bounds.
	 * @since 2019/05/20
	 */
	public void setFont(int __i, Font __f)
		throws IndexOutOfBoundsException
	{

		this._items.get(__i)._font = __f;
		
		// Update display
		Display d = this._display;
		if (d != null)
			d._phoneui.repaint();
	}
	
	public void setSelectCommand(Command __a)
	{
		throw new todo.TODO();
	}
	

Changes to runt/mids/lcdui-demo/net/multiphasicapps/lcduidemo/Lists.java.

7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
75
76
77
78
79
80
81










82
83
84
85
86
87
88
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.lcduidemo;

import javax.microedition.lcdui.Display;

import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is a demo for lists.
 *
................................................................................
		list.append("Sciurus sanborni", null);
		list.append("Sciurus spadiceus", null);
		list.append("Sciurus stramineus", null);
		list.append("Sciurus variegatoides", null);
		list.append("Sciurus vulgaris", null);
		list.append("Sciurus yucatanensis", null);
		










		// Select some items for us
		list.setSelectedIndex(1, true);
		list.setSelectedIndex(6, true);
		list.setSelectedIndex(12, true);
		
		// Disable some items
		list.setEnabled(8, false);







>







 







>
>
>
>
>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.lcduidemo;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * This is a demo for lists.
 *
................................................................................
		list.append("Sciurus sanborni", null);
		list.append("Sciurus spadiceus", null);
		list.append("Sciurus stramineus", null);
		list.append("Sciurus variegatoides", null);
		list.append("Sciurus vulgaris", null);
		list.append("Sciurus yucatanensis", null);
		
		// Use a certain font for some items
		list.setFont(2,
			Font.getFont(Font.FACE_SYSTEM, 0, Font.SIZE_SMALL));
		list.setFont(4,
			Font.getFont(Font.FACE_MONOSPACE, 0, Font.SIZE_MEDIUM));
		list.setFont(6,
			Font.getFont(Font.FACE_PROPORTIONAL, 0, Font.SIZE_MEDIUM));
		list.setFont(8,
			Font.getFont(Font.FACE_MONOSPACE, 0, Font.SIZE_SMALL));
		
		// Select some items for us
		list.setSelectedIndex(1, true);
		list.setSelectedIndex(6, true);
		list.setSelectedIndex(12, true);
		
		// Disable some items
		list.setEnabled(8, false);