Esempio n. 1
0
void axVolumeMeter::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);
    
    gc->SetColor(*_currentColor, _bgAlpha);
    gc->DrawRectangle(rect0);
    
    double nSeparation = 25.0;
    

    for(int i = 0; i < int(nSeparation); i++)
    {
        if(i > (1.0 - _value) * nSeparation)
        {
            // Red part.
            if(i < 7)
            {
                gc->SetColor(axColor(1.0 - (i-5.0) / 7.0, i / 7.0, 0.0, 0.6));
                gc->DrawRectangle(axRect(axPoint(1, i * rect.size.y / nSeparation), axSize(rect.size.x - 2, rect.size.y / nSeparation)));
            }
            // Green part.
            else
            {
                gc->SetColor(axColor(0.0, 1.0, 0.0, 0.6));
                gc->DrawRectangle(axRect(axPoint(1, i * rect.size.y / nSeparation), axSize(rect.size.x - 2, rect.size.y / nSeparation)));
            }
        }
    }
    
    gc->SetColor(_info.contourColor, _bgAlpha);
    gc->DrawRectangleContour(rect0);
}
Esempio n. 2
0
    myEditor(axFormat* aPlugin, axContext* aContext, axRect aRect, int aWinFlags)
    : axEditor(aPlugin,aContext,aRect,aWinFlags)
      {
        appendWidget( w_MainPanel = new wdgPanel(this,NULL_RECT,wa_Client) );

        w_MainPanel->appendWidget( sb1 = new mySB(this,axRect( 100,100,200,200),wa_Left) );

        //sb1->appendWidget( new myWidget(this,NULL_RECT,wa_Client) );
        //sb2->appendWidget( new myWidget(this,NULL_RECT,wa_Client) );

        wdgPanel* pan1;
        sb1->appendWidget( pan1 = new wdgPanel(this,axRect(0,300),wa_Top) );

        for (int i=0; i<50; i++)
        {
          int x = axRandomInt(199);
          int y = axRandomInt(199);
          int w = axRandomInt(100);
          int h = axRandomInt(100);
          pan1->appendWidget( new wdgButton(this,axRect(x,y,w,h),wa_StackedHoriz,false,"off","on") );
        }

        //sb1->appendWidget( b1 = new wdgButtons(this,axRect(0,200),wa_Top) );

        doRealign();
      }
