示例#1
0
void FPGAOutput::updateSettings()
{
    removeAllActionListeners();

    GenericProcessor* src;
    GenericProcessor* lastSrc;

    lastSrc = getSourceNode();
    src = getSourceNode();

    while (src != 0)
    {
        lastSrc = src;
        src = lastSrc->getSourceNode();
    }

    if (lastSrc != 0)
    {
        SourceNode* s = (SourceNode*) lastSrc;
        addActionListener(s);
        std::cout << "FPGA Output node communicating with " << lastSrc->getName() << std::endl;
    }
    else
    {
        std::cout << "FPGA Output couldn't find a source" << std::endl;
    }


    //dataThread = (FPGAThread*) s->getThread();
}
示例#2
0
MenuButton::MenuButton()
: Button(), _pressed(false)
{
    //setFrameSize(0);
    addActionListener(this);
    setAlignment(Graphics::LEFT);
}
示例#3
0
MenuButton::MenuButton(const std::string& caption)
: Button(caption), _pressed(false)
{
    //setFrameSize(0);
    addActionListener(this);
    setAlignment(Graphics::LEFT);
}
示例#4
0
GlassCanvas::GlassCanvas() : GlassContainer(), GlassWidget(this) {
	setOpaque(false);
	
	//for GlassWidget
	addActionListener(this);
	addMouseListener(this);
	addFocusListener(this);
	addKeyListener(this);
}
示例#5
0
Button::Button(const std::string &caption, const std::string &actionEventId,
    gcn::ActionListener *listener):
    gcn::Button(caption)
{
    init();
    setActionEventId(actionEventId);

    if (listener)
        addActionListener(listener);
}
示例#6
0
ImageButton::ImageButton() : gcn::Button (), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = NULL;
	setFrameSize(0);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
示例#7
0
ItemContainer::ItemContainer(Inventory *inventory,
                             const std::string &actionEventId,
                             gcn::ActionListener *listener):
    mInventory(inventory),
    mSelectedItemIndex(NO_ITEM),
    mLastSelectedItemId(NO_ITEM),
    mEquipSlotsFilter(NO_ITEM)
{
    if (!actionEventId.empty())
        setActionEventId(actionEventId);

    if (listener && !actionEventId.empty())
        addActionListener(listener);

    if (mInstances == 0)
    {
        mItemPopup = new ItemPopup();
        mItemPopup->setOpaque(false);

        mShowItemInfo = config.getValue("showItemPopups", true);
        mConfigListener = new ItemContainerConfigListener(this);
        config.addListener("showItemPopups", mConfigListener);

        mPopupMenu = new PopupMenu(TRADE);

        ResourceManager *resman = ResourceManager::getInstance();

        mSelImg = resman->getImage("graphics/gui/selection.png");

        if (!mSelImg)
            logger->error("Unable to load selection.png");
    }

    mProtFocusListener = new ProtectedFocusListener();

    mProtFocusListener->blockKey(SDLK_LEFT);
    mProtFocusListener->blockKey(SDLK_RIGHT);
    mProtFocusListener->blockKey(SDLK_UP);
    mProtFocusListener->blockKey(SDLK_DOWN);
    mProtFocusListener->blockKey(SDLK_SPACE);
    mProtFocusListener->blockKey(SDLK_RETURN);

    mInstances++;

    mMaxItems = mInventory->getLastUsedSlot(); // Count from 0, usage from 2

    addFocusListener(mProtFocusListener);
    addFocusListener(this);
    addKeyListener(this);
    addMouseListener(this);
    addWidgetListener(this);

    setFocusable(true);
}
示例#8
0
ImageButton::ImageButton(const std::string &caption) : gcn::Button (caption), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = NULL;
	setFrameSize(0);
	setActionEventId(caption);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
示例#9
0
ImageButton::ImageButton(const std::string &caption, const std::string &icf) : gcn::Button (caption), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = gcn::Image::load(icf.c_str());
	if(icon)
		setSize(icon->getWidth(),icon->getHeight());
	setFrameSize(0);
	setActionEventId(caption);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
