summaryrefslogtreecommitdiff
path: root/libs/patch/0006-JQM-Apply-Tizen-button-style.patch
blob: b244a82faabd2c5bde6a50d7760bd97a9b0afdbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From 3fea934afc1252e6476750d86e450a61e6d8b816 Mon Sep 17 00:00:00 2001
From: wongi11.lee <wongi11.lee@samsung.com>
Date: Fri, 8 Jun 2012 19:58:19 +0900
Subject: [PATCH] JQM:Apply Tizen button style.

Signed-off-by: Wongi Lee <wongi11.lee@samsung.com>
Signed-off-by: Hyunjung Kim <hjnim.kim@samsung.com>
---
 .../js/jquery.mobile.buttonMarkup.js               |   59 ++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/libs/js/jquery-mobile-1.1.0/js/jquery.mobile.buttonMarkup.js b/libs/js/jquery-mobile-1.1.0/js/jquery.mobile.buttonMarkup.js
index c5f32b4..d1b992b 100644
--- a/libs/js/jquery-mobile-1.1.0/js/jquery.mobile.buttonMarkup.js
+++ b/libs/js/jquery-mobile-1.1.0/js/jquery.mobile.buttonMarkup.js
@@ -1,3 +1,22 @@
+/*
+* "buttons" plugin - for making button-like links
+*/
+
+/*
+ * Button Markup modified for TIZEN style.
+ *
+ * HTML Attributes:
+ *
+ *		data-role: button
+ *		data-style: circle, nobg, edit
+ *
+ * Examples:
+ *
+ *  	<div data-role="button" data-inline="true" data-icon="send" data-style="circle"></div>
+ *  	<div data-role="button" data-inline="true" data-icon="favorite" data-style="nobg">
+ *  	<div data-role="button" data-inline="true" data-icon="editminus" data-style="edit"></div>
+ */
+
 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
 //>>description: Applies button styling to links
 //>>label: Buttons: Link-based
@@ -74,6 +93,63 @@ $.fn.buttonMarkup = function( options ) {
 		buttonClass += o.shadow ? " ui-shadow" : "";
 		buttonClass += o.corners ? " ui-btn-corner-all" : "";
 
+		// To distinguish real buttons
+		if( el.jqmData("role") == "button" || e.tagName == "BUTTON" || e.tagName == "A" ){
+			buttonClass += " ui-btn-box-" + o.theme;
+		}
+
+		/* TIZEN style markup */
+		buttonStyle = el.jqmData("style");
+
+		if ( buttonStyle == "circle" ) {
+			/* style : no text, Icon only */
+			buttonClass += " ui-btn-corner-circle";
+			buttonClass += " ui-btn-icon_only";
+		} else if ( buttonStyle == "nobg" ) {
+			/* style : no text, Icon only, no bg */
+			buttonClass += " ui-btn-icon-nobg";
+			buttonClass += " ui-btn-icon_only";
+		} else if ( buttonStyle == "edit" ) {
+			buttonClass += " ui-btn-edit";
+		}
+
+		if ( o.icon ) {
+			if ( $(el).text().length > 0 ) {
+				/* o.iconpos == "right" ?
+					textClass += " ui-btn-text-padding-right" :
+					textClass += " ui-btn-text-padding-left"; */
+
+				switch ( o.iconpos ) {
+				case "right" :
+				case "left" :
+				case "top" :
+				case "bottom" :
+					textClass += " ui-btn-text-padding-" + o.iconpos;
+					break;
+				default:
+					textClass += " ui-btn-text-padding-left";
+					break;
+				}
+
+				innerClass += " ui-btn-hastxt";
+			} else {
+				if ( buttonStyle == "circle" ) {
+					/* style : no text, Icon only */
+					innerClass += " ui-btn-corner-circle";
+				} else if ( buttonStyle == "nobg" ) {
+					/* style : no text, Icon only, no bg */
+					innerClass += " ui-btn-icon-nobg";
+				}
+
+				buttonClass += " ui-btn-icon_only";
+				innerClass += " ui-btn-icon-only";
+			}
+		} else {
+			if ( $(el).text().length > 0 ) {
+				innerClass += " ui-btn-hastxt";
+			}
+		}
+
 		if ( o.mini !== undefined ) {
 			// Used to control styling in headers/footers, where buttons default to `mini` style.
 			buttonClass += o.mini ? " ui-mini" : " ui-fullsize";
-- 
1.7.0.4