javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/ercp/swt/mobile/Command.java
equal
deleted
inserted
replaced
262 * </P> |
262 * </P> |
263 * |
263 * |
264 */ |
264 */ |
265 public static final int HELP = 9; |
265 public static final int HELP = 9; |
266 |
266 |
267 |
267 private Control control; |
268 public Control control; |
268 private int type; |
269 public int type; |
269 |
270 private int priority; |
270 private int priority; |
271 private int accelerator; |
271 private int accelerator; |
272 private String longLabel; |
272 private String longLabel; |
273 private Command parent; |
273 private Command parent; |
274 private Command[] children; |
274 private Command[] children; |
275 //Holds the handle to QMenu that hold commandGroup |
275 // Handle to QMenu that holds commandGroup |
276 private int commandgroup_handle; |
276 private int commandgroup_handle; |
277 |
277 |
278 static final class CommandPackageProxy extends PackageProxy { |
278 static final class CommandPackageProxy extends PackageProxy { |
279 public void createHandle(int index) { |
279 public void createHandle(int index) { |
280 ((Command)w).createHandle(index); |
280 ((Command)w).createHandle(index); |
405 checkWidget (); |
405 checkWidget (); |
406 checkCommand(type, priority); |
406 checkCommand(type, priority); |
407 this.control = control; |
407 this.control = control; |
408 this.type = type; |
408 this.type = type; |
409 this.priority = priority; |
409 this.priority = priority; |
410 Internal_PackageSupport.createWidget(this,0); |
410 Internal_PackageSupport.createWidget(this, 0); |
411 Internal_PackageSupport.addCommand( control, this ); |
|
412 } |
411 } |
413 |
412 |
414 private void checkCommand(int type, int priority) { |
413 private void checkCommand(int type, int priority) { |
415 if ( priority < 0) SWT.error (SWT.ERROR_INVALID_ARGUMENT); |
414 if ( priority < 0) SWT.error (SWT.ERROR_INVALID_ARGUMENT); |
416 if ( type < Command.GENERAL || type > Command.COMMANDGROUP) SWT.error (SWT.ERROR_INVALID_ARGUMENT); |
415 if ( type < Command.GENERAL || type > Command.COMMANDGROUP) SWT.error (SWT.ERROR_INVALID_ARGUMENT); |
452 Internal_PackageSupport.addCommand( this.control, this ); |
451 Internal_PackageSupport.addCommand( this.control, this ); |
453 Internal_PackageSupport.commandArranger().commandAdded( this ); |
452 Internal_PackageSupport.commandArranger().commandAdded( this ); |
454 } |
453 } |
455 |
454 |
456 } |
455 } |
|
456 |
457 /** |
457 /** |
458 * Adds the listener to the collection of listeners who will be notified |
458 * Adds the listener to the collection of listeners who will be notified |
459 * when the command is activated, by sending it one of the messages defined |
459 * when the command is activated, by sending it one of the messages defined |
460 * in the <code>SelectionListener</code> interface. |
460 * in the <code>SelectionListener</code> interface. |
461 * <p> |
461 * <p> |
486 checkWidget (); |
486 checkWidget (); |
487 if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); |
487 if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); |
488 TypedListener typedListener = new TypedListener(listener); |
488 TypedListener typedListener = new TypedListener(listener); |
489 addListener (SWT.Selection,typedListener); |
489 addListener (SWT.Selection,typedListener); |
490 } |
490 } |
491 |
491 |
492 public static Command[] internal_getCommands(Control control) { |
|
493 return Internal_PackageSupport.getCommands(control); |
|
494 } |
|
495 |
|
496 /** |
492 /** |
497 * Returns <code>true</code> if the receiver is enabled, and |
493 * Returns <code>true</code> if the receiver is enabled, and |
498 * <code>false</code> otherwise. A disabled control is typically not |
494 * <code>false</code> otherwise. A disabled control is typically not |
499 * selectable from the user interface and draws with an inactive or "grayed" |
495 * selectable from the user interface and draws with an inactive or "grayed" |
500 * look. |
496 * look. |
834 } |
830 } |
835 |
831 |
836 private static final int topHandle(Widget w) { |
832 private static final int topHandle(Widget w) { |
837 return Internal_PackageSupport.topHandle(w); |
833 return Internal_PackageSupport.topHandle(w); |
838 } |
834 } |
|
835 |
|
836 Control control() { |
|
837 return control; |
|
838 } |
|
839 |
|
840 int type() { |
|
841 return type; |
|
842 } |
839 } |
843 } |