diff options
author | portix <none@none> | 2012-12-01 14:17:53 +0100 |
---|---|---|
committer | portix <none@none> | 2012-12-01 14:17:53 +0100 |
commit | 887b7b3a36424f4319bb9afa8a51af0103a1ea16 (patch) | |
tree | 429d5e14de121f9d89a8193bc6d0b3dfc85e8526 /src/scripts.c | |
parent | f8d42f34d2c146fa14780af3302ad8e70787b941 (diff) | |
download | dwb-887b7b3a36424f4319bb9afa8a51af0103a1ea16.zip |
Implementing all gui.* widgets
Diffstat (limited to 'src/scripts.c')
-rw-r--r-- | src/scripts.c | 73 |
1 files changed, 57 insertions, 16 deletions
diff --git a/src/scripts.c b/src/scripts.c index 3027b1f8..5400e150 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -1641,21 +1641,48 @@ signal_set(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef }/*}}}*/ static JSValueRef -gui_get(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) -{ - if (JSStringIsEqualToUTF8CString(property, "window")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.window), false); - if (JSStringIsEqualToUTF8CString(property, "statusLabel")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.rstatus), false); - if (JSStringIsEqualToUTF8CString(property, "uriLabel")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.urilabel), false); - if (JSStringIsEqualToUTF8CString(property, "uriLabel")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.urilabel), false); - if (JSStringIsEqualToUTF8CString(property, "entry")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.entry), false); - if (JSStringIsEqualToUTF8CString(property, "messageLabel")) - return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.lstatus), false); - return JSValueMakeUndefined(ctx); +gui_get_window(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.window), false); +} +static JSValueRef +gui_get_main_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.vbox), false); +} +static JSValueRef +gui_get_tab_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.topbox), false); +} +static JSValueRef +gui_get_content_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.mainbox), false); +} +static JSValueRef +gui_get_status_widget(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.statusbox), false); +} +static JSValueRef +gui_get_status_alignment(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.alignment), false); +} +static JSValueRef +gui_get_status_box(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.status_hbox), false); +} +static JSValueRef +gui_get_message_label(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.lstatus), false); +} +static JSValueRef +gui_get_entry(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.entry), false); +} +static JSValueRef +gui_get_uri_label(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.urilabel), false); +} +static JSValueRef +gui_get_status_label(JSContextRef ctx, JSObjectRef object, JSStringRef property, JSValueRef* exception) { + return make_object_for_class(ctx, m_default_class, G_OBJECT(dwb.gui.rstatus), false); } /* scripts_emit {{{*/ @@ -2071,9 +2098,23 @@ create_global_object() { cd.parentClass = m_default_class; m_message_class = JSClassCreate(&cd); + static JSStaticValue gui_values[] = { + { "window", gui_get_window, NULL, kJSDefaultAttributes }, + { "mainBox", gui_get_main_box, NULL, kJSDefaultAttributes }, + { "tabBox", gui_get_tab_box, NULL, kJSDefaultAttributes }, + { "contentBox", gui_get_content_box, NULL, kJSDefaultAttributes }, + { "statusWidget", gui_get_status_widget, NULL, kJSDefaultAttributes }, + { "statusAlignment", gui_get_status_alignment, NULL, kJSDefaultAttributes }, + { "statusBox", gui_get_status_box, NULL, kJSDefaultAttributes }, + { "messageLabel", gui_get_message_label, NULL, kJSDefaultAttributes }, + { "entry", gui_get_entry, NULL, kJSDefaultAttributes }, + { "uriLabel", gui_get_uri_label, NULL, kJSDefaultAttributes }, + { "statusLabel", gui_get_status_label, NULL, kJSDefaultAttributes }, + { 0, 0, 0, 0 }, + }; cd.className = "gui"; cd = kJSClassDefinitionEmpty; - cd.getProperty = gui_get; + cd.staticValues = gui_values; class = JSClassCreate(&cd); create_object(m_global_context, class, global_object, kJSDefaultAttributes, "gui", NULL); JSClassRelease(class); |