All pastes #96087 Raw Edit

Anonymous

public text v1 · immutable
#96087 ·published 2006-07-22 17:01 UTC
rendered paste body
LAYOUT:
<?xml version="1.0" ?>
<GUILayout>

<Window Type="Marti/FrameWindow" Name="/Chat">
	<Property Name="UnifiedSize" Value="{{0.4,0}, {0.4,0}}" />
	<Property Name="Alpha" Value="0.8" />
	<Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedPosition" Value="{{0.4,0},{0.2,0}}" />
        <Property Name="Text" Value="Spring Console" />
		<Window Type="Marti/Listbox" Name="/Chat/Wnd/List">
			<Property Name="UnifiedPosition" Value="{{0,5}, {1,-15}}" />
			<Property Name="UnifiedSize" Value="{{1,-10}, {1,-40}}" />
		</Window>
	 	<Window Type="Marti/Editbox" Name="/Chat/Wnd/Edit" >
			<Property Name="UnifiedPosition" Value="{{0,5},{1,-35}}" />
                	<Property Name="UnifiedSize" Value="{{1,-10},{0,30}}" />
                	<Property Name="Text" Value="" />
  		</Window>
</Window>

</GUILayout>

LUA(executed on launch):

function chatHandler(args)
	local editBox = CEGUI.WindowManager:getSingleton():getWindow("/Chat/Wnd/Edit")
	local list = CEGUI.WindowManager:getSingleton():getWindow("/Chat/Wnd/List")
	local item =  CEGUI.ListboxTextItem:new(editBox:getText())
	list:addItem(item)
	list:ensureItemIsVisible(list:getItemCount())
	editBox:setText("")
end


-- get CEGUI singletons
local logger = CEGUI.Logger:getSingleton()
logger:logEvent( ">>> Initializing Spring GUI" )

-- get a local reference to the singletons we use (not required)
local system    = CEGUI.System:getSingleton()
local fontman   = CEGUI.FontManager:getSingleton()
local schememan = CEGUI.SchemeManager:getSingleton()
local winMgr	= CEGUI.WindowManager:getSingleton()
local isMgr	= CEGUI.ImagesetManager:getSingleton()

schememan:loadScheme( "gui/schemes/MartiSkin.scheme" )

-- load a default font
local font = fontman:createFont( "gui/fonts/Commonwealth-10.font" )

-- set default mouse cursor
system:setDefaultMouseCursor( "Marti", "MouseArrow")

w = winMgr:loadWindowLayout("gui/layouts/SpringChatWindow.layout")
w:setVisible(true)
system:setGUISheet(w)
winMgr:getWindow("/Chat/Wnd/Edit"):subscribeEvent("TextAccepted", "chatHandler")

logger:logEvent( "<<< Init script says goodbye" )