/********************************************* aNGELjUCER - taste gui operations *********************************************/ #pragma extension "core" class MyComponent { //------------------------------------------------------ MyComponent(const String& obj) { self.setClassAndObject ("MyComponent", obj); self.addToDesktop (ComponentPeer.windowHasDropShadow); } //------------------------------------------------------ void resized () { } void paint (Graphics& g) { Random rand; Rectangle bounds = this.self.getBounds(); Colour color (rand.nextFloat(),rand.nextFloat(),rand.nextFloat()); g.fillAll (color); g.setColour (color.contrasting (1.0f)); g.setFont (rand.nextFloat() * 80.0f, 0); g.drawSingleLineText ("angeljuice !", rand.nextFloat()*self.getWidth(), rand.nextFloat()*self.getHeight()); } void timerCallback () { self.repaint (); } //------------------------------------------------------ void mouseDown (const MouseEvent& e) { myDragger.startDraggingComponent (this.self); } void mouseDrag (const MouseEvent& e) { myDragger.dragComponent (this.self, e); } void mouseDoubleClick (const MouseEvent& e) { self.removeFromDesktop(); } //------------------------------------------------------ Component self; ComponentDragger myDragger; }; //------------------------------------------------------ MyComponent comp ("comp"); void main() { comp.self.centreWithSize (400,300); comp.self.setVisible (!comp.self.isVisible()); comp.self.startTimer (100); }