mirror of
https://github.com/mistergibson/gxg-web-client.git
synced 2026-08-15 03:26:00 -07:00
Various changes - meh
This commit is contained in:
parent
736390876a
commit
e473b70c75
4 changed files with 149 additions and 49 deletions
|
|
@ -440,6 +440,7 @@ module GxG
|
||||||
#
|
#
|
||||||
def menu_item_select(data=nil)
|
def menu_item_select(data=nil)
|
||||||
# override this in your object script.
|
# override this in your object script.
|
||||||
|
# data will contain the entire menu object settings.
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def run(data={})
|
def run(data={})
|
||||||
|
|
|
||||||
|
|
@ -1416,6 +1416,80 @@ module GxG
|
||||||
super()
|
super()
|
||||||
@domtype = :li
|
@domtype = :li
|
||||||
end
|
end
|
||||||
|
#
|
||||||
|
def initialize(the_parent, options, other_data={})
|
||||||
|
@label = nil
|
||||||
|
super(the_parent, options, other_data)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def cascade
|
||||||
|
#
|
||||||
|
label = new_component(:"org.gxg.gui.link.anchor")
|
||||||
|
label.title = "label #{@uuid.to_s}"
|
||||||
|
# label[:options] = {:href => "#0", :content => (@settings[:label] || "Untitled").to_s}
|
||||||
|
label[:options] = {:content => (@settings[:label] || "Untitled").to_s}
|
||||||
|
label[:script] = "
|
||||||
|
on(:mouseup) do |event|
|
||||||
|
if @parent.enabled?
|
||||||
|
@parent.selecct()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
"
|
||||||
|
#
|
||||||
|
page.build_components(self, [(label)], {:application => @application})
|
||||||
|
the_object = page.find_object_by("label #{@uuid.to_s}")
|
||||||
|
if the_object
|
||||||
|
@label = the_object
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def label()
|
||||||
|
@label
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def set_label_text(the_text=nil)
|
||||||
|
if @label
|
||||||
|
@label.set_text(the_text.to_s)
|
||||||
|
@settings[:label] = the_text.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def enabled?()
|
||||||
|
if @label
|
||||||
|
if @label.state_active?(:"menu-item-disabled")
|
||||||
|
false
|
||||||
|
else
|
||||||
|
true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def enable()
|
||||||
|
if @label
|
||||||
|
@label.set_state(:"menu-item-disabled",false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def disable()
|
||||||
|
if @label
|
||||||
|
@label.set_state(:"menu-item-disabled",true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def set_data(data=nil)
|
||||||
|
@settings[:data] = data
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def select(data=nil)
|
||||||
|
application = @parent.application()
|
||||||
|
if application
|
||||||
|
application.menu_item_select(@settings)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu.item", ::GxG::Gui::DropdownMenuItem)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu.item", ::GxG::Gui::DropdownMenuItem)
|
||||||
#
|
#
|
||||||
|
|
@ -1507,6 +1581,7 @@ module GxG
|
||||||
unless @options.keys.include?(:"data-dropdown-menu")
|
unless @options.keys.include?(:"data-dropdown-menu")
|
||||||
@options[:"data-dropdown-menu"] = nil
|
@options[:"data-dropdown-menu"] = nil
|
||||||
end
|
end
|
||||||
|
#
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def add_menu_item(label=nil, data=nil)
|
def add_menu_item(label=nil, data=nil)
|
||||||
|
|
@ -1516,20 +1591,13 @@ module GxG
|
||||||
the_item[:options] = {}
|
the_item[:options] = {}
|
||||||
the_item[:script] = ""
|
the_item[:script] = ""
|
||||||
the_item[:content] = []
|
the_item[:content] = []
|
||||||
page.build_components(self, [(the_item)])
|
page.build_components(self, [(the_item)], {:application => @application})
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu", ::GxG::Gui::DropdownMenu)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.dropdown.menu", ::GxG::Gui::DropdownMenu)
|
||||||
#
|
#
|
||||||
class MenuBar < ::GxG::Gui::DropdownMenu
|
class MenuBar < ::GxG::Gui::DropdownMenu
|
||||||
def set_application(the_application=nil)
|
|
||||||
@application = the_application
|
|
||||||
end
|
|
||||||
#
|
|
||||||
def application()
|
|
||||||
@application
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.menu.bar", ::GxG::Gui::MenuBar)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.menu.bar", ::GxG::Gui::MenuBar)
|
||||||
#
|
#
|
||||||
|
|
@ -1545,17 +1613,10 @@ module GxG
|
||||||
def add_menu_item(label=nil, data=nil)
|
def add_menu_item(label=nil, data=nil)
|
||||||
the_item = new_component(:"org.gxg.gui.menu.item")
|
the_item = new_component(:"org.gxg.gui.menu.item")
|
||||||
the_item[:settings] = {:label => label, :data => data}
|
the_item[:settings] = {:label => label, :data => data}
|
||||||
page.build_components(self, [(the_item)])
|
page.build_components(self, [(the_item)], {:application => @application})
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def set_application(the_application=nil)
|
|
||||||
@application = the_application
|
|
||||||
end
|
|
||||||
#
|
|
||||||
def application()
|
|
||||||
@application
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
::GxG::Gui::register_component_class(:"org.gxg.gui.menu", ::GxG::Gui::Menu)
|
::GxG::Gui::register_component_class(:"org.gxg.gui.menu", ::GxG::Gui::Menu)
|
||||||
#
|
#
|
||||||
|
|
@ -1565,9 +1626,9 @@ module GxG
|
||||||
@domtype = :li
|
@domtype = :li
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def initialize(the_parent, options)
|
def initialize(the_parent, options, other_data={})
|
||||||
@label = nil
|
@label = nil
|
||||||
super(the_parent, options)
|
super(the_parent, options, other_data)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
|
|
@ -1579,24 +1640,54 @@ module GxG
|
||||||
label[:options] = {:content => (@settings[:label] || "Untitled").to_s}
|
label[:options] = {:content => (@settings[:label] || "Untitled").to_s}
|
||||||
label[:script] = "
|
label[:script] = "
|
||||||
on(:mouseup) do |event|
|
on(:mouseup) do |event|
|
||||||
@parent.selecct()
|
if @parent.enabled?
|
||||||
|
@parent.selecct()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
"
|
"
|
||||||
#
|
#
|
||||||
page.build_components(self, [(label)])
|
page.build_components(self, [(label)], {:application => @application})
|
||||||
the_object = page.find_object_by("label #{@uuid.to_s}")
|
the_object = page.find_object_by("label #{@uuid.to_s}")
|
||||||
if the_object
|
if the_object
|
||||||
@label = the_object
|
@label = the_object
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def set_label(the_text=nil)
|
def label()
|
||||||
|
@label
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def set_label_text(the_text=nil)
|
||||||
if @label
|
if @label
|
||||||
@label.set_text(the_text.to_s)
|
@label.set_text(the_text.to_s)
|
||||||
@settings[:label] = the_text.to_s
|
@settings[:label] = the_text.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
|
def enabled?()
|
||||||
|
if @label
|
||||||
|
if @label.state_active?(:"menu-item-disabled")
|
||||||
|
false
|
||||||
|
else
|
||||||
|
true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def enable()
|
||||||
|
if @label
|
||||||
|
@label.set_state(:"menu-item-disabled",false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def disable()
|
||||||
|
if @label
|
||||||
|
@label.set_state(:"menu-item-disabled",true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
def set_data(data=nil)
|
def set_data(data=nil)
|
||||||
@settings[:data] = data
|
@settings[:data] = data
|
||||||
end
|
end
|
||||||
|
|
@ -1604,7 +1695,7 @@ module GxG
|
||||||
def select(data=nil)
|
def select(data=nil)
|
||||||
application = @parent.application()
|
application = @parent.application()
|
||||||
if application
|
if application
|
||||||
application.menu_item_select(@settings[:data])
|
application.menu_item_select(@settings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -519,6 +519,14 @@ module GxG
|
||||||
def toggle_state(the_state)
|
def toggle_state(the_state)
|
||||||
self.set_state(the_state,(! self.get_state(the_state)))
|
self.set_state(the_state,(! self.get_state(the_state)))
|
||||||
end
|
end
|
||||||
|
#
|
||||||
|
def set_application(the_application=nil)
|
||||||
|
@application = the_application
|
||||||
|
end
|
||||||
|
#
|
||||||
|
def application()
|
||||||
|
@application
|
||||||
|
end
|
||||||
# Determine if the state is active
|
# Determine if the state is active
|
||||||
#
|
#
|
||||||
# @param [String] state The state name
|
# @param [String] state The state name
|
||||||
|
|
|
||||||
|
|
@ -479,34 +479,34 @@ module GxG
|
||||||
@menu_reference
|
@menu_reference
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def menu()
|
def menubar()
|
||||||
@menu_bar
|
@menu_area
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
def set_menu(the_menu_source=nil)
|
# def set_menu(the_menu_source=nil)
|
||||||
if the_menu_source.is_any?(::Hash, ::GxG::Database::DetachedHash)
|
# if the_menu_source.is_any?(::Hash, ::GxG::Database::DetachedHash)
|
||||||
if @menu_area
|
# if @menu_area
|
||||||
page.build_components(@menu_area, [(the_menu_source)])
|
# page.build_components(@menu_area, [(the_menu_source)])
|
||||||
#
|
# #
|
||||||
@menu_margin = (`#{@menu_area.element}.getBoundingClientRect().bottom - #{@menu_area.element}.getBoundingClientRect().top`.to_i)
|
# @menu_margin = (`#{@menu_area.element}.getBoundingClientRect().bottom - #{@menu_area.element}.getBoundingClientRect().top`.to_i)
|
||||||
#
|
# #
|
||||||
@menu_bar = self.find_child(@menu_reference,true)
|
# @menu_bar = self.find_child(@menu_reference,true)
|
||||||
#
|
# #
|
||||||
if @menu_bar
|
# if @menu_bar
|
||||||
self.commit_settings
|
# self.commit_settings
|
||||||
true
|
# true
|
||||||
else
|
# else
|
||||||
log_warn("Unable to properly initialize window menu #{@menu_reference.inspect} .")
|
# log_warn("Unable to properly initialize window menu #{@menu_reference.inspect} .")
|
||||||
false
|
# false
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
false
|
# false
|
||||||
end
|
# end
|
||||||
else
|
# else
|
||||||
false
|
# false
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
alias :menu= :set_menu
|
# alias :menu= :set_menu
|
||||||
#
|
#
|
||||||
alias :original_add_child :add_child
|
alias :original_add_child :add_child
|
||||||
def add_child(object_record=nil)
|
def add_child(object_record=nil)
|
||||||
|
|
@ -1223,7 +1223,7 @@ module GxG
|
||||||
build_list << resizing_areas
|
build_list << resizing_areas
|
||||||
#
|
#
|
||||||
@content = nil
|
@content = nil
|
||||||
page.build_components(self,build_list)
|
page.build_components(self,build_list, {:application => @application})
|
||||||
# self.build_interior_components(build_list)
|
# self.build_interior_components(build_list)
|
||||||
#
|
#
|
||||||
the_object = page.find_object_by(interior_component_uuid)
|
the_object = page.find_object_by(interior_component_uuid)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue