From 2a9053a588390364cc66c3fed94d777e9bca838d Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Thu, 1 Sep 2011 09:35:45 +0000 Subject: [PATCH] add Ox.Progressbar --- source/Ox.UI/css/Ox.UI.css | 10 ++++++++ source/Ox.UI/js/Bar/Ox.Progressbar.js | 31 +++++++++++++++++++++++ source/Ox.UI/js/List/Ox.List.js | 1 - source/Ox.UI/themes/modern/css/modern.css | 9 +++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 source/Ox.UI/js/Bar/Ox.Progressbar.js diff --git a/source/Ox.UI/css/Ox.UI.css b/source/Ox.UI/css/Ox.UI.css index 7b521a07..4dc1459c 100644 --- a/source/Ox.UI/css/Ox.UI.css +++ b/source/Ox.UI/css/Ox.UI.css @@ -69,6 +69,16 @@ Bars white-space: nowrap; } +.OxProgressbar { + height: 16px; + border-radius: 8px; +} +.OxProgressbar > div { + width: 16px; + height: 16px; + border-radius: 8px; +} + .OxResizebar { z-index: 2; } diff --git a/source/Ox.UI/js/Bar/Ox.Progressbar.js b/source/Ox.UI/js/Bar/Ox.Progressbar.js new file mode 100644 index 00000000..0147b46d --- /dev/null +++ b/source/Ox.UI/js/Bar/Ox.Progressbar.js @@ -0,0 +1,31 @@ +Ox.Progressbar = function(options, self) { + + self = self || {}; + var that = Ox.Element({}, self) + .defaults({ + progress: 0, + width: 256 + }) + .options(options || {}) + .addClass('OxProgressbar') + .css({width: self.options.width}); + + self.$progress = $('
').appendTo(that); + + setProgress(); + + function setProgress() { + self.$progress.css({ + width: Math.round(16 + self.options.progress * (self.options.width - 16)) + 'px' + }); + } + + self.setOption = function(key, value) { + if (key == 'progress') { + setProgress(); + } + } + + return that; + +}; \ No newline at end of file diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index db6305d8..f975e0c5 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -697,7 +697,6 @@ Ox.List = function(options, self) { offset = page * self.pageLength, range = [offset, offset + getPageLength(page)]; if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already - Ox.print('###################################', self.listLength, getPageLength(0)) self.$pages[page] = constructEmptyPage(page); self.options.type == 'text' && page == 0 && fillFirstPage(); self.$pages[page].appendTo(that.$content); diff --git a/source/Ox.UI/themes/modern/css/modern.css b/source/Ox.UI/themes/modern/css/modern.css index ea95c674..2511aad0 100644 --- a/source/Ox.UI/themes/modern/css/modern.css +++ b/source/Ox.UI/themes/modern/css/modern.css @@ -30,6 +30,15 @@ Bars background: -webkit-linear-gradient(top, rgb(64, 64, 64), rgb(32, 32, 32)); } +.OxThemeModern .OxProgressbar { + background: -moz-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32)); + background: -webkit-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32)); +} +.OxThemeModern .OxProgressbar > div { + background: -moz-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64)); + background: -webkit-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64)); +} + .OxThemeModern .OxResizebar > .OxLine { background-color: rgb(48, 48, 48); }