Esempio n. 3
0
File: main.cpp Progetto: EQ4/axLib
int main(int argc, char* argv[])
{
	string path;
	// cout << "TEST" << endl;
	// if(string(argv[0]) == string("main"))
	// {
		path = argv[0];
	// }

	axApp app(axSize(500, 530));
	SetNoBorder(&app);

	TitleBar* titlebar = new TitleBar(&app, nullptr, axRect(0, 0, 500, 530));

	FileDialog* file_dialog = new FileDialog(&app, nullptr, 
								  axRect(3, 30, 494, 497), path);


	
	
	// file_dialog->Reparent(titlebar, axPoint(0, 0));


	// app.GetCore();
	// XReparentWindow(dpy, (Window)win, parent, 3, 30);

	// Window win = static_cast<axCoreX11*>(app->GetCore())->GetWindow();
	// Display* dpy = static_cast<axCoreX11*>(app->GetCore())->GetDisplay();

	app.MainLoop();

	return 0;
}
Esempio n. 4
0
void axToggle::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(*_currentColor);
	gc->DrawRectangle(rect0);

	if (_btnImg->IsImageReady())
	{
        if (IsFlag(Flags::SINGLE_IMG, _flags))
		{
			gc->DrawImageResize(_btnImg, axPoint(0, 0), rect.size, 1.0);
		}
		else
		{
            axPoint pos(0, _nCurrentImg * _btnImg->GetSize().y / 4);
            axSize size(_btnImg->GetSize().x, _btnImg->GetSize().y / 4);
            gc->DrawPartOfImageResize(_btnImg, pos, size,
                                      axRect(axPoint(0, 0), GetRect().size));
		}
	}

	if_not_empty(_label)
	{
		gc->SetColor(_info.font_color, 1.0);
		gc->SetFontSize(12);
		gc->DrawStringAlignedCenter(_label, rect0);
	}

	gc->SetColor(_info.contour);
	gc->DrawRectangleContour(axRect(axPoint(0, 0), rect.size));
}
Esempio n. 5
0
File: main.cpp Progetto: EQ4/axLib
void MidiSequencer::AddNewTrack(const string& trackName, Audio* audio, int num)
{
	if(_midiTracks.size() == 0)
	{
		_midiTracks.push_back(new MidiTrack(this,
											axRect(axPoint(0, 20), 
											_trackSize), 
											trackName, audio, num));

		SetSize(axSize(GetRect().size.x, 
					   _midiTracks[_midiTracks.size() - 1]->GetBottomLeftPosition().y));

	}
	else
	{
		_midiTracks.push_back(new MidiTrack(this,
											axRect(GetNextTrackPosition(),
											_trackSize),
											trackName, audio, num));

		SetSize(axSize(GetRect().size.x,
			_midiTracks[_midiTracks.size() - 1]->GetBottomLeftPosition().y));
	}

	function<void(int)> min_fct(GetOnChangeTrackHeight());
	MidiTrackEvents evt(min_fct);
	_midiTracks[_midiTracks.size() - 1]->SetEvent(evt);
}
Esempio n. 6
0
File: axGrid.cpp Progetto: EQ4/axLib
void axGrid::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(_info.normal, 1.0);
	gc->DrawRectangle(rect0);

	gc->SetColor(_info.contour, 1.0);

	int y = 0;
	glLineWidth(1.0);
	for(int j = 0; j <= _dimension.y; j++)
	{
		int y = (double(j) / _dimension.y) * rect.size.y;
		gc->DrawLine(axPoint(0, y), axPoint(rect.size.x, y));
	}

	int x = 0;
	for(int i = 0; i <= _dimension.x; i++)
	{
		int x = (double(i) / _dimension.x) * rect.size.x;
		gc->DrawLine(axPoint(x, 0), axPoint(x, rect.size.y));
	}

	axSize element_size(1.0 / _dimension.x * rect.size.x - 1, 
						1.0 / _dimension.y * rect.size.y - 1);
	for(int j = 0;j < _dimension.y; j++)
	{
		for(int i = 0; i < _dimension.x; i++)
		{
			if(_gridElements[j][i].on)
			{
				gc->SetColor(_gridElements[j][i].color);

				axSize elem_size(floor((double(i+1)/ _dimension.x * rect.size.x)) - 
								 floor((double(i) / _dimension.x * rect.size.x)) - 1,
								1.0 / _dimension.y * rect.size.y - 1);
				gc->DrawRectangle(axRect(_gridElements[j][i].position, elem_size));
			}
		}
	}



	//_selectedElement
	gc->SetColor(axColor(0.0, 0.0, 1.0));
	//glLineWidth(4.0);
	gc->DrawRectangleContour(axRect(GetPositionOfElement(_selectedElement), element_size), 2);

	// glLineWidth(1.0);

	// gc->DrawCircle(axPoint(50, 50), 10, 500);

}
Esempio n. 7
0
 myEditor(axFormat* aPlugin, axContext* aContext, axRect aRect, int aWinFlags)
 : axEditor(aPlugin,aContext,aRect,aWinFlags)
 {
   appendWidget( panel = new wdgPanel(this,NULL_RECT,wa_Client));
     panel->appendWidget( scroll = new wdgScrollBox(this,axRect(100,200,200,200),wa_None) );
       scroll->appendWidget( buttons = new wdgButtons(this,axRect(0,0,150,400),wa_None)  );
         for (int i=0; i<20; i++)
           buttons->appendButton( new wdgButton(buttons,axRect(0,20),wa_Top,false,"off","on"  ) );
   doRealign();
 }
