bool CMOOSNavTopDownCalEngine::SetState(State eState)
{
    m_eState = eState;

    AddToOutput("Top Down Cal is %s\n",
                GetStateAsString(m_eState).c_str());



    return true;

}
예제 #2
0
    /*****************************************************************************
    * Function...: Redraw
    * DESCRIPTION:
    * 
    *****************************************************************************/
    bool UserIoSourceState::Redraw()
    {
      char text[MAX_STATE_TEXT_LENGTH];

      if (mpChannelConfig.IsValid())
      {
        const char* the_string_to_show;
        CHANNEL_SOURCE_TYPE source = mpChannelConfig->GetSource();
        U8 source_index = mpChannelConfig->GetSourceIndex();
        const int string_id = GetStateStringId(source, source_index);

#ifdef __PC__
        if (g_show_string_ids)
        {
          char string_id_as_text[10];
          sprintf(string_id_as_text, "%d", string_id);
          SetText(string_id_as_text);
          ObserverText::Redraw();
          return true;
        }
#endif
        const char* prefix = "";
        if (mShowPrefix)
        {
          prefix = mpChannelConfig->GetChannelPrefix();
        }

        const char* postfix = GetStringPostfix(source, source_index);
        
        if (source == CHANNEL_SOURCE_COMBI_ALARM)
        {
          StringDataPoint* p_combi_alarm_name = AlarmText::GetInstance()->GetCombiAlarm(source_index);
          if (p_combi_alarm_name != NULL)
          {
            the_string_to_show = p_combi_alarm_name->GetValue();
          }
        }
        else if (string_id != SID_NONE)
        {
          the_string_to_show = Languages::GetInstance()->GetString(string_id);
        }
        else
        {// else retry with GetStateAsString that might have be overridden by derived classes
          the_string_to_show = GetStateAsString(source, source_index);
        }

        if (strlen(the_string_to_show) > 0)
        {
          strcpy(text, Languages::GetInstance()->GetString(SID_DIGITAL_STATE_OPEN_BRACKET));
          strcat(text, prefix);
			    strcat(text, the_string_to_show);
          strcat(text, postfix);
          strcat(text, Languages::GetInstance()->GetString(SID_DIGITAL_STATE_CLOSING_BRACKET));
          SetText(text);
        }
        else
        {
          SetText("");
        }
      }
      else 
      {
   			strcpy(text, Languages::GetInstance()->GetString(SID_DIGITAL_STATE_OPEN_BRACKET));
		    strcat(text, "--");
        strcat(text, Languages::GetInstance()->GetString(SID_DIGITAL_STATE_CLOSING_BRACKET));
        SetText(text);
      }
      
      ObserverText::Redraw();
      
      return true;
    }
예제 #3
0
파일: Window.cpp 프로젝트: caidongyun/libs
/** 
 * 
 * Extracts details pertaining to a window
 * 
 * @param       WindowObj - Window data
 * @return      void
 * @exception   Nil
 * @see         Nil
 * @since       1.0
 */
void Window::ExtractWindowDetails( const HWND hWnd_i )
{
    // Set window handle
    SetHandle( hWnd_i );

    // Set thread id of window
    SetThreadId( ::GetWindowThreadProcessId( GetHandle(), 0 ));

    // Get class name of window
    TCHAR szBuffer[MAX_PATH] = { 0 };
    ::GetClassName( GetHandle(), szBuffer, MAX_PATH );
    GetClassName() = szBuffer;

    GetClass().cbSize = sizeof( GetClass() );
    GetClassInfoEx( AfxGetInstanceHandle(), szBuffer, &GetClass() );

    // Get window text if any
    InternalGetWindowText( GetHandle(), GetTitle().GetBufferSetLength( MAX_PATH ), MAX_PATH );
    GetTitle().ReleaseBuffer();

    // Get normal style
    SetStyle( GetWindowLong( GetHandle(), GWL_STYLE ));

    // Get extended style
    SetStyleEx( GetWindowLong( GetHandle(), GWL_EXSTYLE ));

    // Get window id
    SetId( GetWindowLong( GetHandle(), GWL_ID ));

    // Get parent window
    SetParentHandle( RCAST( HWND, GetWindowLong( GetHandle(), GWL_HWNDPARENT )));

    // Window state i.e. window is maximized, minimized or restored
    GetStateAsString( GetState() );

    // For style parsing
    RetrieveWndStyles();

    // Window bounds
    CRect crBounds;
    GetWindowRect( GetHandle(), &crBounds );
    if( crBounds.Width() || crBounds.Height() )
    {
        GetBounds().Format( _T( "L:%d T:%d R:%d B:%d" ), crBounds.left, 
                                                         crBounds.top, 
                                                         crBounds.right, 
                                                         crBounds.bottom );
    }// End if

    // Retrieves unicode support status for windows
    SetUnicode( IsWindowUnicode( GetHandle() ));

    // Get window icon
    DWORD dwResult = 0;
    Utils::SndMsgTimeOutHelper( GetHandle(), 
                                WM_GETICON, 
                                ICON_SMALL, 
                                0,
                                dwResult );
    // Get window icon
    SetIcon( RCAST( HICON, dwResult ));

    // Get enabled status of window
    SetEnabled( IsWindowEnabled( GetHandle() ));
}// End ExtractWindowDetails