Ejemplo n.º 1
0
void appl::Windows::init() {
	ewol::widget::Windows::init();
	
	getObjectManager().periodicCall.connect(sharedFromThis(), &appl::Windows::onCallbackPeriodicUpdateCamera);
	
	m_env = ege::Environement::create();
	// Create basic Camera
	m_camera = ememory::makeShared<ege::camera::View>(vec3(30,30,-100), vec3(0,0,0));
	m_env->addCamera("basic", m_camera);
	
	ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
	if (tmpWidget == nullptr) {
		APPL_ERROR("Can not allocate widget ==> display might be in error");
	} else {
		tmpWidget->setEnv(m_env);
		tmpWidget->propertyExpand.set(bvec2(true,true));
		tmpWidget->propertyFill.set(bvec2(true,true));
		tmpWidget->setCamera("basic");
		setSubWidget(tmpWidget);
	}
	ememory::SharedPtr<ege::resource::Mesh> myMesh;
	// Create an external box :
	myMesh = createViewBoxStar();
	if (myMesh != nullptr) {
		m_env->addStaticMeshToDraw(myMesh);
	}
	myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
	if (myMesh != nullptr) {
		m_env->addStaticMeshToDraw(myMesh);
	}
}
Ejemplo n.º 2
0
ewol::Widget::Widget() :
  m_size(10,10),
  m_minSize(0,0),
  m_maxSize(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE)),
  m_offset(0,0),
  m_zoom(1.0f),
  m_origin(0,0),
  m_userMinSize(*this, "min-size", gale::Dimension(vec2(0,0),gale::Dimension::Pixel), "User minimum size"),
  m_userMaxSize(*this, "max-size", gale::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),gale::Dimension::Pixel), "User maximum size"),
  m_userExpand(*this, "expand", bvec2(false,false), "Request the widget Expand size wile space is available"),
  m_userFill(*this, "fill", bvec2(false,false), "Fill the widget available size"),
  m_hide(*this, "hide", false, "The widget start hided"),
  m_gravity(*this, "gravity", ewol::gravityButtomLeft, "Gravity orientation"),
  m_hasFocus(false),
  m_canFocus(*this, "focus", false, "enable the widget to have the focus capacity"), // TODO : je pense que c'est une erreur, c'st surement un event to get the cocus ...
  m_limitMouseEvent(3),
  m_allowRepeateKeyboardEvent(true),
  signalShortcut(*this, "shortcut"),
  m_needRegenerateDisplay(true),
  m_grabCursor(false),
  m_cursorDisplay(gale::context::cursor_arrow),
  signalAnnimationStart(*this, "annimation-start"),
  signalAnnimationRatio(*this, "annimation-ratio"),
  signalAnnimationStop(*this, "annimation-stop"),
  m_annimationMode(annimationModeDisable),
  m_annimationratio(0.0f),
  m_annimationTypeStart(*this, "annimation-start-type", 0, "Annimation type, when adding/show a widget"),
  m_annimationTimeStart(*this, "annimation-start-time", 0.1f, 0.0f, 200.0f, "Annimation time in second, when adding/show a widget"),
  m_annimationTypeStop(*this, "annimation-stop-type", 0, "Annimation type, when removing/hide a widget"),
  m_annimationTimeStop(*this, "annimation-stop-time", 0.1f, 0.0f, 200.0f, "Annimation time in second, when removing/hide a widget"){
	addObjectType("ewol::Widget");
	
	// TODO : Set a static interface for list ==> this methode create a multiple allocation
	m_gravity.add(ewol::gravityCenter, "center");
	m_gravity.add(ewol::gravityTopLeft, "top-left");
	m_gravity.add(ewol::gravityTop, "top");
	m_gravity.add(ewol::gravityTopRight, "top-right");
	m_gravity.add(ewol::gravityRight, "right");
	m_gravity.add(ewol::gravityButtomRight, "buttom-right");
	m_gravity.add(ewol::gravityButtom, "buttom");
	m_gravity.add(ewol::gravityButtomLeft, "buttom-left");
	m_gravity.add(ewol::gravityLeft, "left");
	m_annimationTypeStart.add(0, "none");
	m_annimationTypeStop.add(0, "none");
}
Ejemplo n.º 3
0
void appl::Windows::init() {
	//! [ewol_sample_HW_windows_init]
	ewol::widget::Windows::init();
	//! [ewol_sample_HW_windows_init]
	//! [ewol_sample_HW_windows_label]
	ewol::widget::LabelShared tmpWidget = ewol::widget::Label::create();
	if (tmpWidget == nullptr) {
		APPL_ERROR("Can not allocate widget ==> display might be in error");
	} else {
		tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
		tmpWidget->propertyExpand.set(bvec2(true,true));
		// confidure the label as a windows sub-widget
		setSubWidget(tmpWidget);
	}
	//! [ewol_sample_HW_windows_label]
}
Ejemplo n.º 4
0
ewol::widget::ContextMenu::ContextMenu():
  m_shaper(*this, "shaper", "the display name for config file"),
  m_arrowPos(*this, "arrow-position", vec2(0,0), "Position of the arrow in the pop-up"),
  m_arrawBorder(*this, "arrow-mode", markTop, "position of the arrow") {
	addObjectType("ewol::widget::ContextMenu");
	m_arrawBorder.add(markTop, "top");
	m_arrawBorder.add(markRight, "right");
	m_arrawBorder.add(markButtom, "buttom");
	m_arrawBorder.add(markLeft, "left");
	m_arrawBorder.add(markNone, "none");
	
	m_userExpand.set(bvec2(false,false));
	
	m_offset = 20;
	
	m_colorBackGroung = etk::color::white;
	
	m_colorBorder = etk::color::black;
	m_colorBorder.setA(0x7F);
	
	setMouseLimit(1);
}
Ejemplo n.º 5
0
void ewol::widget::Parameter::menuAdd(std::string _label, std::string _image, std::shared_ptr<ewol::Widget> _associateWidget) {
	if (nullptr != m_paramList) {
		m_paramList->menuAdd(_label, m_currentIdList, _image);
		if (nullptr != m_wSlider) {
			if (nullptr != _associateWidget) {
				m_wSlider->subWidgetAdd(_associateWidget);
			} else { 
				EWOL_DEBUG("Associate an empty widget on it ...");
				std::shared_ptr<ewol::widget::Label> myLabel = widget::Label::create(std::string("No widget for : ") + _label);
				if (nullptr == myLabel) {
					EWOL_ERROR("Can not allocate widget  == > display might be in error");
				} else {
					myLabel->setExpand(bvec2(true,true));
					m_wSlider->subWidgetAdd(myLabel);
				}
			}
			if (m_currentIdList == 0) {
				m_wSlider->subWidgetSelectSet(0);
			}
		}
		m_currentIdList++;
	}
}
Ejemplo n.º 6
0
TestScene::TestScene() :
	ewol::widget::Sizer(ewol::widget::Sizer::modeVert)
{
	addObjectType("appl::TestScene");
	/*
	m_ground = new game::Element("DATA:grass.obj");
	if (nullptr != m_ground) {
		m_ground->SetStaticMode(true);
		m_gameEngine.AddElement(m_ground);
	}
	*/
	
	APPL_CRITICAL("Create "__class__" (start)");
	std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
	std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
	std::shared_ptr<ewol::widget::Button> myButton = nullptr;
	/*
	mySizerHori = new ewol::widget::SizerHori();
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	SubWidgetAdd(mySizerHori);
		myButton = new ewol::widget::Button("Add Box");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddBox);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Add Sphere");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddSphere);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation X");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationX);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation Y"); = nullptr
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationY);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation Z");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationZ);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("Rotation -");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotation0);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("UP");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventUp);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("DOWN");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventDown);
			mySizerHori->SubWidgetAdd(myButton);
		}
	mySizerHori = new ewol::widget::SizerHori();
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	SubWidgetAdd(mySizerHori);
		myButton = new ewol::widget::Button("lunch object");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventLunch);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("1x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed1);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("0.5x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed0);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("2x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed2);
			mySizerHori->SubWidgetAdd(myButton);
		}
		myButton = new ewol::widget::Button("4x speed");
		if (nullptr != myButton) {
			myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed4);
			mySizerHori->SubWidgetAdd(myButton);
		}
	*/
	std::shared_ptr<ewol::widget::Spacer> mySpacer = new widget::Spacer();
	if (nullptr != mySpacer) {
		mySpacer->setExpand(bvec2(false,false));
		mySpacer->setFill(bvec2(true,false));
		mySpacer->setMinSize(vec2(10,10));
		mySpacer->setColor(0xFF000080);
		subWidgetAdd(mySpacer);
	}
	
	mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
	if (nullptr == mySizerHori) {
		APPL_DEBUG("Allocation error mySizerHori");
		return;
	}
	subWidgetAdd(mySizerHori);
		mySpacer = new ewol::widget::Spacer();
		if (nullptr != mySpacer) {
			mySpacer->setExpand(bvec2(false,false));
			mySpacer->setFill(bvec2(false,true));
			mySpacer->setMinSize(vec2(10,10));
			mySpacer->setColor(0x00FF0080);
			mySizerHori->subWidgetAdd(mySpacer);
		}
		
		m_testWidget = new ewol::widget::Scene(/*&m_gameEngine*/ nullptr);
		if (nullptr != m_testWidget) {
			m_testWidget->setExpand(bvec2(true,true));
			m_testWidget->setFill(bvec2(true,true));
			mySizerHori->subWidgetAdd(m_testWidget);
		}
		
		mySpacer = new ewol::widget::Spacer();
		if (nullptr != mySpacer) {
			mySpacer->setExpand(bvec2(false,false));
			mySpacer->setFill(bvec2(false,true));
			mySpacer->setMinSize(vec2(10,10));
			mySpacer->setColor(0x0000FF80);
			mySizerHori->subWidgetAdd(mySpacer);
		}
		
	mySpacer = new ewol::widget::Spacer();
	if (nullptr != mySpacer) {
		mySpacer->setExpand(bvec2(false,false));
		mySpacer->setFill(bvec2(true,false));
		mySpacer->setMinSize(vec2(10,10));
		mySpacer->setColor(0x00FFFF80);
		subWidgetAdd(mySpacer);
	}
	APPL_INFO("Create "__class__" (end)");
}
Ejemplo n.º 7
0
void ewol::widget::Parameter::init() {
	ewol::widget::PopUp::init();
	
	std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr;
	std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
	std::shared_ptr<ewol::widget::Spacer> mySpacer = nullptr;
	#ifdef __TARGET_OS__Android
		setMinSize(ewol::Dimension(vec2(90, 90), ewol::Dimension::Pourcent));
	#else
		setMinSize(ewol::Dimension(vec2(80, 80), ewol::Dimension::Pourcent));
	#endif
	
	mySizerVert = ewol::widget::Sizer::create(widget::Sizer::modeVert);
	if (nullptr == mySizerVert) {
		EWOL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		EWOL_INFO("add widget");
		mySizerVert->lockExpand(bvec2(true,true));
		mySizerVert->setExpand(bvec2(true,true));
		// set it in the pop-up-system :
		setSubWidget(mySizerVert);
		
		mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori);
		if (nullptr == mySizerHori) {
			EWOL_ERROR("Can not allocate widget  == > display might be in error");
		} else {
			mySizerVert->subWidgetAdd(mySizerHori);
			
			mySpacer = ewol::widget::Spacer::create();
			if (nullptr == mySpacer) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				mySpacer->setExpand(bvec2(true,false));
				mySizerHori->subWidgetAdd(mySpacer);
			}
			
			std::shared_ptr<ewol::widget::Button> tmpButton = widget::Button::create();
			if (nullptr == tmpButton) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String,
				        "<composer>\n"
				        "	<sizer mode=\"hori\">\n"
				        "		<image src=\"THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
				        "		<label>Save</label>\n"
				        "	</sizer>\n"
				        "</composer>\n"));
				tmpButton->signalPressed.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackParameterSave);
				mySizerHori->subWidgetAdd(tmpButton);
			}
			
			mySpacer = ewol::widget::Spacer::create();
			if (nullptr == mySpacer) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				mySpacer->setExpand(bvec2(false,false));
				mySpacer->setMinSize(ewol::Dimension(vec2(10,0)));
				mySizerHori->subWidgetAdd(mySpacer);
			}
			
			tmpButton = ewol::widget::Button::create();
			if (nullptr == tmpButton) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				tmpButton->setSubWidget(ewol::widget::Composer::create(widget::Composer::String,
				        "<composer>\n"
				        "	<sizer mode=\"hori\">\n"
				        "		<image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
				        "		<label>Close</label>\n"
				        "	</sizer>\n"
				        "</composer>\n"));
				tmpButton->signalPressed.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuclosed);
				mySizerHori->subWidgetAdd(tmpButton);
			}
		}
		
		mySizerHori = ewol::widget::Sizer::create(widget::Sizer::modeHori);
		if (nullptr == mySizerHori) {
			EWOL_ERROR("Can not allocate widget  == > display might be in error");
		} else {
			mySizerVert->subWidgetAdd(mySizerHori);
			
			m_paramList = ewol::widget::ParameterList::create();
			if (nullptr == m_paramList) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
			
				m_paramList->signalSelect.bind(shared_from_this(), &ewol::widget::Parameter::onCallbackMenuSelected);
				m_paramList->setFill(bvec2(false,true));
				m_paramList->setExpand(bvec2(false,true));
				mySizerHori->subWidgetAdd(m_paramList);
			}
			mySpacer = ewol::widget::Spacer::create();
			if (nullptr == mySpacer) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				mySpacer->setFill(bvec2(false,true));
				mySpacer->setMinSize(vec2(5,5));
				mySpacer->setColor(0x000000BF);
				mySizerHori->subWidgetAdd(mySpacer);
			}
			
			std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = widget::Sizer::create(widget::Sizer::modeVert);
			if (nullptr == mySizerVert2) {
				EWOL_ERROR("Can not allocate widget  == > display might be in error");
			} else {
				mySizerHori->subWidgetAdd(mySizerVert2);
				
				mySpacer = ewol::widget::Spacer::create();
				if (nullptr == mySpacer) {
					EWOL_ERROR("Can not allocate widget  == > display might be in error");
				} else {
					mySpacer->setExpand(bvec2(true,false));
					mySpacer->setMinSize(vec2(5,5));
					mySpacer->setColor(0x000000BF);
					mySizerVert2->subWidgetAdd(mySpacer);
				}
				
				m_wSlider = ewol::widget::WSlider::create();
				if (nullptr == m_wSlider) {
					EWOL_ERROR("Can not allocate widget  == > display might be in error");
				} else {
					m_wSlider->setTransitionSpeed(0.5);
					m_wSlider->setTransitionMode(ewol::widget::WSlider::sladingTransitionVert);
					m_wSlider->setExpand(bvec2(true,true));
					mySizerVert2->subWidgetAdd(m_wSlider);
				}
			}
		}
		
		mySpacer = ewol::widget::Spacer::create();
		if (nullptr == mySpacer) {
			EWOL_ERROR("Can not allocate widget  == > display might be in error");
		} else {
			mySpacer->setExpand(bvec2(true,false));
			mySpacer->setMinSize(vec2(5,5));
			mySpacer->setColor(0x000000BF);
			mySizerVert->subWidgetAdd(mySpacer);
		}
		
		m_widgetTitle = ewol::widget::Label::create("File chooser ...");
		if (nullptr == m_widgetTitle) {
			EWOL_ERROR("Can not allocate widget  == > display might be in error");
		} else {
			m_widgetTitle->setExpand(bvec2(true,false));
			mySizerVert->subWidgetAdd(m_widgetTitle);
		}
	}
	markToRedraw();
}
Ejemplo n.º 8
0
void main() {
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	vec3 totalAmbientLight = vec3( 1.0 );
	vec3 shadowMask = vec3( 1.0 );
#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)

	gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;

#endif
#ifdef USE_MAP

	vec4 texelColor = texture2D( map, vUv );

	texelColor.xyz = inputToLinear( texelColor.xyz );

	diffuseColor *= texelColor;

#endif

#ifdef USE_COLOR

	diffuseColor.rgb *= vColor;

#endif
#ifdef USE_ALPHAMAP

	diffuseColor.a *= texture2D( alphaMap, vUv ).g;

#endif

#ifdef ALPHATEST

	if ( diffuseColor.a < ALPHATEST ) discard;

#endif

float specularStrength;

#ifdef USE_SPECULARMAP

	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;

#else

	specularStrength = 1.0;

#endif
#ifdef USE_AOMAP

	totalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;

#endif

#ifdef USE_SHADOWMAP

	for ( int i = 0; i < MAX_SHADOWS; i ++ ) {

		float texelSizeY =  1.0 / shadowMapSize[ i ].y;

		float shadow = 0.0;

#if defined( POINT_LIGHT_SHADOWS )

		bool isPointLight = shadowDarkness[ i ] < 0.0;

		if ( isPointLight ) {

			float realShadowDarkness = abs( shadowDarkness[ i ] );

			vec3 lightToPosition = vShadowCoord[ i ].xyz;

	#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )

			vec3 bd3D = normalize( lightToPosition );
			float dp = length( lightToPosition );

			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );


	#if defined( SHADOWMAP_TYPE_PCF )
			const float Dr = 1.25;
	#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			const float Dr = 2.25;
	#endif

			float os = Dr *  2.0 * texelSizeY;

			const vec3 Gsd = vec3( - 1, 0, 1 );

			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );

			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );

			shadow *= realShadowDarkness * ( 1.0 / 21.0 );

	#else 
			vec3 bd3D = normalize( lightToPosition );
			float dp = length( lightToPosition );

			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );

			shadow *= realShadowDarkness;

	#endif

		} else {

#endif 
			float texelSizeX =  1.0 / shadowMapSize[ i ].x;

			vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;


			bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
			bool inFrustum = all( inFrustumVec );

			bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );

			bool frustumTest = all( frustumTestVec );

			if ( frustumTest ) {

	#if defined( SHADOWMAP_TYPE_PCF )


				/*
					for ( float y = -1.25; y <= 1.25; y += 1.25 )
						for ( float x = -1.25; x <= 1.25; x += 1.25 ) {
							vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );
							float fDepth = unpackDepth( rgbaDepth );
							if ( fDepth < shadowCoord.z )
								shadow += 1.0;
					}
					shadow /= 9.0;
				*/

				shadowCoord.z += shadowBias[ i ];

				const float ShadowDelta = 1.0 / 9.0;

				float xPixelOffset = texelSizeX;
				float yPixelOffset = texelSizeY;

				float dx0 = - 1.25 * xPixelOffset;
				float dy0 = - 1.25 * yPixelOffset;
				float dx1 = 1.25 * xPixelOffset;
				float dy1 = 1.25 * yPixelOffset;

				float fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );
				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;

				shadow *= shadowDarkness[ i ];

	#elif defined( SHADOWMAP_TYPE_PCF_SOFT )


				shadowCoord.z += shadowBias[ i ];

				float xPixelOffset = texelSizeX;
				float yPixelOffset = texelSizeY;

				float dx0 = - 1.0 * xPixelOffset;
				float dy0 = - 1.0 * yPixelOffset;
				float dx1 = 1.0 * xPixelOffset;
				float dy1 = 1.0 * yPixelOffset;

				mat3 shadowKernel;
				mat3 depthKernel;

				depthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
				depthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
				depthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
				depthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
				depthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );
				depthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
				depthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
				depthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
				depthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );

				vec3 shadowZ = vec3( shadowCoord.z );
				shadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );
				shadowKernel[ 0 ] *= vec3( 0.25 );

				shadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );
				shadowKernel[ 1 ] *= vec3( 0.25 );

				shadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );
				shadowKernel[ 2 ] *= vec3( 0.25 );

				vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );

				shadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );
				shadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );

				vec4 shadowValues;
				shadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );
				shadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );
				shadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );
				shadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );

				shadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];

	#else 
				shadowCoord.z += shadowBias[ i ];

				vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );
				float fDepth = unpackDepth( rgbaDepth );

				if ( fDepth < shadowCoord.z )
					shadow = shadowDarkness[ i ];

	#endif

			}

