inline   bool SBigNode::Set( unicode_t c, bool sens, charset_struct* charset )
{
	unicode_t u1 = c;
	unicode_t u2 = c;

	if ( !sens )
	{
		u2 = UnicodeLC( c );

		if ( u1 == u2 ) { u2 = UnicodeUC( c ); }
	}

	int bad = 0;
	char* s = charset->unicode_to_cs( a, &u1, 1, &bad );

	if ( bad )
	{
		a[0] = b[0] = 0;
		return false;
	}

	*s = 0;

	if ( u1 == u2 )
	{
		b[0] = 0;
	}
	else
	{
		bad = 0;
		s = charset->unicode_to_cs( b, &u2, 1, &bad );

		if ( bad )
		{
			b[0] = 0;
		}
		else { *s = 0; }
	}

	return true;
}
예제 #2
0
	bool PopupMenu::EventKey( cevent_key* pEvent )
	{
		if ( sub.ptr() && sub->EventKey( pEvent ) ) { return true; }

		if ( pEvent->Type() == EV_KEYDOWN )
		{
			int i;

			switch ( pEvent->Key() )
			{
				case VK_DOWN:
					for ( i = ( selected >= 0 && selected + 1 < list.count() ) ? selected + 1 : 0; i < list.count(); i++ )
					{
						if ( !IsSplit( i ) )
						{
							SetSelected( i );
							return true;
						}
					}

					break;

				case  VK_UP:
					for ( i = ( selected > 0 ) ? selected - 1 : list.count() - 1; i >= 0; i-- )
					{
						if ( !IsSplit( i ) )
						{
							SetSelected( i );
							return true;
						}
					}

					break;


				case VK_RIGHT:
					if ( OpenSubmenu() ) { return true; };

					break;

				//case VK_LEFT:
				// return false; // to prevent grabbing default case

				case VK_NUMPAD_RETURN:
				case VK_RETURN:
					if ( IsCmd( selected ) && IsEnabled( selected ) )
					{
						int id = list[selected].data->id;

						if ( IsModal() )
						{
							EndModal( id );
						}
						else if ( Parent() )
						{
							Parent()->Command( id, 0, this, 0 );
						}

						return true;
					}

					return OpenSubmenu();

				case VK_ESCAPE:
					if ( IsModal() )
					{
						EndModal( 0 );
					}
					else if ( Parent() )
					{
						Parent()->Command( CMD_MENU_INFO, SCMD_MENU_CANCEL, this, 0 );
					}
					else {/* Botva */}

					return true;

				default:
				{
					// check if hotkey matches, and process
					// XXX: pEvent->Key() returns key (like Shift-F1, etc). isHotkeyMatching() expects unicode char, which is not the same
					unicode_t c = UnicodeUC( pEvent->Char() );

					for ( int i = 0; i < list.count(); i++ )
					{
						MenuData::Node* node = list[i].data;

						if ( node->leftText.isHotkeyMatching( c ) )
						{
							if ( node->id != 0 ) // menu command
							{
								if ( Parent() )
								{
									Parent()->Command( node->id, 0, this, 0 );
								}

								return true;
							}
							else // sumbenu
							{
								SetSelected( i );
								OpenSubmenu();
								return true;
							}
						}
					}

					return false;
				}

			}
		}

		return false;
	}
예제 #3
0
	Win*  Button::IsHisHotKey(cevent_key* pEvent)
	{
		return text.isHotkeyMatching(UnicodeUC(pEvent->Char()))? this:0;
	}
예제 #4
0
	bool Button::EventKey( cevent_key* pEvent )
	{
		if ((pEvent->Key() == VK_RETURN || pEvent->Key() == VK_NUMPAD_RETURN) || text.isHotkeyMatching(UnicodeUC(pEvent->Char())))
		{
			if (pEvent->Type() == EV_KEYDOWN)
			{
				pressed = true;
			}
			else if (pressed && pEvent->Type() == EV_KEYUP)
			{
				pressed = false;
				SendCommand();
			}
			else
			{
				return false;
			}
		}
		Invalidate();
		return true;
	}
예제 #5
0
	Win* StaticLabel::IsHisHotKey(cevent_key* pEvent)
	{
		return text.isHotkeyMatching(UnicodeUC(pEvent->Char())) ? master : 0;
	}