X-Git-Url: http://git.maemo.org/git/?p=mardrone;a=blobdiff_plain;f=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FAndroid%2Fardrone%2Fproject%2Fsrc%2Fcom%2Fparrot%2FARDrone%2FRotatedButton.java;fp=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FAndroid%2Fardrone%2Fproject%2Fsrc%2Fcom%2Fparrot%2FARDrone%2FRotatedButton.java;h=b74fba7295f9be2b0e2a13d6a0f4597529fe571a;hp=0000000000000000000000000000000000000000;hb=9ec9bc13b75d30bc45535c54a652934debfcea92;hpb=ae0a3c2dc0898400aca0dd6b439c5db8044db7b2 diff --git a/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Android/ardrone/project/src/com/parrot/ARDrone/RotatedButton.java b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Android/ardrone/project/src/com/parrot/ARDrone/RotatedButton.java new file mode 100644 index 0000000..b74fba7 --- /dev/null +++ b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Android/ardrone/project/src/com/parrot/ARDrone/RotatedButton.java @@ -0,0 +1,42 @@ +package com.parrot.ARDrone; + +import android.content.Context; +import android.graphics.Canvas; +import android.util.AttributeSet; +import android.widget.Button; + +public class RotatedButton extends Button { + public RotatedButton(Context context) { + super(context, null); + } + + public RotatedButton(Context context, AttributeSet attrs) { + super(context, attrs ); + } + + public RotatedButton(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onDraw( Canvas canvas ) { + canvas.save(); + int bottom = this.getBottom(); + int top = this.getTop(); + int right = this.getRight(); + int left = this.getLeft(); + + // int rotX = left + (right - left)/2; + // int rotY = top + (bottom-top)/2; + + /*int rotX = (right - left)/2; + int rotY = (bottom-top)/2; */ + int rotX = this.getWidth()/2; + int rotY = this.getHeight()/2; + + canvas.rotate(180, rotX, rotY); + super.onDraw(canvas); + canvas.restore(); + } + +}