Esempio n. 8
0
File: main.cpp Progetto: EQ4/axLib
//-----------------------------------------------------------------------------
// DrumMachine.
//-----------------------------------------------------------------------------
DrumMachine::DrumMachine(axWindow* parent,
				   		 const axRect& rect,
                         Audio* audio):
						 axPanel(parent, rect),
						 _audio(audio)
{
//	function<void (axButtonMsg)> btnFct(GetOnChangeTemplate());
    axButtonEvents btnEvents;
    btnEvents.button_click = GetOnChangeTemplate();

	// string dir(app->GetCurrentAppDirectory());

	_topBg = new axImage("/Users/alexarse/Project/axLib/axProjects/MidiSequencer/tool2.png");
	
	// axButtonInfo btn_info(axColor(0.8, 0.0, 0.0),
	// 					  axColor(0.9, 0.0, 0.0),
	// 					  axColor(0.8, 0.0, 0.0),
	// 					  axColor(0.8, 0.0, 0.0),
	// 					  axColor(0.0, 0.0, 0.0),
	// 					  axColor(0.0, 0.0, 0.0));

	// int x = 0, y = 0, xDelta = 20;

	//axButton* btn = new axButton(app, this, 
	//							 axRect(0, 0, 40, 18), 
	//							 axButtonEvents(btnFct), 
	//							 axButtonInfo(dir + "ressources/axStandardButton.axobj"), 
	//							 "", "Open");

	//cout << "MIDI SEQ :" << rect.size.x - 10 << endl;
	_midiSeq = new MidiSequencer(this, axRect(5, 70, rect.size.x - 10, 50), _audio);

	axEvtFunction(int) trackResizeFct(GetOnChangeTrackHeight());
	_midiSeq->SetTrackResizeFct(trackResizeFct);

	// int y = _midiSeq->GetBottomLeftPosition().y;
	// _synth = new SynthControl(app, this, axRect(0, y, rect.size.x, 180));



	//----------------------------------------------------------------------
	_drumSampler = new DrumSampler(this,
		axRect(_midiSeq->GetBottomLeftPosition() + axPoint(0, 5), 
			   axSize(rect.size.x - 10, 330)), _audio);
	//----------------------------------------------------------------------



	//_midiPartition = new MidiPartition(app, this, 
	//	axRect(_drumSampler->GetBottomLeftPosition() + axPoint(0, 5), 
	//		   axSize(rect.size.x - 10, 70)));

	// _side_img = new axImage("woodSide.png");

}
Esempio n. 9
0
File: axGain.cpp Progetto: EQ4/axLib
 void OnPaint()
 {
     axGC* gc = GetGC();
     axRect rect = axRect(axPoint(0, 0), GetRect().size);
     
     gc->SetColor(axColor(0.4, 0.4, 0.4));
     gc->DrawRectangle(rect);
     
     gc->SetColor(axColor(0.0, 0.0, 0.0));
     gc->DrawRectangleContour(axRect(1, 1, rect.size.x - 1, rect.size.y - 1));
 }
Esempio n. 10
0
MyScrollPanel::MyScrollPanel(axWindow* parent,
                             const axRect& rect,
                             const axSize& seenSize):