示例#10
0
Wellcome::Wellcome():
    Window("Hoşgeldin :)")
{
    setResizable(false);
    setDefaultSize(50, 50, 420, 430);
    loadWindowState();
    setResizable(false);
    ResourceManager *resman = ResourceManager::getInstance();
    mSlide = resman->getImage("graphics/sunular/basla1/g_00.png");

    setVisible(true);
    mNext = new Button("İleri","next",this);
    mPrev = new Button("Geri","prev",this);
    mFinish = new Button("Kapat","close",this);

    mNext->setPosition(205, getHeight()- mNext->getHeight() - getTitleBarHeight());
    mNext->setWidth(100);
    add(mNext);

    mPrev->setPosition(105,getHeight()- mPrev->getHeight() - getTitleBarHeight());
    mPrev->setWidth(100);
    add(mPrev);

    mFinish->setPosition(330,0);
    mFinish->setWidth(100);
    add(mFinish);

    mAgain = new CheckBox("Girişte göster.",false);
    mAgain->setPosition(mNext->getX() + mNext->getWidth() + 2 ,getHeight()- mAgain->getHeight() - getTitleBarHeight()-5);
    add(mAgain);

    mList.push_back("graphics/sunular/basla1/g_00.png");
    mList.push_back("graphics/sunular/basla1/g_01.png");
    mList.push_back("graphics/sunular/basla1/g_02.png");
    mList.push_back("graphics/sunular/basla1/g_03.png");
    mList.push_back("graphics/sunular/basla1/g_04.png");
    mList.push_back("graphics/sunular/basla1/g_05.png");
    mList.push_back("graphics/sunular/basla1/g_06.png");
    mList.push_back("graphics/sunular/basla1/g_07.png");
    mList.push_back("graphics/sunular/basla1/g_08.png");
//    mList.push_back("graphics/sunular/basla1/g_09.png");
//    mList.push_back("graphics/sunular/basla1/g_10.png");
    mCurrentSlide = 0;
    current_npc = 0;
    NPC::isTalking = false;
    addActionListener(this);
}
示例#11
0
ToggleButton::ToggleButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption, const std::string& group):
    Button(),
    m_upImage(up_file),
    m_downImage(down_file),
    m_hoverImage(hover_file),
    x_downoffset(0),
    y_downoffset(0),
    m_group(group) {

    m_hoverImage = hover_file;
    setFrameSize(0);
    setGroup(m_group);
    adjustSize();
    mCaption = caption;
    m_toggled = false;

    addActionListener(this);
}
示例#12
0
void AccessClass::setUIComponent(UIComponent* ui_)
{

    ui = ui_;

    ev = ui->getEditorViewport();
    dv = ui->getDataViewport();
    pl = ui->getProcessorList();
    pg = ui->getProcessorGraph();
    cp = ui->getControlPanel();
    mc = ui->getMessageCenter();
    ac = ui->getAudioComponent();
    gv = ui->getGraphViewer();

    addActionListener(mc);

    updateChildComponents();
}
示例#13
0
void SliderList::postInit(ActionListener *const listener,
                          const std::string &eventId)
{
    mPrevEventId = eventId + "_prev";
    mNextEventId = eventId + "_next";

    mButtons[0] = new Button(this, "<", mPrevEventId, this);
    mButtons[1] = new Button(this, ">", mNextEventId, this);

    add(mButtons[0]);
    add(mLabel);
    add(mButtons[1]);

    if (!eventId.empty())
        setActionEventId(eventId);

    if (listener)
        addActionListener(listener);

    updateLabel();
    addMouseListener(this);
}
示例#14
0
GlassWindow::GlassWindow() : gcn::Window(), GlassWidget(this), wmhandler() {
	titleBar = gcn::Image::load("/gui/standard/bar_gradient.png");
	mTitleBarHeight = titleBar->getHeight()+3;
	titleBarContainer._setParent(this);
	setAlignment(gcn::Graphics::LEFT);
	shadeState = SH_OPEN;
	titleVisible = true;
	mGradient = false;
	frame = NULL;
	mBorder = 0;
	
	setBackgroundColor(gcn::Color(213,213,213));
	
	wmhandler.setWindow(this);
	
	buildTitleBar(WT_ALL);
	
	//for GlassWidget
	addActionListener(this);
	addFocusListener(this);
	gui->addGlobalKeyListener(this);
}
示例#15
0
ListBox::ListBox(gcn::ListModel *listModel, const std::string &actionEventId,
                 gcn::ActionListener *listener):
    gcn::ListBox(listModel)
{
    if (!actionEventId.empty())
        setActionEventId(actionEventId);

    if (listener && !actionEventId.empty())
        addActionListener(listener);

    mProtFocusListener = new ProtectedFocusListener();

    addFocusListener(mProtFocusListener);

    mProtFocusListener->blockKey(SDLK_LEFT);
    mProtFocusListener->blockKey(SDLK_RIGHT);
    mProtFocusListener->blockKey(SDLK_UP);
    mProtFocusListener->blockKey(SDLK_DOWN);
    mProtFocusListener->blockKey(SDLK_SPACE);
    mProtFocusListener->blockKey(SDLK_RETURN);
    mProtFocusListener->blockKey(SDLK_HOME);
    mProtFocusListener->blockKey(SDLK_END);
}
示例#16
0
SoundCfg::SoundCfg ( GuiMain *gMain ) : GuiObject(gMain)
{
	t_config *p_config = config_get_ptr();

	setVisible ( false );
	setCaption ("Sound Settings");

	/*
	 * Setup all of our widgets
	 */
	mProfileDec.setCaption ( "Profile" );
	mDescriptionLabel.setCaption ("Description");
	mRename.setCaption ("Rename");
	mSaveAs.setCaption ("Save As");
	mDefault.setCaption ("Use as Default");
	mProfile.setListModel ( &mProfileList );

	mOk.setCaption ("Ok");
	mCancel.setCaption ("Cancel");

	mSoundDec.setCaption ( "" );
	mSoundEnabled.setCaption ("Enable Sound");
	mFilterEnabled.setCaption ("Enable Filter");
	mFreqLabel.setCaption ("Frequency");
	mFreq.setListModel ( &mFreqList );
	mSamplesLabel.setCaption("Samples");
	mSamples.setListModel ( &mSamplesList );

	mBass.setScale (0, 123);
	mTreble.setScale (-200,5);

	mBassLabel.setCaption ("Bass (Hz)");
	mTrebleLabel.setCaption ("Treble (db)");

	mBassValue.setCaption ("0");
	mTrebleValue.setCaption ("0");

	/*
	 * Create Callbacks and assign
	 */
	addActionListener ( this );

	mDescriptionBox.addMouseListener ( this );
	mProfile.addActionListener ( this );
	mRename.addActionListener ( this );
	mSaveAs.addActionListener ( this );
	mOk.addActionListener ( this );
	mCancel.addActionListener ( this );
	mDefault.addActionListener ( this );
	mSoundEnabled.addActionListener ( this );
	mFilterEnabled.addActionListener ( this );
	mFreq.addActionListener ( this );
	mSamples.addActionListener ( this );

	mRename.setActionEventId ( "mRename" );
	mSaveAs.setActionEventId ( "mSaveAs" );
	mOk.setActionEventId ( "mOk" );
	mCancel.setActionEventId ( "mCancel" );
	mDefault.setActionEventId ( "mDirty" );
	mSoundEnabled.setActionEventId ( "mDirty" );
	mFilterEnabled.setActionEventId ( "mFilterEnabled" );
	mFreq.setActionEventId ( "mDirty" );
	mSamples.setActionEventId ( "mDirty" );
	mProfile.setActionEventId ( "mProfile" );

	mBass.addActionListener ( this );
	mTreble.addActionListener ( this );

	mBass.setActionEventId ( "mBass" );
	mTreble.setActionEventId ( "mTreble" );

	/*
	 * Size and place our widgets
	 */
	add ( &mProfileDec );
	add ( &mSoundDec );
	add ( &mProfile );
	add ( &mDescriptionLabel );
	add ( &mDescriptionBox );
	add ( &mRename );
	add ( &mSaveAs );

	add ( &mOk );
	add ( &mCancel );

	add ( &mDefault );
	add ( &mSoundEnabled );
	add ( &mFilterEnabled );
	add ( &mFreq );
	add ( &mFreqLabel );
	add ( &mSamples );
	add ( &mSamplesLabel );

	add ( &mBass );
	add ( &mTreble );

	add ( &mBassLabel );
	add ( &mTrebleLabel );

	add ( &mBassValue );
	add ( &mTrebleValue );

	setDimension ( mGuiMain->getRectangle(3,5,73,15) );

	mProfile.setDimension ( mGuiMain->getRectangle(1,1.2,50,4) );
	mDescriptionLabel.setDimension ( mGuiMain->getRectangle(1,2.8,50,4) );
	mDescriptionBox.setDimension ( mGuiMain->getRectangle(1,3.8,50,4) );
	mDefault.setDimension ( mGuiMain->getRectangle(53,3.8,14,1) );
	mRename.setDimension ( mGuiMain->getRectangle(53,1.2,3,1) );
	mSaveAs.setDimension ( mGuiMain->getRectangle(61.5,1.2,3,1) );
	mProfileDec.setDimension ( mGuiMain->getRectangle(0.5,0.0,71,5.5) );

	mOk.setDimension ( mGuiMain->getRectangle(30,12,3,1) );
	mCancel.setDimension ( mGuiMain->getRectangle(37,12,6,1) );

	mSoundDec.setDimension ( mGuiMain->getRectangle(0.5,5.5,71,6) );
	mSoundEnabled.setDimension ( mGuiMain->getRectangle(5,6.5,6,1) );
	mFilterEnabled.setDimension ( mGuiMain->getRectangle(33,6.5,6,1) );
	mFreqLabel.setDimension ( mGuiMain->getRectangle(5,8.5,12,1) );
	mFreq.setDimension ( mGuiMain->getRectangle(16,8.5,10,1) );
	mSamplesLabel.setDimension ( mGuiMain->getRectangle(5,10,12,1) );
	mSamples.setDimension ( mGuiMain->getRectangle(16,10,10,1) );

	mBassLabel.setDimension ( mGuiMain->getRectangle(33,8.5,4,1) );
	mBass.setDimension ( mGuiMain->getRectangle(44,8.5,14,1) );
	mBassValue.setDimension ( mGuiMain->getRectangle(58.5,8.5,4,1) );
	mTrebleLabel.setDimension ( mGuiMain->getRectangle(33,10,6,1) );
	mTreble.setDimension ( mGuiMain->getRectangle(44,10,14,1) );
	mTrebleValue.setDimension ( mGuiMain->getRectangle(58.5,10,6,1) );

	mProfile.adjustHeight();
	mDescriptionLabel.adjustSize();
	mDescriptionBox.adjustHeight();
	mRename.adjustSize();
	mSaveAs.adjustSize();
	mOk.adjustSize();
	mCancel.adjustSize();

	mDefault.adjustSize();
	mSoundEnabled.adjustSize();
	mFilterEnabled.adjustSize();
	mFreqLabel.adjustSize();
	mSamplesLabel.adjustSize();

	mBassLabel.adjustSize();
	mTrebleLabel.adjustSize();

	mBassValue.adjustSize();
	mTrebleValue.adjustSize();

	/*
	 * Initialize the list
	 */
	initGroupControls();
	initProfileList();

	/*
	 * FIXME: Enable this when we have a sound filter in place
	 */
	mFilterEnabled.setVisible ( false );
}
示例#17
0
	UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_)
