Esempio n. 1
0
void HadronLabel::mouseDoubleClick(const MouseEvent& e) 
{
    if (use_modal_editor_) {
        
        if (isEditableOnDoubleClick() && ! e.mods.isPopupMenu()) {
            
            ModalComponentManager::Callback* userCallback = 0;
            ScopedPointer<ModalComponentManager::Callback> userCallbackDeleter (userCallback);
            Component::SafePointer<Component> prevFocused (Component::getCurrentlyFocusedComponent());
            Component::SafePointer<Component> prevTopLevel ((prevFocused != 0) ? prevFocused->getTopLevelComponent() : 0);
            
            ScopedPointer <TextEditor> texteditor (createEditorComponent());
            texteditor->setColour(TextEditor::backgroundColourId, Colours::white);
            texteditor->setWantsKeyboardFocus (true);
            texteditor->setAlwaysOnTop (true);
            
            // Find screen position
            Rectangle<int> sr (getBounds ());
            sr.setPosition (getScreenX(), getScreenY());
            int fontheight = static_cast<int>(texteditor->getFont().getHeight()) + 4;
            if (sr.getHeight() > fontheight) {
                sr.translate (0, (sr.getHeight() - fontheight)/2);
                sr.setHeight (fontheight);
            }
            texteditor->setBounds(sr);
            
            texteditor->setText(getText(),false);
            texteditor->setHighlightedRegion (Range <int> (0, getText().length ()));
            texteditor->setVisible (true);
            texteditor->grabKeyboardFocus();
            texteditor->addToDesktop (ComponentPeer::windowIsTemporary, 0);
            
            texteditor->addListener (this);
            texteditor->enterModalState (false);
            texteditor->grabKeyboardFocus();
            
            texteditor->runModalLoop();
            
            if (prevTopLevel != 0)
                prevTopLevel->toFront (true);
            if (prevFocused != 0)
                prevFocused->grabKeyboardFocus();
        }
    }
    else {
        Label::mouseDoubleClick(e);
    }
}
Esempio n. 2
0
 void resized()
 {
     Font font = csPlayerLabel->getFont();
     int width = font.getStringWidth(csPlayerLabel->getText());
     const int offset = 5, fontOffset = 2;
     csPlayerLabel->setBounds(proportionOfWidth(0.17f), proportionOfWidth(0.04f), width, (int)font.getHeight() );
     font.setHeight(16.0000f);
     csPlayerSite->setBounds(0, csPlayerLabel->getHeight() + 20, getWidth(), font.getHeight() + fontOffset);
     csPlayerSource->setBounds(0, csPlayerLabel->getHeight() + 20 + csPlayerSite->getHeight(), getWidth(), font.getHeight() + fontOffset);
     int height = csPlayerLabel->getHeight() + 25 + csPlayerSite->getHeight() + (offset*2);
     csPlayerGroupComponent->setBounds(0, height, getWidth(), 90);
     csPlayerDetailTE->setBounds(fontOffset, height + offset + fontOffset, getWidth() - offset, 80);
     csTeamgroupComponent->setBounds(0, height + 90, getWidth(), 90);
     csTeamTE->setBounds(fontOffset, height + 90 + offset + fontOffset, getWidth() - offset, 80);
     csLicencegroupComponent->setBounds(0, height + 180, getWidth(), 90);
     csLicenceTE->setBounds(fontOffset, height + 180 + offset + fontOffset, getWidth() - offset, 80);
 }