#ifdef SHADOWMAP_DEBUG

			if ( inFrustum ) {

				if ( i == 0 ) {

					outgoingLight *= vec3( 1.0, 0.5, 0.0 );

				} else if ( i == 1 ) {

					outgoingLight *= vec3( 0.0, 1.0, 0.8 );

				} else {

					outgoingLight *= vec3( 0.0, 0.5, 1.0 );

				}

			}

#endif

#if defined( POINT_LIGHT_SHADOWS )

		}

#endif

		shadowMask = shadowMask * vec3( 1.0 - shadow );

	}

#endif

	outgoingLight = diffuseColor.rgb * totalAmbientLight * shadowMask;
#ifdef USE_ENVMAP

	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )

		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );

		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );

		#ifdef ENVMAP_MODE_REFLECTION

			vec3 reflectVec = reflect( cameraToVertex, worldNormal );

		#else

			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );

		#endif

	#else

		vec3 reflectVec = vReflect;

	#endif

	#ifdef DOUBLE_SIDED
		float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );
	#else
		float flipNormal = 1.0;
	#endif

	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );

	#elif defined( ENVMAP_TYPE_EQUIREC )
		vec2 sampleUV;
		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
		vec4 envColor = texture2D( envMap, sampleUV );

	#elif defined( ENVMAP_TYPE_SPHERE )
		vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
	#endif

	envColor.xyz = inputToLinear( envColor.xyz );

	#ifdef ENVMAP_BLENDING_MULTIPLY

		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );

	#elif defined( ENVMAP_BLENDING_MIX )

		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );

	#elif defined( ENVMAP_BLENDING_ADD )

		outgoingLight += envColor.xyz * specularStrength * reflectivity;

	#endif