: mainWindow(mainWindow_), processorGraph(pgraph), audio(audio_)

{

	processorGraph->createDefaultNodes();

	messageCenterEditor = (MessageCenterEditor*) processorGraph->getMessageCenter()->createEditor();
	addActionListener(messageCenterEditor);
	addAndMakeVisible(messageCenterEditor);
	std::cout << "Created message center." << std::endl;

	infoLabel = new InfoLabel();
	std::cout << "Created info label." << std::endl;

	graphViewer = new GraphViewer();
	std::cout << "Created graph viewer." << std::endl;

	dataViewport = new DataViewport();
	addChildComponent(dataViewport);
	dataViewport->addTabToDataViewport("Info", infoLabel,0);
	dataViewport->addTabToDataViewport("Graph", graphViewer,0);

	std::cout << "Created data viewport." << std::endl;

	editorViewport = new EditorViewport();

	addAndMakeVisible(editorViewport);

	std::cout << "Created filter viewport." << std::endl;

	editorViewportButton = new EditorViewportButton(this);
	addAndMakeVisible(editorViewportButton);

	controlPanel = new ControlPanel(processorGraph, audio);
	addAndMakeVisible(controlPanel);

	std::cout << "Created control panel." << std::endl;

	processorList = new ProcessorList();
	processorListViewport.setViewedComponent(processorList,false);
	processorListViewport.setScrollBarsShown(true,false);
	addAndMakeVisible(&processorListViewport);
	processorList->setVisible(true);
	processorList->setBounds(0,0,195,processorList->getTotalHeight());
	std::cout << "Created filter list." << std::endl;

	pluginManager = new PluginManager();
	std::cout << "Created plugin manager" << std::endl;

	setBounds(0,0,500,400);

	AccessClass::setUIComponent(this);

	getPluginManager()->loadAllPlugins();

	getProcessorList()->fillItemList();
	controlPanel->updateChildComponents();

	processorGraph->updatePointers(); // needs to happen after processorGraph gets the right pointers

#if JUCE_MAC
	MenuBarModel::setMacMainMenu(this);
	mainWindow->setMenuBar(0);
#else
	mainWindow->setMenuBar(this);
#endif

}
示例#18
0
UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_)
    : mainWindow(mainWindow_), processorGraph(pgraph), audio(audio_)