// Parent.
axPanel(parent, rect)
{
    SetBlockDrawing(true);
    SetShownRect(axRect(axPoint(0, 0), seenSize));
    
    
    axButtonInfo btn1_info;
    btn1_info.normal = axColor(0.8, 0.8, 0.8);
    btn1_info.hover = axColor(0.9, 0.9, 0.9);
    btn1_info.clicking = axColor(0.7, 0.7, 0.7);
    btn1_info.contour = axColor(0.0, 0.0, 0.0);
    btn1_info.selected = btn1_info.normal;
    
    axButtonEvents btn1_evts;
    btn1_evts.button_click = GetOnBtn();
    
    axButton* btn1 = new axButton(this,
                                  axRect(40, 40, 60, 25),
                                  btn1_evts,
                                  btn1_info,
                                  "", "Btn1");
    
    axButton* btn2 = new axButton(this,
                                  axRect(40, 500, 60, 25),
                                  btn1_evts,
                                  btn1_info,
                                  "", "Btn2");
    
    axScrollBarEvents scrollEvents;
    axScrollBarInfo scroll_info;
    scroll_info.normal = axColor(0.8, 0.8, 0.8);
    scroll_info.hover = axColor(0.9, 0.9, 0.9);
    scroll_info.clicking = axColor(0.7, 0.7, 0.7);
    scroll_info.contour = axColor(0.0, 0.0, 0.0);
    scroll_info.selected = scroll_info.normal;

    axPoint pos(rect.position.x + rect.size.x, rect.position.y);
    axScrollBar* _scrollBar = new axScrollBar(parent,
                                              this,
                                              axRect(pos,
                                                     axSize(8, GetShownRect().size.y)),
                                              scrollEvents,
                                              scroll_info);
    
    _scrollBar->SetPanelSize(rect.size);
}
Esempio n. 11
0
File: main.cpp Progetto: EQ4/axLib
FileDialog::FileDialog(axApp* app, axWindow* parent, 
					   const axRect& rect,
					   const string& folder_path):
					   axPanel(app, parent, rect)
{
	string path = app->GetCurrentAppDirectory();

	if(folder_path != "")
	{
		_dirNavigation = new DirectoryNavigation(folder_path);
	}
	else
	{
		_dirNavigation = new DirectoryNavigation("/home");
	}

	_folderContent = new FolderContent(app, this, 
									   axRect(axPoint(0, 31), rect.size - axSize(0, 31 + 30)),
									   _dirNavigation);

	axButtonInfo btn_info(string(path + "ressources/axDialogBtn.axobj"));

	function<void (axButtonMsg)> btnFct(GetOnBackBtn());

	axButton* b = new axButton(app, this, 
					  axRect(5, 5, 22, 22), 
					  axButtonEvents(btnFct), 
					  btn_info, "", "<",
					  axBUTTON_SINGLE_IMG | axBUTTON_IMG_RESIZE);

	b->SetBackgroundAlpha(0.5);

	btnFct = GetOnCancel();
	b = new axButton(app, this, 
					  axRect(rect.size.x - 130, rect.size.y - 26, 45, 20), 
					  axButtonEvents(btnFct), 
					  btn_info, "", "Cancel",
					  axBUTTON_SINGLE_IMG | axBUTTON_IMG_RESIZE);

	b->SetBackgroundAlpha(0.5);


	b = new axButton(app, this, 
					  axRect(rect.size.x - 60, rect.size.y - 26, 45, 20), 
					  axButtonEvents(), 
					  btn_info, "", "Select",
					  axBUTTON_SINGLE_IMG | axBUTTON_IMG_RESIZE);

	b->SetBackgroundAlpha(0.5);
}
Esempio n. 12
0
File: main.cpp Progetto: EQ4/axLib
void TitleBar::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->DrawRectangleColorFade(
		axRect(0, 0, rect0.size.x, rect0.size.y),// - 30),
		axColor(0.5, 0.5, 0.5), 1,
		axColor(0.3, 0.3, 0.3), 1);

	gc->SetColor(axColor(0.4, 0.4, 0.4));
	gc->DrawRectangleContour(axRect(1, 1, rect0.size.x - 1, rect0.size.y - 1));
}
Esempio n. 13
0
/*******************************************************************************
 * MyNumberPanel.
 ******************************************************************************/
MyNumberPanel::MyNumberPanel(axWindow* parent,
                             const axPoint& pos) :