#endif


	outgoingLight = linearToOutput( outgoingLight );

#ifdef USE_FOG

	#ifdef USE_LOGDEPTHBUF_EXT

		float depth = gl_FragDepthEXT / gl_FragCoord.w;

	#else

		float depth = gl_FragCoord.z / gl_FragCoord.w;

	#endif

	#ifdef FOG_EXP2

		float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );

	#else

		float fogFactor = smoothstep( fogNear, fogFar, depth );

	#endif
	
	outgoingLight = mix( outgoingLight, fogColor, fogFactor );

#endif
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
}
Ejemplo n.º 9
0
void appl::TestLabel::init() {
    ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
    APPL_DEBUG("CREATE " __class__ " ... ");
    std::shared_ptr<ewol::widget::Sizer> mySizerVert2;
    std::shared_ptr<ewol::widget::Sizer> mySizerHori;
    std::shared_ptr<ewol::widget::Button> myButton;

    mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
    if (nullptr == mySizerHori) {
        APPL_DEBUG("Allocation error mySizerHori");
        return;
    }
    subWidgetAdd(mySizerHori);
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setToggleMode(true);
        myButton->setSubWidget(      ewol::widget::Label::create("Expand X (false)"));
        myButton->setSubWidgetToggle(ewol::widget::Label::create("Expand X (true)"));
        myButton->registerOnEvent(shared_from_this(), "value", l_eventChangeExpendX);
        mySizerHori->subWidgetAdd(myButton);
    }
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setToggleMode(true);
        myButton->setSubWidget(      ewol::widget::Label::create("Expand Y (false)"));
        myButton->setSubWidgetToggle(ewol::widget::Label::create("Expand Y (true)"));
        myButton->registerOnEvent(shared_from_this(), "value", l_eventChangeExpendY);
        mySizerHori->subWidgetAdd(myButton);
    }
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setToggleMode(true);
        myButton->setSubWidget(      ewol::widget::Label::create("Fill X (false)"));
        myButton->setSubWidgetToggle(ewol::widget::Label::create("Fill X (true)"));
        myButton->registerOnEvent(shared_from_this(), "value", l_eventChangeFillX);
        mySizerHori->subWidgetAdd(myButton);
    }
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setToggleMode(true);
        myButton->setSubWidget(      ewol::widget::Label::create("Fill Y (false)"));
        myButton->setSubWidgetToggle(ewol::widget::Label::create("Fill Y (true)"));
        myButton->registerOnEvent(shared_from_this(), "value", l_eventChangeFillY);
        mySizerHori->subWidgetAdd(myButton);
    }
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setToggleMode(true);
        myButton->setSubWidget(      ewol::widget::Label::create("no Max size"));
        myButton->setSubWidgetToggle(ewol::widget::Label::create("maxSize (400,99999999)"));
        myButton->registerOnEvent(shared_from_this(), "value", l_eventChangeMaxSize);
        mySizerHori->subWidgetAdd(myButton);
    }
    myButton = ewol::widget::Button::create();
    if (nullptr != myButton) {
        myButton->setSubWidget(ewol::widget::Label::create("Next Label"));
        myButton->registerOnEvent(shared_from_this(), "pressed", l_eventChangeLabel);
        mySizerHori->subWidgetAdd(myButton);
    }

    std::shared_ptr<ewol::widget::Spacer> mySpacer = ewol::widget::Spacer::create();
    if (nullptr != mySpacer) {
        mySpacer->setExpand(bvec2(false,false));
        mySpacer->setFill(bvec2(true,false));
        mySpacer->setMinSize(vec2(10,10));
        mySpacer->setColor(etk::Color<>(0xFF, 0x00, 0x00, 0x80));
        subWidgetAdd(mySpacer);
    }

    mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
    if (nullptr == mySizerHori) {
        APPL_DEBUG("Allocation error mySizerHori");
        return;
    }
    subWidgetAdd(mySizerHori);
    mySpacer = ewol::widget::Spacer::create();
    if (nullptr != mySpacer) {
        mySpacer->setExpand(bvec2(false,false));
        mySpacer->setFill(bvec2(false,true));
        mySpacer->setMinSize(vec2(10,10));
        mySpacer->setColor(etk::Color<>(0x00, 0xFF, 0x00, 0x80));
        mySizerHori->subWidgetAdd(mySpacer);
    }

    m_testWidget = ewol::widget::Label::create("Basic label");
    if (nullptr != m_testWidget) {
        m_testWidget->setExpand(bvec2(false,false));
        m_testWidget->setFill(bvec2(false,false));
        //m_testWidget->registerOnEvent(shared_from_this(), ewolEventButtonColorChange);
        mySizerHori->subWidgetAdd(m_testWidget);
    }

    mySpacer = ewol::widget::Spacer::create();
    if (nullptr != mySpacer) {
        mySpacer->setExpand(bvec2(false,false));
        mySpacer->setFill(bvec2(false,true));
        mySpacer->setMinSize(vec2(10,10));
        mySpacer->setColor(etk::Color<>(0x00, 0x00, 0xFF, 0x80));
        mySizerHori->subWidgetAdd(mySpacer);
    }

    mySpacer = ewol::widget::Spacer::create();
    if (nullptr != mySpacer) {
        mySpacer->setExpand(bvec2(false,false));
        mySpacer->setFill(bvec2(true,false));
        mySpacer->setMinSize(vec2(10,10));
        mySpacer->setColor(etk::Color<>(0x00, 0xFF, 0xFF, 0x80));
        subWidgetAdd(mySpacer);
    }
}
Ejemplo n.º 10
0
void appl::TestLabel::onReceiveMessage(const ewol::object::Message& _msg) {
    ewol::widget::Sizer::onReceiveMessage(_msg);
    //APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
    if (m_testWidget == _msg.getCaller()) {
        APPL_WARNING("Receive Event from tested Button ... : " << _msg );
    }
    if (_msg.getMessage() == l_eventChangeExpendX) {
        if (nullptr!=m_testWidget) {
            if (_msg.getData()=="true") {
                m_testWidget->setExpand(bvec2(true,m_testWidget->getExpand().y()));
            } else {
                m_testWidget->setExpand(bvec2(true,m_testWidget->getExpand().y()));
            }
        }
    } else if (_msg.getMessage() == l_eventChangeExpendY) {
        if (nullptr!=m_testWidget) {
            if (_msg.getData()=="true") {
                m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(),true));
            } else {
                m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(),false));
            }
        }
    } else if (_msg.getMessage() == l_eventChangeFillX) {
        if (nullptr!=m_testWidget) {
            if (_msg.getData()=="true") {
                m_testWidget->setFill(bvec2(true,m_testWidget->getFill().y()));
            } else {
                m_testWidget->setFill(bvec2(false,m_testWidget->getFill().y()));
            }
        }
    } else if (_msg.getMessage() == l_eventChangeFillY) {
        if (nullptr!=m_testWidget) {
            if (_msg.getData()=="true") {
                m_testWidget->setFill(bvec2(m_testWidget->getFill().x(),true));
            } else {
                m_testWidget->setFill(bvec2(m_testWidget->getFill().x(),false));
            }
        }
    } else if (_msg.getMessage() == l_eventChangeMaxSize) {
        if (nullptr!=m_testWidget) {
            if (_msg.getData()=="true") {
                m_testWidget->setMaxSize(vec2(400,9999999999));
            } else {
                m_testWidget->setNoMaxSize();
            }
        }
    } else if (_msg.getMessage() == l_eventChangeLabel) {
        if (nullptr!=m_testWidget) {
            m_labelId++;
            switch(m_labelId)
            {
            default:
                m_labelId=0;
            case 0:
                m_testWidget->setLabel("Basic label");
                break;
            case 1:
                m_testWidget->setLabel("Basic <bold>label</bold>");
                break;
            case 2:
                m_testWidget->setLabel("<center>\n"
                                       "	Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0000\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement : <br/> Mais non!<br/>  mais non!<br/>  Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
                                       "</center>\n");
                break;
            case 3:
                m_testWidget->setLabel("<left>\n"
                                       "	Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#0F0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/>  Mais non!<br/>  mais non!<br/>  Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
                                       "</left>\n");
                break;
            case 4:
                m_testWidget->setLabel("<right>\n"
                                       "	Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#00F\">Jusqu'à ce moment elle<b> n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/>  Mais non! <br/> mais non!<br/>  Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
                                       "</right>\n");
                break;
            case 5:
                m_testWidget->setLabel("<justify>\n"
                                       "	Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/>  Mais non!<br/>  mais non!<br/>  Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
                                       "</justify>\n");
                break;
            }
        }
    }

    return;
}
Ejemplo n.º 11
0
void globals::ParameterGlobalsGui::init() {
	ewol::widget::Sizer::init();
	propertyMode.set(ewol::widget::Sizer::modeVert);
	ememory::SharedPtr<ewol::widget::CheckBox> myCheckbox;
	ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
	
	mySpacer = ewol::widget::Spacer::create();
	if (mySpacer == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		mySpacer->propertyExpand.set(bvec2(true,true));
		subWidgetAdd(mySpacer);
	}
	myCheckbox = ewol::widget::CheckBox::create();
	if (myCheckbox == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		//TODO : myCheckbox->propertyLabel.set("Automatic Indentation");
		myCheckbox->propertyExpand.set(bvec2(true,false));
		myCheckbox->propertyValue.set(isSetAutoIndent());
		myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
		subWidgetAdd(myCheckbox);
	}
	myCheckbox = ewol::widget::CheckBox::create();
	if (myCheckbox == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		//TODO : myCheckbox->propertyLabel.set("Display space char (' ')");
		myCheckbox->propertyExpand.set(bvec2(true,false));
		myCheckbox->propertyValue.set(isSetDisplaySpaceChar());
		myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
		subWidgetAdd(myCheckbox);
	}
	myCheckbox = ewol::widget::CheckBox::create();
	if (myCheckbox == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		//TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')");
		
		myCheckbox->propertyExpand.set(bvec2(true,false));
		myCheckbox->propertyValue.set(isSetDisplayTabChar());
		myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
		subWidgetAdd(myCheckbox);
	}
	myCheckbox = ewol::widget::CheckBox::create();
	if (myCheckbox == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		//TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')");
		myCheckbox->propertyExpand.set(bvec2(true,false));
		myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
		myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
		subWidgetAdd(myCheckbox);
	}
	myCheckbox = ewol::widget::CheckBox::create();
	if (myCheckbox == nullptr) {
		APPL_ERROR("Can not allocate widget  == > display might be in error");
	} else {
		//TODO : myCheckbox->propertyLabel.set("switch Rounded/default");
		myCheckbox->propertyExpand.set(bvec2(true,false));
		myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
		myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
		subWidgetAdd(myCheckbox);
	}
}
Ejemplo n.º 12
0
bvec2 ewol::Widget::canExpand() {
	if (false == isHide()) {
		return m_userExpand;
	}
	return bvec2(false,false);
}