{

    processorGraph->setUIComponent(this);

    infoLabel = new InfoLabel();

    dataViewport = new DataViewport();
    addChildComponent(dataViewport);
    dataViewport->addTabToDataViewport("Info", infoLabel,0);

    std::cout << "Created data viewport." << std::endl;

    editorViewport = new EditorViewport();

    addAndMakeVisible(editorViewport);

    std::cout << "Created filter viewport." << std::endl;

    editorViewportButton = new EditorViewportButton(this);
    addAndMakeVisible(editorViewportButton);

    controlPanel = new ControlPanel(processorGraph, audio);
    addAndMakeVisible(controlPanel);

    std::cout << "Created control panel." << std::endl;

    processorList = new ProcessorList();
    addAndMakeVisible(processorList);

    std::cout << "Created filter list." << std::endl;

    messageCenter = new MessageCenter();
    addActionListener(messageCenter);
    addAndMakeVisible(messageCenter);

    std::cout << "Created message center." << std::endl;

    setBounds(0,0,500,400);

    std::cout << "Component width = " << getWidth() << std::endl;
    std::cout << "Component height = " << getHeight() << std::endl;

    std::cout << "UI component data viewport: " << dataViewport << std::endl;

    std::cout << "Finished UI stuff." << std::endl << std::endl << std::endl;

    processorGraph->setUIComponent(this);
    processorGraph->updatePointers(); // needs to happen after processorGraph gets the right pointers
    processorList->setUIComponent(this);
    editorViewport->setUIComponent(this);
    dataViewport->setUIComponent(this);
    controlPanel->getAudioEditor()->setUIComponent(this);
    controlPanel->setUIComponent(this);

    //processorGraph->sendActionMessage("Test.");

    //processorGraph->loadState();

#if JUCE_MAC
    MenuBarModel::setMacMainMenu(this);
    mainWindow->setMenuBar(0);
#else
    mainWindow->setMenuBar(this);
#endif

    //getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));

}
示例#19
0
Convert::Convert ( GuiMain *gMain ) : GuiObject(gMain)
{
	setVisible ( false );
	setCaption ( "Convert" );

	/*
	 * Initialize Captions
	 */
	mLabel.setCaption ( "File" );
	mLabel2.setCaption ( "Name" );
	mNameLabel.setCaption ( "Palette" );
	mBrowse.setCaption ( "Browse" );
	mOk.setCaption ("Convert");
	mCancel.setCaption ("Cancel");

	/*
	 * Create Callbacks and assign
	 */
	addActionListener ( this );

	mOk.addActionListener ( this );
	mOk.setActionEventId ( "mOk" );

	mCancel.addActionListener ( this );
	mCancel.setActionEventId ( "mCancel" );

	mBrowse.addActionListener ( this );
	mBrowse.setActionEventId ( "mBrowse" );

	mName.setListModel ( &mNameList );

	/*
	 * Size and place our widgets
	 */
	add ( &mLabel );
	add ( &mLabel2 );
	add ( &mNameLabel );
	add ( &mFile );
	add ( &mFile2 );
	add ( &mName );
	add ( &mBrowse );
	add ( &mOption );
	add ( &mOption2 );

	add ( &mOk );
	add ( &mCancel );

	setDimension ( mGuiMain->getRectangle(5,9,70,11.5) );

	mLabel.setDimension ( mGuiMain->getRectangle(1,1,30,1) );
	mLabel2.setDimension ( mGuiMain->getRectangle(1,3,30,1) );
	mFile.setDimension ( mGuiMain->getRectangle(7,1,52,1) );
	mFile2.setDimension ( mGuiMain->getRectangle(7,3,52,1) );
	mBrowse.setDimension ( mGuiMain->getRectangle(61,1,6,1) );
	mOption.setDimension ( mGuiMain->getRectangle(7,5,50,1) );
	mOption2.setDimension ( mGuiMain->getRectangle(7,6.3,50,1) );
	mNameLabel.setDimension ( mGuiMain->getRectangle(1,1,30,1) );
	mName.setDimension ( mGuiMain->getRectangle(8,1,51,1) );

	mOk.setDimension ( mGuiMain->getRectangle(24,8,3,1) );
	mCancel.setDimension ( mGuiMain->getRectangle(37,8,3,1) );

	mLabel.adjustSize();
	mLabel2.adjustSize();
	mNameLabel.adjustSize();
	mBrowse.adjustSize();
	mFile.adjustHeight();
	mFile2.adjustHeight();
	mName.adjustHeight();

	mOk.adjustSize();
	mCancel.adjustSize();
}
示例#20
0
DropDown::DropDown(const Widget2 *const widget,
                   ListModel *const listModel,
                   const bool extended,
                   const Modal modal,
                   ActionListener *const listener,
                   const std::string &eventId) :
    ActionListener(),
    BasicContainer(widget),
    KeyListener(),
    MouseListener(),
    FocusListener(),
    SelectionListener(),
    mPopup(CREATEWIDGETR(PopupList, this, listModel, extended, modal)),
    mShadowColor(getThemeColor(ThemeColorId::DROPDOWN_SHADOW)),
    mHighlightColor(getThemeColor(ThemeColorId::HIGHLIGHT)),
    mPadding(1),
    mImagePadding(2),
    mSpacing(0),
    mFoldedUpHeight(0),
    mSelectionListeners(),
    mExtended(extended),
    mDroppedDown(false),
    mPushed(false),
    mIsDragged(false)
{
    mAllowLogic = false;
    mFrameSize = 2;
    mForegroundColor2 = getThemeColor(ThemeColorId::DROPDOWN_OUTLINE);

    mPopup->setHeight(100);

    // Initialize graphics
    if (instances == 0 && theme)
    {
        // Load the background skin
        for (int i = 0; i < 2; i ++)
        {
            Skin *const skin = theme->load(dropdownFiles[i], "dropdown.xml");
            if (skin)
            {
                if (!i)
                    mSkin = skin;
                const ImageRect &rect = skin->getBorder();
                for (int f = 0; f < 2; f ++)
                {
                    if (rect.grid[f])
                    {
                        rect.grid[f]->incRef();
                        buttons[f][i] = rect.grid[f];
                        buttons[f][i]->setAlpha(mAlpha);
                    }
                    else
                    {
                        buttons[f][i] = nullptr;
                    }
                }
                if (i)
                    theme->unload(skin);
            }
            else
            {
                for (int f = 0; f < 2; f ++)
                    buttons[f][i] = nullptr;
            }
        }

        // get the border skin
        theme->loadRect(skinRect, "dropdown_background.xml", "");
    }

    instances++;

    setWidth(100);
    setFocusable(true);
    setListModel(listModel);

    if (mPopup->getSelected() < 0)
        mPopup->setSelected(0);

    addMouseListener(this);
    addKeyListener(this);
    addFocusListener(this);

    adjustHeight();
//    mPopup->setForegroundColorAll(getThemeColor(ThemeColorId::DROPDOWN),
//        getThemeColor(ThemeColorId::DROPDOWN_OUTLINE));
    mForegroundColor = getThemeColor(ThemeColorId::DROPDOWN);
    mForegroundColor2 = getThemeColor(ThemeColorId::DROPDOWN_OUTLINE);

    if (!eventId.empty())
        setActionEventId(eventId);

    if (listener)
        addActionListener(listener);

    mPopup->adjustSize();

    if (mSkin)
    {
        mSpacing = mSkin->getOption("spacing");
        mFrameSize = CAST_U32(mSkin->getOption("frameSize"));
        mPadding = mSkin->getPadding();
        mImagePadding = mSkin->getOption("imagePadding");
    }
    adjustHeight();
}
示例#21
0
BiosCfg::BiosCfg ( GuiMain *gMain ) : GuiObject(gMain)
{
	setVisible ( false );
	setCaption ( "BIOS Files" );

	/*
	 * Init Captions
	 */
	m5200Label.setCaption ( "Atari 5200 BIOS" );
	m5200Browse.setCaption ( "Browse" );

	m800Label.setCaption ( "Atari 800 BIOS" );
	m800Browse.setCaption ( "Browse" );

	mXLLabel.setCaption ( "Atari XL/XE BIOS" );
	mXLBrowse.setCaption ( "Browse" );

	mBasicLabel.setCaption ( "Atari BASIC Cart" );
	mBasicBrowse.setCaption ( "Browse" );

	mOk.setCaption ("Ok");
	mCancel.setCaption ("Cancel");

	/*
	 * Create Callbacks and assign
	 */
	addActionListener ( this );

	mOk.addActionListener ( this );
	mOk.setActionEventId ( "mOk" );

	mCancel.addActionListener ( this );
	mCancel.setActionEventId ( "mCancel" );

	m5200Browse.addActionListener ( this );
	m5200Browse.setActionEventId ( "m5200Browse" );

	m800Browse.addActionListener ( this );
	m800Browse.setActionEventId ( "m800Browse" );

	mXLBrowse.addActionListener ( this );
	mXLBrowse.setActionEventId ( "mXLBrowse" );

	mBasicBrowse.addActionListener ( this );
	mBasicBrowse.setActionEventId ( "mBasicBrowse" );

	m5200File.addMouseListener ( this );
	m800File.addMouseListener ( this );
	mXLFile.addMouseListener ( this );
	mBasicFile.addMouseListener ( this );

	/*
	 * Size and place our widgets
	 */
	add ( &m5200Label );
	add ( &m5200File );
	add ( &m5200Browse );

	add ( &m800Label );
	add ( &m800File );
	add ( &m800Browse );

	add ( &mXLLabel );
	add ( &mXLFile );
	add ( &mXLBrowse );

	add ( &mBasicLabel );
	add ( &mBasicFile );
	add ( &mBasicBrowse );

	add ( &mOk );
	add ( &mCancel );

	setDimension ( mGuiMain->getRectangle(2,8,76,12) );

	m5200Label.setDimension ( mGuiMain->getRectangle(1,1,30,1) );
	m5200File.setDimension ( mGuiMain->getRectangle(16,1,50,1) );
	m5200Browse.setDimension ( mGuiMain->getRectangle(67,1,6,1) );

	m800Label.setDimension ( mGuiMain->getRectangle(1,3,30,1) );
	m800File.setDimension ( mGuiMain->getRectangle(16,3,50,1) );
	m800Browse.setDimension ( mGuiMain->getRectangle(67,3,6,1) );

	mXLLabel.setDimension ( mGuiMain->getRectangle(1,5,30,1) );
	mXLFile.setDimension ( mGuiMain->getRectangle(16,5,50,1) );
	mXLBrowse.setDimension ( mGuiMain->getRectangle(67,5,6,1) );

	mBasicLabel.setDimension ( mGuiMain->getRectangle(1,7,30,1) );
	mBasicFile.setDimension ( mGuiMain->getRectangle(16,7,50,1) );
	mBasicBrowse.setDimension ( mGuiMain->getRectangle(67,7,6,1) );

	mOk.setDimension ( mGuiMain->getRectangle(32,9,3,1) );
	mCancel.setDimension ( mGuiMain->getRectangle(37,9,3,1) );

	m5200Label.adjustSize();
	m800Label.adjustSize();
	mXLLabel.adjustSize();
	mBasicLabel.adjustSize();
	m5200Browse.adjustSize();
	m800Browse.adjustSize();
	mXLBrowse.adjustSize();
	mBasicBrowse.adjustSize();
	m5200File.adjustHeight();
	m800File.adjustHeight();
	mXLFile.adjustHeight();
	mBasicFile.adjustHeight();

	mOk.adjustSize();
	mCancel.adjustSize();
}
示例#22
0
DropDown::DropDown(gcn::ListModel *listModel, gcn::ActionListener* listener,
                   std::string eventId):
    gcn::DropDown::DropDown(listModel,
                            new ScrollArea,
                            new ListBox(listModel))
{
    setFrameSize(2);

    // Initialize graphics
    if (instances == 0)
    {
        // Load the background skin

        // Get the button skin
        buttons[1][0] = Theme::getImageFromTheme("vscroll_up_default.png");
        buttons[0][0] = Theme::getImageFromTheme("vscroll_down_default.png");
        buttons[1][1] = Theme::getImageFromTheme("vscroll_up_pressed.png");
        buttons[0][1] = Theme::getImageFromTheme("vscroll_down_pressed.png");

        if (buttons[0][0])
            buttons[0][0]->setAlpha(mAlpha);
        if (buttons[0][1])
            buttons[0][1]->setAlpha(mAlpha);
        if (buttons[1][0])
            buttons[1][0]->setAlpha(mAlpha);
        if (buttons[1][1])
            buttons[1][1]->setAlpha(mAlpha);

        // get the border skin
        Image *boxBorder = Theme::getImageFromTheme("deepbox.png");
        if (boxBorder)
        {
            int gridx[4] = {0, 3, 28, 31};
            int gridy[4] = {0, 3, 28, 31};
            int a = 0, x, y;

            for (y = 0; y < 3; y++)
            {
                for (x = 0; x < 3; x++)
                {
                    skin.grid[a] = boxBorder->getSubImage(gridx[x], gridy[y],
                                                          gridx[x + 1] -
                                                          gridx[x] + 1,
                                                          gridy[y + 1] -
                                                          gridy[y] + 1);
                    if (skin.grid[a])
                        skin.grid[a]->setAlpha(mAlpha);
                    a++;
                }
            }

            boxBorder->decRef();
        }
    }

    instances++;

    mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
    mShadowColor = Theme::getThemeColor(Theme::DROPDOWN_SHADOW);
    setForegroundColor(Theme::getThemeColor(Theme::TEXT));

    if (!eventId.empty())
        setActionEventId(eventId);

    if (listener)
        addActionListener(listener);
}
示例#23
0
MediaCreate::MediaCreate ( GuiMain *gMain ) : GuiObject(gMain)
{
	int i;

	setVisible ( false );
	setCaption ( "Media Creation" );

	/*
	 * Init Captions
	 */
	mCreateCasLabel.setCaption ( "Cassette" );
	mCreateCasDescLabel.setCaption ( "Description" );
	mCreateCasBrowse.setCaption ( "Create" );

	mCreateDiskLabel.setCaption ( "Disk" );
	mCreateDiskTypeLabel.setCaption ( "Sector Size / Boot Type" );
	mCreateDiskSectorsLabel.setCaption ( "Sectors" );
	mCreateDiskSectors.setText ( "720" );
	mCreateDiskBrowse.setCaption ( "Create" );
	mCreateDiskType.setListModel ( &mCreateDiskList );

	mCreateDiskList.deleteAll();
	mCreateDiskList.addElement ( "128 / 128", SIO_DSK_128, 0 );
	mCreateDiskList.addElement ( "256 / 128", SIO_DSK_256_BOOT_128, 0 );
	mCreateDiskList.addElement ( "256 / 256", SIO_DSK_256_BOOT_256, 0 );
	mCreateDiskList.addElement ( "256 / SIOPC", SIO_DSK_256_BOOT_SIO2PC, 0 );

	mOk.setCaption ("Ok");
	mCancel.setCaption ("Cancel");

	/*
	 * Create Callbacks and assign
	 */
	addActionListener ( this );

	mOk.addActionListener ( this );
	mOk.setActionEventId ( "mOk" );

	mCancel.addActionListener ( this );
	mCancel.setActionEventId ( "mCancel" );

	mCreateCasBrowse.addActionListener ( this );
	mCreateCasBrowse.setActionEventId ( "mCreateCasBrowse" );
	mCreateDiskBrowse.addActionListener ( this );
	mCreateDiskBrowse.setActionEventId ( "mCreateDiskBrowse" );

	/*
	 * Size and place our widgets
	 */
	add ( &mCreateCasLabel );
	add ( &mCreateCasDescLabel );
	add ( &mCreateCasDesc );
	add ( &mCreateCasBrowse );

	add ( &mCreateDiskLabel );
	add ( &mCreateDiskTypeLabel );
	add ( &mCreateDiskType );
	add ( &mCreateDiskSectorsLabel );
	add ( &mCreateDiskSectors );
	add ( &mCreateDiskBrowse );

	add ( &mOk );
	add ( &mCancel );

	setDimension ( mGuiMain->getRectangle(3,5.8,64,12.5) );

	i = -3;
	mCreateCasLabel.setDimension ( mGuiMain->getRectangle(1,2.7+1.7*(i+5),5,1) );
	mCreateCasDescLabel.setDimension ( mGuiMain->getRectangle(10,2.7+1.7*(i+4.2),5,1) );
	mCreateCasDesc.setDimension ( mGuiMain->getRectangle(10,2.7+1.7*(i+5),38,1) );
	mCreateCasBrowse.setDimension ( mGuiMain->getRectangle(50,2.7+1.7*(i+5),6,1) );

	mCreateDiskLabel.setDimension ( mGuiMain->getRectangle(1,2.7+1.7*(i+3.0),5,1) );
	mCreateDiskTypeLabel.setDimension ( mGuiMain->getRectangle(10,2.7+1.7*(i+2.2),5,1) );
	mCreateDiskType.setDimension ( mGuiMain->getRectangle(10,2.7+1.7*(i+3.0),14,1) );
	mCreateDiskSectorsLabel.setDimension ( mGuiMain->getRectangle(40,2.7+1.7*(i+2.2),7,1) );
	mCreateDiskSectors.setDimension ( mGuiMain->getRectangle(40,2.7+1.7*(i+3.0),8,1) );
	mCreateDiskBrowse.setDimension ( mGuiMain->getRectangle(50,2.7+1.7*(i+3.0),6,1) );

	mOk.setDimension ( mGuiMain->getRectangle(26,9,3,1) );
	mCancel.setDimension ( mGuiMain->getRectangle(31,9,3,1) );

	mCreateCasLabel.adjustSize();
	mCreateCasDescLabel.adjustSize();
	mCreateCasDesc.adjustHeight();
	mCreateCasBrowse.adjustSize();

	mCreateDiskLabel.adjustSize();
	mCreateDiskTypeLabel.adjustSize();
	mCreateDiskType.adjustHeight();
	mCreateDiskSectorsLabel.adjustSize();
	mCreateDiskSectors.adjustHeight();
	mCreateDiskBrowse.adjustSize();

	mOk.adjustSize();
	mCancel.adjustSize();
}