lipsync/trunk/bocoree/BMenuBar.cs
kbinani 9de5d2e51e [trunk] (ry
git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@18 b1f601f4-4f45-0410-8980-aecacb008692
2010-03-17 03:14:08 +00:00

156 lines
4.3 KiB
C#

/*
* BMenuBar.cs
* Copyright (c) 2009 kbinani
*
* This file is part of bocoree.
*
* bocoree is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* bocoree is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#if JAVA
//INCLUDE ..\BuildJavaUI\src\org\kbinani\windows\forms\BMenuBar.java
#else
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace bocoree.windows.forms {
public interface MenuElement {
MenuElement[] getSubElements();
String getName();
String getText();
void setAccelerator( bocoree.javax.swing.KeyStroke stroke );
bocoree.javax.swing.KeyStroke getAccelerator();
object getParent();
}
public class BMenuBar : System.Windows.Forms.MenuStrip, MenuElement {
// root implementation of javax.swing.MenuElement
#region javax.swing.MenuElement
public MenuElement[] getSubElements() {
List<MenuElement> list = new List<MenuElement>();
foreach ( ToolStripMenuItem item in base.Items ) {
if ( item is MenuElement ) {
list.Add( (MenuElement)item );
}
}
return list.ToArray();
}
#endregion
#region javax.swing.AbstractButton
public string getText() {
return base.Text;
}
public void setText( string value ) {
base.Text = value;
}
#if ABSTRACT_BUTTON_ENABLE_IS_SELECTED
public bool isSelected() {
return base.Checked;
}
public void setSelected( bool value ) {
base.Checked = true;
}
#endif
#endregion
#region java.awt.Component
public object getParent() {
return base.Parent;
}
public string getName() {
return base.Name;
}
public void setName( string value ) {
base.Name = value;
}
#if COMPONENT_ENABLE_LOCATION
public bocoree.java.awt.Point getLocation() {
System.Drawing.Point loc = this.Location;
return new bocoree.java.awt.Point( loc.X, loc.Y );
}
public void setLocation( int x, int y ) {
base.Location = new System.Drawing.Point( x, y );
}
public void setLocation( bocoree.java.awt.Point p ) {
base.Location = new System.Drawing.Point( p.x, p.y );
}
#endif
public bocoree.java.awt.Rectangle getBounds() {
System.Drawing.Rectangle r = base.Bounds;
return new bocoree.java.awt.Rectangle( r.X, r.Y, r.Width, r.Height );
}
#if COMPONENT_ENABLE_X
public int getX() {
return base.Left;
}
#endif
#if COMPONENT_ENABLE_Y
public int getY() {
return base.Top;
}
#endif
public int getWidth() {
return base.Width;
}
public int getHeight() {
return base.Height;
}
public bocoree.java.awt.Dimension getSize() {
return new bocoree.java.awt.Dimension( base.Size.Width, base.Size.Height );
}
public void setSize( int width, int height ) {
base.Size = new System.Drawing.Size( width, height );
}
public void setSize( bocoree.java.awt.Dimension d ) {
setSize( d.width, d.height );
}
public void setBackground( bocoree.java.awt.Color color ) {
base.BackColor = System.Drawing.Color.FromArgb( color.getRed(), color.getGreen(), color.getBlue() );
}
public void setFont( bocoree.java.awt.Font font ) {
base.Font = font.font;
}
public bool getEnabled() {
return base.Enabled;
}
public void setEnabled( bool value ) {
base.Enabled = value;
}
#endregion
public void setAccelerator( bocoree.javax.swing.KeyStroke stroke ) {
}
public bocoree.javax.swing.KeyStroke getAccelerator() {
return null;
}
}
}
#endif