axPanel(parent, axRect(pos, axSize(28, 15))),
_number(1)
{
    
}
Esempio n. 14
0
File: main.cpp Progetto: EQ4/axLib
void MidiPartition::DrawCircles(axGC* gc, const axRect& rect0)
{
	int circle_size = (1.0 / double(_nSlice)) * rect0.size.x * 0.5;

	for(int i = 0; i < _bars.size(); i++)
	{
		for(int k = 0; k < _bars[i]; k++)
		{
			int left_x = (i / double(_nSlice)) * rect0.size.x;
			int right_x = ((i+1) / double(_nSlice)) * rect0.size.x;
			int size_x = right_x - left_x;

			axPoint pos(left_x + (size_x - circle_size) * 0.5,
						(k + 1.0) * rect0.size.y / (_bars[i] + 1.0) - circle_size * 0.5);


			if(_heighlighted_circle == k && _heightlighted_bar == i)
			{
				// int select_size = 20;
				gc->SetColor(axColor(0.55, 0.35, 0.35), 1.0);
				gc->DrawRectangle(axRect(axPoint(pos.x - 3, pos.y - 3), 
								  axSize(circle_size + 6, circle_size + 6)));
			}

			

			gc->DrawImageResize(_circle, 
								axPoint(pos.x, pos.y), 
								axSize(circle_size, circle_size));
		}
	}
}
Esempio n. 15
0
void MyNumberPanel::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect = axRect(axPoint(0, 0), GetRect().size);
    
    gc->SetColor(axColor(0.3, 0.0, 0.0, 1.0));
    gc->DrawRectangle(rect);
    
    gc->SetColor(axColor(0.4, 0.0, 0.0, 1.0));
    gc->SetFontType(std::string("/Users/alexarse/Project/axLib/axProjects/axTB303Vst/build/UninstalledProducts/resources/digital-7 (mono).ttf"));
    gc->SetFontSize(16);
    gc->DrawChar('0', axPoint(5, -4));
    gc->DrawChar('0', axPoint(13, -4));
    
    
    gc->SetColor(axColor(0.95, 0.0, 0.0, 1.0));
    
    if(_number > 9)
    {
        gc->DrawChar(std::to_string(_number)[0], axPoint(5, -4));
        
        gc->DrawChar(std::to_string(_number)[1], axPoint(13, -4));
    }
    else
    {
        gc->DrawChar(std::to_string(_number)[0], axPoint(13, -4));
    }
    
    gc->SetColor(axColor(0.4, 0.0, 0.0, 1.0));
    gc->DrawRectangleContour(rect.GetInteriorRect(axPoint(1, 1)));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0, 1.0));
    gc->DrawRectangleContour(rect);
    
}
Esempio n. 16
0
MyButton* MyButton::MyButtonBuilder::Create(const axPoint& pos,
                                            const axEventFunction& evt)
{
    
    return _pastBtn = new MyButton(_parent, axRect(pos, _size), axButtonEvents(evt),
                                   _info, _delta);
}
Esempio n. 17
0
File: axMenu.cpp Progetto: EQ4/axLib
void axMenuNode::OnPaint()
{
    axGC* gc = GetGC();
    axSize size = GetSize();
    axRect rect( m_delta, 0, size.x, axMENU_NODE_HEIGHT );
	axRect rect0(0.0, 0.0, rect.size.x, rect.size.y);

    gc->SetColor(axColor(0.6, 0.6, 0.6));
    gc->DrawRectangle(rect0);

    gc->SetColor( axColor("#AAAAAA") );
    gc->SetFontSize(13);

    //cout << "Rect : " << rect.position.x << " " << rect.position.y << " " << rect.size.x << " " << rect.size.y << endl;
    gc->DrawStringAlignedCenter(m_label, rect);

    if( m_img != nullptr && m_img->IsImageReady() )
    {
        gc->DrawPartOfImage(m_img,
                            axPoint( 0, m_nCurrentImg * 12 ),
                            axSize( 12, 12 ), axPoint(m_delta + 7, 4));
    }

    // Contour.
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawRectangleContour(axRect(0, 0, size.x, size.y));
}
Esempio n. 18
0
MyButton* MyButton::MyButtonBuilder::Create(const axEventFunction& evt)
{
    return _pastBtn = new MyButton(_parent,
                                   axRect(_pastBtn->GetNextPosRight(_xDelta),
                                          _size), axButtonEvents(evt),
                                   _info, _delta);
}
Esempio n. 19
0
 virtual axWindow* doOpenEditor(axContext* aContext)
   {
     axEditor* editor = new axEditor(this,aContext,mEditorRect,AX_WIN_DEFAULT);
     editor->appendWidget( wPanel = new wdgPanel(  editor,NULL_RECT,wa_Client) );
       wPanel->setBorders(10,10,5,5);
       wPanel->appendWidget( w_Gain = new wdgKnob( editor,axRect(10,10,128, 32),wa_TopLeft,"gain",0.75) );
       wPanel->appendWidget( btns = new wdgButtons(editor,axRect(10,50,200,100),wa_Client ) );
         btns->setBorders(0,0,2,2);
         for (int i=0; i<32; i++) btns->appendButton( new wdgButton( btns,axRect(0,0,32,32),wa_StackedHoriz ) );
         btns->setMode(bm_Single);
     editor->connect(w_Gain,p_Gain);
     editor->doRealign();
     editor->show();
     mEditor = editor;
     return mEditor;
   }
