Fixed a couple of minor bugs.

This commit is contained in:
spartanj
2010-12-26 18:36:32 -03:00
parent 820c441934
commit 0dfe1eb72e
10 changed files with 47 additions and 13 deletions

View File

@@ -51,7 +51,7 @@ void cConsole::Create( cFont* Font, const bool& MakeDefaultCommands, const eeUin
mTBuf.Start();
mTBuf.SupportNewLine( false );
mTBuf.Active( false );
IgnoreCharOnPrompt( 9 );
IgnoreCharOnPrompt( KEY_TAB );
mCon.ConModif = 0;
@@ -300,12 +300,18 @@ void cConsole::PrintCommandsStartingWith( const std::wstring& start ) {
} else if ( cmds.size() ) {
mTBuf.Buffer( cmds.front() );
mTBuf.CurPos( (Uint32)cmds.front().size() );
mTBuf.CursorToEnd();
}
}
void cConsole::PrivInputCallback( EE_Event* Event ) {
switch( Event->type ) {
case SDL_KEYUP:
if ( mVisible ) {
if ( ( Event->key.keysym.sym == SDLK_TAB ) && (eeUint)mTBuf.CurPos() == mTBuf.Buffer().size() ) {
PrintCommandsStartingWith( mTBuf.Buffer() );
}
}
case SDL_KEYDOWN:
if ( mVisible ) {
if ( mLastCommands.size() > 0 ) {

View File

@@ -657,7 +657,6 @@ void cEETest::CreateUI() {
TEParams.PosSet( 5, 245 );
TEParams.Size = eeSize( 315, 130 );
TEParams.Flags = UI_AUTO_PADDING | UI_CLIP_ENABLE;
//TEParams.WordWrap = false;
cUITextEdit * TextEdit = eeNew( cUITextEdit, ( TEParams ) );
TextEdit->Visible( true );
TextEdit->Enabled( true );

View File

@@ -74,6 +74,8 @@ void cUIListBoxItem::Select() {
}
void cUIListBoxItem::Update() {
cUITextBox::Update();
if ( mEnabled && mVisible ) {
cUIListBox * LBParent = reinterpret_cast<cUIListBox*> ( Parent()->Parent() );
Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger();

View File

@@ -307,9 +307,11 @@ Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
case cUIMessage::MsgMouseUp:
{
cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked );
SendEvent( &ItemEvent );
if ( Msg->Sender()->Parent() == this && Msg->Sender()->Parent()->Visible() && ( Msg->Flags() & EE_BUTTONS_LRM ) ) {
cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked );
SendEvent( &ItemEvent );
}
return 1;
}
case cUIMessage::MsgFocusLoss:

View File

@@ -78,7 +78,8 @@ void cUIMenuCheckBox::SwitchActive() {
Uint32 cUIMenuCheckBox::OnMouseUp( const eeVector2i &Pos, Uint32 Flags ) {
cUIMenuItem::OnMouseUp( Pos, Flags );
SwitchActive();
if ( Parent()->Visible() && ( Flags & EE_BUTTONS_LRM ) )
SwitchActive();
return 1;
}

View File

@@ -64,7 +64,7 @@ Uint32 cUIPopUpMenu::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
case cUIMessage::MsgMouseUp:
{
if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) ) {
if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) && ( Msg->Flags() & EE_BUTTONS_LRM ) ) {
SendCommonEvent( cUIEvent::EventOnHideByClick );
Hide();

View File

@@ -58,9 +58,10 @@ class EE_API cUISlider : public cUIControlAnim {
const bool& AllowHalfSliderOut() const;
const bool& ExpandBackground() const;
void ManageClick( const Uint32& Flags );
protected:
friend class Private::cUISliderButton;
friend class cUIListBoxItem;
bool mVertical;
bool mAllowHalfSliderOut;
@@ -80,8 +81,6 @@ class EE_API cUISlider : public cUIControlAnim {
void FixSliderPos();
void ManageClick( const Uint32& Flags );
virtual Uint32 OnKeyDown( const cUIEventKey &Event );
virtual void OnAlphaChange();

View File

@@ -45,7 +45,7 @@ void cUITextBox::Draw() {
);
}
mTextCache->Draw( (eeFloat)mScreenPos.x + mAlignOffset.x + (eeFloat)mPadding.Left + 1.f, (eeFloat)mScreenPos.y + mAlignOffset.y + (eeFloat)mPadding.Top, Flags(), 1.f, 0.f, mBlend );
mTextCache->Draw( (eeFloat)mScreenPos.x + mAlignOffset.x + (eeFloat)mPadding.Left, (eeFloat)mScreenPos.y + mAlignOffset.y + (eeFloat)mPadding.Top, Flags(), 1.f, 0.f, mBlend );
if ( mFlags & UI_CLIP_ENABLE ) {
cEngine::instance()->ClipPlaneDisable();

View File

@@ -1,9 +1,9 @@
#include "cuitextedit.hpp"
#include "cuimanager.hpp"
namespace EE { namespace UI {
cUITextEdit::cUITextEdit( cUITextEdit::CreateParams& Params ) :
cUIControlAnim( Params ),
mTextInput( NULL ),
mHScrollBar( NULL ),
@@ -345,4 +345,23 @@ void cUITextEdit::ShrinkText( const Uint32& Width ) {
}
}
void cUITextEdit::Update() {
cUIControlAnim::Update();
if ( mTextInput->Enabled() && mTextInput->Visible() && mTextInput->IsMouseOver() && mVScrollBar->Visible() ) {
Uint32 Flags = cUIManager::instance()->GetInput()->ClickTrigger();
if ( Flags & EE_BUTTONS_WUWD )
mVScrollBar->Slider()->ManageClick( Flags );
}
}
void cUITextEdit::AllowEditing( const bool& allow ) {
mTextInput->AllowEditing( allow );
}
const bool& cUITextEdit::AllowEditing() const {
return mTextInput->AllowEditing();
}
}}

View File

@@ -42,6 +42,12 @@ class EE_API cUITextEdit : public cUIControlAnim {
cUIScrollBar * HScrollBar() const;
cUIScrollBar * VScrollBar() const;
virtual void Update();
void AllowEditing( const bool& allow );
const bool& AllowEditing() const;
protected:
cUITextInput * mTextInput;
cUIScrollBar * mHScrollBar;