Browse Source

Merge pull request #6950 from rdb/master

Add "Never" underline mode to LinkButton
Rémi Verschelde 8 years ago
parent
commit
21828209ec
3 changed files with 9 additions and 4 deletions
  1. 3 0
      doc/base/classes.xml
  2. 4 3
      scene/gui/link_button.cpp
  3. 2 1
      scene/gui/link_button.h

+ 3 - 0
doc/base/classes.xml

@@ -20298,6 +20298,9 @@
 		<constant name="UNDERLINE_MODE_ON_HOVER" value="1">
 		<constant name="UNDERLINE_MODE_ON_HOVER" value="1">
 			The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it.
 			The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it.
 		</constant>
 		</constant>
+		<constant name="UNDERLINE_MODE_NEVER" value="2">
+			The LinkButton will never show an underline at the bottom of its text.
+		</constant>
 	</constants>
 	</constants>
 	<theme_items>
 	<theme_items>
 		<theme_item name="font" type="Font">
 		<theme_item name="font" type="Font">

+ 4 - 3
scene/gui/link_button.cpp

@@ -87,13 +87,13 @@ void LinkButton::_notification(int p_what) {
 					else
 					else
 						color=get_color("font_color");
 						color=get_color("font_color");
 
 
-					do_underline=true;
+					do_underline=underline_mode!=UNDERLINE_MODE_NEVER;
 
 
 				} break;
 				} break;
 				case DRAW_HOVER: {
 				case DRAW_HOVER: {
 
 
 					color=get_color("font_color_hover");
 					color=get_color("font_color_hover");
-					do_underline=true;
+					do_underline=underline_mode!=UNDERLINE_MODE_NEVER;
 
 
 				} break;
 				} break;
 				case DRAW_DISABLED: {
 				case DRAW_DISABLED: {
@@ -139,9 +139,10 @@ void LinkButton::_bind_methods() {
 
 
 	BIND_CONSTANT( 	UNDERLINE_MODE_ALWAYS );
 	BIND_CONSTANT( 	UNDERLINE_MODE_ALWAYS );
 	BIND_CONSTANT( 	UNDERLINE_MODE_ON_HOVER );
 	BIND_CONSTANT( 	UNDERLINE_MODE_ON_HOVER );
+	BIND_CONSTANT( 	UNDERLINE_MODE_NEVER );
 
 
 	ADD_PROPERTYNZ(PropertyInfo(Variant::STRING,"text"), _SCS("set_text"), _SCS("get_text"));
 	ADD_PROPERTYNZ(PropertyInfo(Variant::STRING,"text"), _SCS("set_text"), _SCS("get_text"));
-	ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"underline",PROPERTY_HINT_ENUM,"Always,On Hover"), _SCS("set_underline_mode"), _SCS("get_underline_mode"));
+	ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"underline",PROPERTY_HINT_ENUM,"Always,On Hover,Never"), _SCS("set_underline_mode"), _SCS("get_underline_mode"));
 
 
 }
 }
 
 

+ 2 - 1
scene/gui/link_button.h

@@ -40,7 +40,8 @@ public:
 
 
 	enum UnderlineMode {
 	enum UnderlineMode {
 		UNDERLINE_MODE_ALWAYS,
 		UNDERLINE_MODE_ALWAYS,
-		UNDERLINE_MODE_ON_HOVER
+		UNDERLINE_MODE_ON_HOVER,
+		UNDERLINE_MODE_NEVER
 	};
 	};
 private:
 private:
 	String text;
 	String text;