Esempio n. 20
0
    virtual axWindow* doOpenEditor(axContext* aContext)
      {
        axEditor* editor = new axEditor(this,aContext,mEditorRect,AX_WIN_DEFAULT);
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"type1 - red"   ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"type2 - green" ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"min x" ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"max x" ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"min y" ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"max y" ) );
        editor->appendWidget( new wdgSlider( editor, axRect(128,20),wa_Top,"n"     ) );
        editor->connect( editor->getWidget(0), mParameters[0] );
        editor->connect( editor->getWidget(1), mParameters[1] );
        editor->connect( editor->getWidget(2), mParameters[2] );
        editor->connect( editor->getWidget(3), mParameters[3] );
        editor->connect( editor->getWidget(4), mParameters[4] );
        editor->connect( editor->getWidget(5), mParameters[5] );
        editor->connect( editor->getWidget(6), mParameters[6] );
        editor->appendWidget( w_Painter = new myPainter(editor,NULL_RECT,wa_Client) );
        editor->doRealign();

        transferParameters();

        editor->show();
        w_Editor = editor;
        return editor;
      }
Esempio n. 21
0
File: main.cpp Progetto: EQ4/axLib
void axMain::MainEntryPoint(axApp* app)
{
//    axApp::GetInstance()->GetCore()->ResizeFrame(axSize(570, 600));
    AudioMidiSeq* audio = new AudioMidiSeq();
    ScrollDrumMachine* machine = new ScrollDrumMachine(nullptr,
                                                       axRect(0, 0, 570, 600),
                                                       audio);
    audio->StartAudio();
}
Esempio n. 22
0
File: main.cpp Progetto: EQ4/axLib
ScrollDrumMachine::ScrollDrumMachine(axWindow* parent,
									 const axRect& rect, Audio* audio):
								     axPanel(parent, rect)
{
	function<void (axScrollBarMsg)> scroll(GetOnScroll());
	scroll_bar = new axScrollBar(this,
								 axRect(rect.size.x -14 - 45, 0, 14, rect.size.y), 
								 axScrollBarEvents(scroll), 
								 axScrollBarInfo());


	scroll_bar->setInputInfo(rect.size.y, 605, 0);
	_drum = new DrumMachine(this, axRect(45, 0, rect.size.x - 90 - 14, 800), audio);

	_side_img = new axImage("/Users/alexarse/Project/axLib/axProjects/MidiSequencer/woodSide.png");

	_last_delta = 0;
}
Esempio n. 23
0
File: main.cpp Progetto: EQ4/axLib
void MidiPartition::DrawHeighlightedCircle(axGC* gc, const axRect& rect0)
{
	if(_heightlighted_bar != -1)
	{
		int left_x = (_heightlighted_bar / double(_nSlice)) * rect0.size.x;
		int right_x = ((_heightlighted_bar+1) / double(_nSlice)) * rect0.size.x;

		gc->SetColor(axColor(0.35, 0.35, 0.35), 1.0);
		gc->DrawRectangle(axRect(left_x, 0, right_x - left_x - 1, rect0.size.y));
	}
}
Esempio n. 24
0
void MyLED::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect = axRect(axPoint(0, 0), GetRect().size);
    
    
    gc->DrawPartOfImage(_ledImg,
                        axPoint(0, _imgIndex * 9),
                        axSize(9, 9),
                        axPoint(0, 0));
}
Esempio n. 25
0
void axScrollBar::OnMouseLeftDown(const axPoint& position)
{
	axPoint pos = position - GetAbsoluteRect().position;
    
    if(axRect(0, _sliderPos, GetRect().size.x, _sliderHeight).IsPointInside(pos))
    {
        _currentScrollBarColor = &_info.hover;
        _yClickDelta = pos.y - _sliderPos;

        GrabMouse();
        Update();
    }
}
Esempio n. 26
0
File: axMenu.cpp Progetto: EQ4/axLib
void axMenu::OnPaint()
{
    axGC* gc = GetGC();
    axSize size = GetSize();
    axRect rect(GetRect());
    axRect rect0(axPoint(0, 0), rect.size);

    gc->SetColor( axColor("#444444") );
    gc->DrawRectangle(rect0);

    // Contour.
    gc->SetColor(axColor("#000000"));
    gc->DrawRectangleContour(axRect(1, 1, rect0.size.x - 1, rect0.size.y - 1));
}
Esempio n. 27
0
axToggle* axToggle::Builder::Create(axVectorPairString attributes)
{
    std::string name;
    axPoint pos;
    axToggle::Events evts;
    for(auto& s : attributes)
    {
        if(s.first == "name")
        {
            name = s.second;
        }
        else if(s.first == "rect")
        {
            axStringVector strVec;
            strVec = GetVectorFromStringDelimiter(s.second, ",");
            
            pos = axPoint(stoi(strVec[0]),
                          stoi(strVec[1]));
            
            _size = axSize(stoi(strVec[2]),
                           stoi(strVec[3]));
        }
        else if(s.first == "info")
        {
            _info.SerializeInput(s.second);
        }
        else if(s.first == "label")
        {
            _label = s.second;
        }
        else if(s.first == "flags")
        {
            _flags = stoi(s.second);
        }
        else if(s.first == std::string("event"))
        {
            evts.button_click = _parent->GetEventFunction(s.second);
        }
        
    }
    
    axToggle* tog = new axToggle(_parent, axRect(pos, _size),
                                 evts,
                                 _info, _img, _label);
    
    _parent->GetResourceManager()->Add(name, tog);
    return tog;
    
}
Esempio n. 28
0
void MyPreference::OnPaint()
{
    axGC* gc = GetGC();
    axRect rect = axRect(axPoint(0, 0), GetRect().size);
    
    
    gc->SetColor(axColor("#9B9A9A"));
    gc->DrawRectangle(rect);
    
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawString(std::string("Audio"), axPoint(20, 20));
    
    gc->SetColor(axColor(0.0, 0.0, 0.0));
    gc->DrawRectangleContour(rect);
}
Esempio n. 29
0
void axScrollBar::OnMouseMotion(const axPoint& position)
{
    axPoint pos = position - GetAbsoluteRect().position;
    
    if(axRect(0, _sliderPos, GetRect().size.x, _sliderHeight).IsPointInside(pos))
    {
        _currentScrollBarColor = &_info.hover;
        Update();
    }
    else if(_currentScrollBarColor != &_info.normal)
    {
       _currentScrollBarColor = &_info.normal;
        Update();
    }
}
Esempio n. 30
0
File: main.cpp Progetto: EQ4/axLib
TitleBar::TitleBar(axApp* app, axWindow* parent, const axRect& rect):
			axPanel(app, parent, rect)
{
	string path(app->GetCurrentAppDirectory());

	function<void (axButtonMsg)> btnFct(GetOnBtn());

	axButton* btn = new axButton(app, this, 
								 axRect(10, 5, 15, 15), 
								 axButtonEvents(btnFct), 
								 axButtonInfo(axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5),
											  axColor(0.5, 0.5, 0.5)),
								 path+string("x.png"));


	btnFct = GetOnBtn();
	axButton* btn2 = new axButton(app, this, 
							 axRect(30, 5, 15, 15), 
							 axButtonEvents(btnFct), 
							 axButtonInfo(axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5),
										  axColor(0.5, 0.5, 0.5)),
							 path+string("x.png"));



	btn->SetBackgroundAlpha(0.0);
	btn2->SetBackgroundAlpha(0.0);
}