Esempio n. 1
0
void GUIController::remove_from_world (void)
{
    world()->unregister_for_touch(this, make_callback(this, &GUIController::touch_gui));
    world()->unregister_for_draw(this, make_callback(this, &type::draw_gui));

    PlaceableObject::remove_from_world();
}
Esempio n. 2
0
DrawBatcher::~DrawBatcher (void)
{
	draw();

    SystemCallbacks::screen_opened_cb().remove(make_callback(this, &type::screen_opened));
    SystemCallbacks::screen_closed_cb().remove(make_callback(this, &type::screen_closed));
}
Esempio n. 3
0
void GUIController::add_to_world(World *world)
{
    PlaceableObject::add_to_world(world);
    
    world->register_for_touch(this, make_callback(this, &GUIController::touch_gui));
    world->register_for_draw(this, make_callback(this, &type::draw_gui));
}
Esempio n. 4
0
DrawBatcher::DrawBatcher (void)
	:	_type           (DT3GL_PRIM_TRI_STRIP),
		_format         (FMT_V),
		_cur_index		(-1),
        _flush_callback (NULL)
{
    SystemCallbacks::screen_opened_cb().add(make_callback(this, &type::screen_opened));
    SystemCallbacks::screen_closed_cb().add(make_callback(this, &type::screen_closed));
}
_keyboardScreenButton::_keyboardScreenButton( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , _optValue<_length> height , _key key , wstring title , _style&& style ) :
	_button( x , y , width , height , title , (_style&&)style )
	, key( key )
{	
	this->setInternalEventHandler( onMouseDown , make_callback( &_keyboardScreenButton::mouseHandler ) );
	this->setInternalEventHandler( onMouseUp , make_callback( &_keyboardScreenButton::mouseHandler ) );
	this->setInternalEventHandler( onMouseClick , make_callback( &_keyboardScreenButton::mouseHandler ) );
	this->setInternalEventHandler( onMouseRepeat , make_callback( &_keyboardScreenButton::mouseHandler ) );
}
Esempio n. 6
0
_select::_select( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , const _menuEntryList& lst , _int initialValue , _style&& style ) :
	_gadget( _gadgetType::selectbox , x , y , width , _guiController::getSelectHeight() , style | _style::noTransparentParts )
	, contextMenu( new _contextMenu( ignore , _menu( move(lst) ) , this , true , initialValue ) )
	, arrow( new _scrollButton( 8 , 8 , 0 , 0 , _scrollButtonType::buttonBottom ) )
{
	// Refresh on contextMenu change
	this->contextMenu->setUserEventHandler( onEdit , make_callback( this , &_select::editHandler ) );
	this->contextMenu->setUserEventHandler( onOpen , make_callback( this , &_select::refreshButtonHandler ) );
	this->contextMenu->setUserEventHandler( onClose , make_callback( this , &_select::refreshButtonHandler ) );
	
	// Register handler
	this->setInternalEventHandler( onDraw , make_callback( &_select::refreshHandler ) );
	this->setInternalEventHandler( onMouseDown , make_callback( this , &_select::toggleContextMenuHandler ) );
	this->setInternalEventHandler( onKeyDown , make_callback( &_select::keyHandler ) );
	this->setInternalEventHandler( onKeyRepeat , make_callback( &_select::keyHandler ) );
	this->setInternalEventHandler( onFocus , _gadgetHelpers::eventForwardRefresh() );
	this->setInternalEventHandler( onBlur , _gadgetHelpers::eventForwardRefresh() );
	this->setInternalEventHandler( onResize , make_callback( &_select::resizeHandler ) );
	
	// Toggle the _contextMenu when the arrow button is clicked
	this->arrow->setUserEventHandler( onMouseDown , make_callback( this , &_select::toggleContextMenuHandler ) );
	
	// Refresh Me
	this->redraw();
	
	// Add arrow
	this->updateArrowButton(); // This updates only its position and type
	this->addEnhancedChild( this->arrow );
}
Esempio n. 7
0
_expandButton::_expandButton( _optValue<_coord> x , _optValue<_coord> y , _style&& style ) :
	_gadget( _gadgetType::expandbutton , x , y , 7 , 7 , style | _style::notResizeable | _style::notDoubleClickable )
	, intValue( 0 )
{
	// Register my handlers
	this->setInternalEventHandler( onDraw , make_callback( &_expandButton::refreshHandler ) );
	this->setInternalEventHandler( onMouseClick , make_callback( &_expandButton::mouseHandler ) );
	this->setInternalEventHandler( onMouseEnter , _gadgetHelpers::eventForwardRefresh() );
	this->setInternalEventHandler( onMouseLeave , _gadgetHelpers::eventForwardRefresh() );
	
	// Refresh Me
	this->redraw();
}
Esempio n. 8
0
_checkBox::_checkBox( _optValue<_coord> x , _optValue<_coord> y , _u8 value , _style&& style ) :
	_gadget( _gadgetType::checkbox , x , y , 9 , 9 , style | _style::notResizeable | _style::notDoubleClickable | _style::noTransparentParts )
	, intValue( value )
{
	// Register my handlers
	this->setInternalEventHandler( onDraw , make_callback( &_checkBox::refreshHandler ) );
	this->setInternalEventHandler( onMouseClick , make_callback( &_checkBox::mouseHandler ) );
	this->setInternalEventHandler( onMouseEnter , _gadgetHelpers::eventForwardRefresh() );
	this->setInternalEventHandler( onMouseLeave , _gadgetHelpers::eventForwardRefresh() );
	
	// Refresh Me
	this->redraw();
}
_mainFrame::_mainFrame( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , _optValue<_length> height , _programHandle progHandle , _style&& style ) :
	_window( x , y , width , height , _mainFrame::getDisplayName( progHandle ) , _mainFrame::getIcon( progHandle ) , true , true , (_style&&)style )
	, programHandle( move(progHandle) )
{
	_window::label->setEllipsis( true );
	this->setType( _gadgetType::mainframe );
	
	// Register Close-Handler
	this->setInternalEventHandler( onDelete , make_callback( &_mainFrame::closeHandler ) );
	this->setInternalEventHandler( onParentRemove , make_callback( &_mainFrame::closeHandler ) );
	
	// Add To Host
	this->setParent( _guiController::getHost() );
}
Esempio n. 10
0
void _taskInfo::displayNotification( wstring title , wstring content , _bitmap icon )
{
    this->notificationBubbleHandler = nullptr;
    this->notificationBubble = new _bubble( content.length() > 22 ? 85 : 60 , move(title) , move(content) , icon );
    this->notificationBubble->setUserEventHandler( onMouseClick , make_callback( this , &_taskInfo::notificationClickHandler ) );
    this->notificationBubble->show( this , false );
}
Esempio n. 11
0
void ComponentGUIDrawIcon::remove_from_owner (void)
{
    GUIObject *gui = checked_cast<GUIObject*>(owner());
    if (gui) {
        gui->draw_gui_callbacks().remove(make_callback(this, &type::draw));
    }

    ComponentBase::remove_from_owner();
}
Esempio n. 12
0
void ComponentGUIDrawIcon::add_to_owner (ObjectBase *owner)
{
    ComponentBase::add_to_owner(owner);
    
    GUIObject *gui = checked_cast<GUIObject*>(owner);
    if (gui) {
        gui->draw_gui_callbacks().add(make_callback(this, &type::draw));
    }
}
Esempio n. 13
0
_sliderHandle::_sliderHandle( _optValue<_coord> x , _optValue<_coord> y , _dimension dim , _style&& style ) :
	_gadget( _gadgetType::none , x , y , dim == _dimension::horizontal ? 6 : 12 , dim == _dimension::horizontal ? 11 : 6 , style | _style::draggable | _style::smallDragThld )
	, dimension( dim )
{
	// Register Handler
	this->setInternalEventHandler( onDraw , make_callback( &_sliderHandle::refreshHandler ) );
	
	// Refresh
	this->redraw();
}
Esempio n. 14
0
_textArea::_textArea( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , _optValue<_length> height , wstring value , _style&& style ) :
	_gadget( _gadgetType::textarea , x , y , width , height , style | _style::keyboardRequest | _style::draggable | _style::smallDragThld | _style::noTransparentParts )
	, bgColor( _color::fromRGB( 31 , 31 , 31 ) )
	, text( move(value) , _fontController::getStandardFont() , _color::black , _fontController::getStandardFontSize() )
{
	this->scrollBar =
		new _scrollBar(
			width - 9 , /* x-coord */
			1 , /* y-coordinate */
			height - 2 , /* height of the scrollbar */
			height - 2 , /* Visible Part of the canvas */
			this->text.getTextHeight() , /* Height of the inner canvas */
			_dimension::vertical
			, 0 /* value */
			, _style::canNotTakeFocus | _style::notFocusable
		)
	;
	
	// Scrollbar preferences
	this->addChild( this->scrollBar );
	this->scrollBar->setInternalEventHandler( onScroll , _gadgetHelpers::eventForwardGadget(this) );
	this->scrollBar->setStep( this->text.getFont()->getHeight() + 1 );
	
	// Register update Handler...
	this->setInternalEventHandler( onUpdate , make_callback( &_textArea::generalHandler ) );
	
	// that will set the right parameters for the Scrollbar!
	this->updateNow();
	
	// Regsiter Handling Functions for events
	this->setInternalEventHandler( onFocus , make_callback( &_textArea::generalHandler ) );
	this->setInternalEventHandler( onBlur , make_callback( &_textArea::generalHandler ) );
	this->setInternalEventHandler( onResize , make_callback( &_textArea::generalHandler ) );
	this->setInternalEventHandler( onDraw , make_callback( &_textArea::refreshHandler ) );
	this->setInternalEventHandler( onMouseDown , make_callback( &_textArea::mouseHandler ) );
	this->setInternalEventHandler( onKeyDown , make_callback( &_textArea::keyHandler ) );
	this->setInternalEventHandler( onKeyRepeat , make_callback( &_textArea::keyHandler ) );
	this->setInternalEventHandler( onDragging , make_callback( &_textArea::mouseHandler ) );
	this->setInternalEventHandler( onScroll , make_callback( &_textArea::generalHandler ) );
	
	// Refresh Myself
	this->redraw();
}
Esempio n. 15
0
_windowMenu::_windowMenu( _menu menu , _style&& style ) :
	_menu( move(menu) )
	, _gadget( _gadgetType::windowmenu , ignore , ignore , ignore , _guiController::getListItemHeight() , style | _style::noTransparentParts )
{
	this->setMinHeight( _guiController::getListItemHeight() );
	
	// Add a handler to the standard Menu
	this->addHandler( _menuHandlerRule() , make_callback( this , &_windowMenu::menuHandler ) );
	
	// Register updatehandler
	this->setInternalEventHandler( onUpdate , make_callback( &_windowMenu::updateHandler ) );
	
	// Regsiter other handlers
	this->setInternalEventHandler( onParentResize , make_callback( &_windowMenu::updateHandler ) );
	this->setInternalEventHandler( onParentAdd , make_callback( &_windowMenu::updateHandler ) );
	this->setInternalEventHandler( onDraw , make_callback( &_windowMenu::refreshHandler ) );
	
	// Generate list
	this->generateChildren();
}
Esempio n. 16
0
_bootupScreen::_bootupScreen( _u8 bgId , _style&& style ) :
	_gadgetScreen( bgId , _gadgetScreenType::bootUp , SCREEN_WIDTH , SCREEN_HEIGHT , style | _style::notFocusable )
	, bar( new _progressBar( 102 , 125 , 51 , false ) )
{
	this->setInternalEventHandler( onDraw , make_callback( &_bootupScreen::refreshHandler ) );
	
	bar->setColorScheme( true );
	this->addChild( bar );
	
	//! Refresh me
	this->redraw();
}
Esempio n. 17
0
_clockGadget::_clockGadget( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , _optValue<_length> height , _u8 hours , _u8 minutes , _u8 seconds , bool autoIncrease , _style&& style ) :
	_gadget( _gadgetType::clockgadget , x , y , width , height , _style::notClickable )
	, outerBgColor( _color::transparent )
	, innerBgColor( _color::white )
	, secondsColor( _color::red )
	, minutesColor( _color::black )
	, hoursColor( _color::black )
	, markingsColor( _color::gray )
	, seconds( seconds )
	, minutes( minutes )
	, hours( hours )
	, timer( make_callback( this , &_clockGadget::increase ) , 1000 , true )
{
	if( autoIncrease )
		this->timer.start();
	
	// Register my handlers
	this->setInternalEventHandler( onDraw , make_callback( &_clockGadget::refreshHandler ) );
	
	// Refresh
	this->redraw();
}
Esempio n. 18
0
void process_touch(int code, int value)
{
	if (code == 53)
		once_x = value;
	if (code == 54)
		once_y = value;
	if (once_x != -1 && once_y != -1)
		complete_once = true;
	if (complete_once)
	{
		make_callback(once_x, once_y);
		once_x = once_y = -1;
		complete_once = false;
	}
}
Esempio n. 19
0
_resizeHandle::_resizeHandle( _optValue<_color> bgColor , _style&& style ) :
    _gadget( _gadgetType::resizehandle , 8 , 8 , 0 , 0 , style | _style::draggable )
    , bgColor( bgColor.isValid() ? (_color)bgColor : _color::transparent )
{
    this->setInternalEventHandler( onParentResize , make_callback(  &_resizeHandle::positionAdjuster ) );
    this->setInternalEventHandler( onParentAdd , make_callback(  &_resizeHandle::positionAdjuster ) );
    this->setInternalEventHandler( onParentRestyle , make_callback(  &_resizeHandle::positionAdjuster ) );
    this->setInternalEventHandler( onDragging , make_callback( &_resizeHandle::dragHandler ) );
    this->setInternalEventHandler( onDraw , make_callback( &_resizeHandle::refreshHandler ) );
    this->setInternalEventHandler( onUpdate , make_callback( &_resizeHandle::updateHandler ) );
}
Esempio n. 20
0
_windowBar::_windowBar( _optValue<_length> height , _optValue<_color> bgColor , _style&& style ) :
	_gadget( _gadgetType::windowbar , ignore , ignore , ignore , height.isValid() ? (_length)height : 8 , style | _style::draggable | _style::noTransparentParts )
	, bgColor( bgColor.isValid() ? (_color)bgColor : _guiController::getControlBg() )
{
	this->setMinHeight( 8 );
	
	// Register updatehandler
	this->setInternalEventHandler( onUpdate , make_callback( &_windowBar::updateHandler ) );
	
	this->updateNow();
	
	// Regsiter other handlers
	this->setInternalEventHandler( onParentResize , make_callback( &_windowBar::updateHandler ) );
	this->setInternalEventHandler( onParentAdd , make_callback( &_windowBar::updateHandler ) );
	this->setInternalEventHandler( onParentRestyle , _gadgetHelpers::eventForwardRefresh() );
	this->setInternalEventHandler( onResize , make_callback( &_windowBar::updateHandler ) );
	this->setInternalEventHandler( onDragStart , make_callback( &_windowBar::dragHandler ) );
	this->setInternalEventHandler( onDragging , make_callback( &_windowBar::dragHandler ) );
	this->setInternalEventHandler( onDraw , make_callback( &_windowBar::refreshHandler ) );
}
Esempio n. 21
0
_fileOpenDialog::_fileOpenDialog( _fileTypeList possibleFileExtensions , string initialFilePath , _int initialFileExtension , _optValue<wstring> openLabel , _optValue<wstring> windowLabel ) :
	fileTypes( move(possibleFileExtensions) )
{
	// Constants
	_coord firstLineY = 70;
	_coord secondLineY = 82;
	_coord fileViewY = 12;
	
	// Labels
	this->fileNameLabel = new _label( 2 , firstLineY , ignore , ignore , _localizationController::getBuiltInString("def_filename") );	
	
	// Determine some widths
	const _length textBoxWidth = 60;
	const _length labelWidth = this->fileNameLabel->getWidth();
	
	// Create Filename Box
	this->fileNameBox = new _textBox( labelWidth + 3 , firstLineY , textBoxWidth , ignore );
	
	
	// Determine Start of 2nd X Coordinate
	_coord secondRowX = this->fileNameBox->getWidth() + this->fileNameLabel->getWidth() + 4;
	
	
	// Create the two buttons
	this->cancelButton = new _button( secondRowX , secondLineY , ignore , ignore , _localizationController::getBuiltInString("lbl_cancel") );
	this->openButton = new _button( secondRowX + cancelButton->getWidth() + 1 , secondLineY , ignore , ignore , openLabel.isValid() ? (wstring&&)openLabel : _localizationController::getBuiltInString("lbl_open") );
	
	
	// Create file type Selectbox
	_length selectWidth = this->cancelButton->getWidth() + this->openButton->getWidth() + 1;
	this->fileTypeChooser = new _select( secondRowX , firstLineY , selectWidth , generateMenuList() , initialFileExtension );
	
	
	// Adjust Label
	this->fileNameLabel->setHeight( this->fileNameBox->getHeight() );
	
	
	// Window
	_length winWidth = labelWidth + this->fileTypeChooser->getWidth() + textBoxWidth + 7;
	_length winHeight = secondLineY + this->openButton->getHeight() + 12;
	this->window = new _dialogWindow( ( SCREEN_WIDTH - winWidth ) >> 1 , ( SCREEN_HEIGHT - winHeight ) >> 1 , winWidth , winHeight , windowLabel.isValid() ? (wstring&&)windowLabel : _localizationController::getBuiltInString("lbl_open") , _style::notResizeable );
	
	// Fix Filepath
	initialFilePath = _direntry( initialFilePath ).getFileName();
	
	// FileView & Addressbar & Button
	this->fileViewAddress = new _textBox( 1 , 1 , winWidth - 14 - 11 , ignore , initialFilePath );
	this->gotoButton = new _actionButton( winWidth - 12 , 1 , _actionButtonType::next );
	this->gotoButton->setUserEventHandler( onMouseClick , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->folderUpButton = new _imageButton( winWidth - 14 - this->gotoButton->getWidth() , 1 , 10 , 9 , BMP_FolderUpIcon() );
	this->folderUpButton->setUserEventHandler( onMouseClick , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->fileView = new _fileView( 1 , fileViewY , winWidth - 4 , firstLineY - fileViewY - 1 , initialFilePath , _fileViewType::list );
	this->fileView->setFileMask( this->getFileMask( this->getFileType() ) );
	this->fileView->setEventHandler( make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->fileView->setUserEventHandler( onEdit , make_callback( this , &_fileOpenDialog::eventHandler ) );
	
	
	// Stuff...
	this->openButton->setAutoSelect( true );
	this->openButton->setInternalEventHandler( onMouseClick , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->cancelButton->setInternalEventHandler( onMouseClick , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->fileTypeChooser->setInternalEventHandler( onEdit , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->window->setInternalEventHandler( onClose , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->fileNameBox->setUserEventHandler( onEdit , make_callback( this , &_fileOpenDialog::eventHandler ) );
	this->fileNameBox->handleEvent( onEdit ); // Update
	
	
	// Add Gadgets
	this->window->addChild( this->openButton );
	this->window->addChild( this->cancelButton );
	this->window->addChild( this->fileNameBox );
	this->window->addChild( this->fileTypeChooser );
	this->window->addChild( this->fileNameLabel );
	this->window->addChild( this->fileView );
	this->window->addChild( this->fileViewAddress );
	this->window->addChild( this->gotoButton );
	this->window->addChild( this->folderUpButton );
}
Esempio n. 22
0
void ScriptingTouch::remove_from_world (void)
{
    world()->unregister_for_touch(this, make_callback(this, &type::touch));
    world()->unregister_for_draw(this, make_callback(this, &type::draw));
    ScriptingBase::remove_from_world();
}
Esempio n. 23
0
void ScriptingVector3Filter2Pole::add_to_world(World *world)
{
    ScriptingBase::add_to_world(world);
    
    world->register_for_tick(this, make_callback(this, &type::tick));
}
Esempio n. 24
0
void ScriptingVector3Filter2Pole::remove_from_world (void)
{
    world()->unregister_for_tick(this, make_callback(this, &type::tick));

    ScriptingBase::remove_from_world();
}
Esempio n. 25
0
void ScriptingTouch::add_to_world(World *world)
{
    ScriptingBase::add_to_world(world);
    world->register_for_touch(this, make_callback(this, &type::touch));
    world->register_for_draw(this, make_callback(this, &type::draw));
}
Esempio n. 26
0
void ScriptingGlobalPoll::remove_from_world (void)
{
    world()->unregister_for_tick(this, make_callback(this, &type::tick));

    ScriptingBase::remove_from_world();
}
Esempio n. 27
0
void ScriptingGlobalPoll::add_to_world(World *world)
{
    ScriptingBase::add_to_world(world);

    world->register_for_tick(this, make_callback(this, &type::tick));
}
Esempio n. 28
0
void ScriptingTimerUpReset::remove_from_world (void)
{
    world()->unregister_for_tick(this, make_callback(this, &type::tick));

    ScriptingBase::remove_from_world();
}
Esempio n. 29
0
void ScriptingTimerUpReset::add_to_world(World *world)
{
    ScriptingBase::add_to_world(world);
    
    world->register_for_tick(this, make_callback(this, &type::tick));
}
Esempio n. 30
0
_imageGadget::_imageGadget( _optValue<_coord> x , _optValue<_coord> y , _bitmap img , _optValue<_length> width , _optValue<_length> height , _style&& style ) :
    _gadget( _gadgetType::imagegadget , x , y , width.isValid() ? _length(width) : img.getWidth() , height.isValid() ? _length(height) : img.getHeight() , (_bitmap&&)img , (_style&&)style )
{
    // Register Event-Handler
    this->setInternalEventHandler( onDraw , make_callback( &_imageGadget::refreshHandler ) );
}