Start re-organizing demos so the physics setup can be shared easier (explicit create graphics objects, init/exit physics etc)
Add B3G_RETURN key code, only implemented in Windows so far (todo: Mac, Linux) Fix Windows key management (use WM_CHAR event instead of WM_KEYUP Add Return (OnKeyReturn) key support TreeNode, so we can select an item using the return key.
This commit is contained in:
@@ -49,17 +49,28 @@ namespace Gwen
|
||||
virtual void SetImage( const TextObject& strName, bool bCenter = false );
|
||||
|
||||
// You can use this to trigger OnPress directly from other controls using GWEN_CALL_EX
|
||||
virtual void ReceiveEventPress( Base* /*pControl*/ ){ OnPress(); }
|
||||
virtual void ReceiveEventPress( Base* /*pControl*/ )
|
||||
{
|
||||
OnPress();
|
||||
}
|
||||
|
||||
virtual void SizeToContents();
|
||||
virtual void Layout( Skin::Base* pSkin );
|
||||
|
||||
virtual bool OnKeyReturn(bool bDown)
|
||||
{
|
||||
onKeyboardReturn.Call(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Gwen::Event::Caller onPress;
|
||||
Gwen::Event::Caller onDown;
|
||||
Gwen::Event::Caller onUp;
|
||||
Gwen::Event::Caller onDoubleClick;
|
||||
Gwen::Event::Caller onKeyboardReturn;
|
||||
|
||||
Gwen::Event::Caller onToggle;
|
||||
Gwen::Event::Caller onToggleOn;
|
||||
Gwen::Event::Caller onToggleOff;
|
||||
|
||||
@@ -72,8 +72,10 @@ void TreeControl::OnNodeAdded( TreeNode* pNode )
|
||||
pNode->onNamePress.Add( this, &TreeControl::OnNodeSelection );
|
||||
}
|
||||
|
||||
|
||||
void TreeControl::OnNodeSelection( Controls::Base* /*control*/ )
|
||||
{
|
||||
//printf("TreeControl::OnNodeSelection\n");
|
||||
if ( !m_bAllowMultipleSelection || !Gwen::Input::IsKeyDown( Key::Control ) )
|
||||
DeselectAll();
|
||||
}
|
||||
|
||||
@@ -132,6 +132,13 @@ void TreeNode::PostLayout( Skin::Base* /*skin*/ )
|
||||
void TreeNode::SetText( const UnicodeString& text ){ m_Title->SetText( text ); };
|
||||
void TreeNode::SetText( const String& text ){ m_Title->SetText( text ); };
|
||||
|
||||
UnicodeString TreeNode::GetText() const
|
||||
{
|
||||
UnicodeString bla = m_Title->GetText();
|
||||
return bla;
|
||||
}
|
||||
|
||||
|
||||
void TreeNode::Open()
|
||||
{
|
||||
m_InnerPanel->Show();
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Gwen
|
||||
|
||||
virtual void SetText( const UnicodeString& text );
|
||||
virtual void SetText( const String& text );
|
||||
UnicodeString GetText() const;
|
||||
|
||||
virtual void Open();
|
||||
virtual void Close();
|
||||
@@ -60,7 +61,18 @@ namespace Gwen
|
||||
virtual void DeselectAll();
|
||||
|
||||
virtual void iterate(int action, int* curIndex, int* resultIndex);
|
||||
|
||||
virtual bool OnKeyReturn(bool bDown)
|
||||
{
|
||||
static bool prevDown = false;
|
||||
if (!prevDown && bDown)
|
||||
{
|
||||
onReturnKeyDown.Call(this);
|
||||
}
|
||||
prevDown = bDown;
|
||||
return Base::OnKeyReturn(bDown);
|
||||
}
|
||||
|
||||
Event::Caller onReturnKeyDown;
|
||||
|
||||
Event::Caller onNamePress;
|
||||
Event::Caller onSelectChange;
|
||||
|
||||
Reference in New Issue
Block a user