コード例 #1
0
ファイル: choice.cpp プロジェクト: Duion/Torsion
int wxChoice::DoInsert(
  const wxString&                   rsItem,
  int                               pos
)
{
    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
    wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));

    if (pos == GetCount())
        return DoAppend(rsItem);

    int                             nIndex;
    LONG                            nIndexType = 0;

    if (m_windowStyle & wxLB_SORT)
        nIndexType = LIT_SORTASCENDING;
    else
        nIndexType = pos;
    nIndex = (int)::WinSendMsg( GetHwnd()
                               ,LM_INSERTITEM
                               ,(MPARAM)nIndexType
                               ,(MPARAM)rsItem.c_str()
                              );
    return nIndex;
} // end of wxChoice::DoInsert
コード例 #2
0
ファイル: STRING.CPP プロジェクト: mauriciogsc/Taliman
   void STR_String :: Append( STR_String * pStringParm )
   {

      if ( pStringParm == NULL )
      {
         return ;
      } /* if */
      DoAppend( pStringParm->Length , pStringParm->pCharString ) ;

   } // End of function: STR  !Append a pointed to string
コード例 #3
0
ファイル: STRING.CPP プロジェクト: mauriciogsc/Taliman
   void STR_String :: Append( const char * const pStringParm )
   {

      if ( ( pStringParm == NULL )
        || ( strlen( pStringParm ) == 0 ))
      {
         return ;
      } /* if */
      DoAppend( strlen( pStringParm ) , pStringParm ) ;

   } // End of function: STR  !Append a character string
コード例 #4
0
ファイル: choice.cpp プロジェクト: Duion/Torsion
int wxChoice::DoInsert(const wxString& item, int pos)
{
    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
    wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));

    if (pos == GetCount())
        return DoAppend(item);

    UMAInsertMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item, m_font.GetEncoding() , pos );
    m_strings.Insert( item, pos ) ;
    m_datas.Insert( NULL, pos ) ;
    DoSetItemClientData( pos , NULL ) ;
    m_peer->SetMaximum( GetCount() ) ;
    return pos ;
}
コード例 #5
0
ファイル: menucmn.cpp プロジェクト: czxxjtu/wxPython-1
wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item)
{
    wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") );

    if ( pos == GetMenuItemCount() )
    {
        return DoAppend(item);
    }
    else
    {
        wxCHECK_MSG( pos < GetMenuItemCount(), NULL,
                     wxT("invalid index in wxMenu::Insert") );

        return DoInsert(pos, item);
    }
}
コード例 #6
0
ファイル: combobox.cpp プロジェクト: EdgarTx/wx
int wxComboBox::DoInsert(const wxString& item, unsigned int pos)
{
    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));

    if (pos == GetCount())
        return DoAppend(item);

    wxXmString str( item.c_str() );
    XmComboBoxAddItem((Widget) m_mainWidget, str(), pos+1);
    wxChar* copy = wxStrcpy(new wxChar[item.length() + 1], item.c_str());
    m_stringList.Insert(pos, copy);
    m_noStrings ++;

    return pos;
}
コード例 #7
0
ファイル: STRING.CPP プロジェクト: mauriciogsc/Taliman
   void STR_String ::
        Append( const int          LengthParm ,
                const char * const pStringParm  )
   {

   #ifdef _DEBUG
      EXC_ASSERT( LengthParm  >= 0 ) ;
   #endif

      if ( ( pStringParm == NULL )
        || ( LengthParm  <= 0    ))
      {
         return ;
      } /* if */
      DoAppend( LengthParm , pStringParm ) ;

   } // End of function: STR  !Append a character string of a given length
コード例 #8
0
ファイル: compose.c プロジェクト: mingpen/OpenNT
/*  EnterComposer - start up the compose window, set up hooks, etc.  then spawn
 *                  MAILEDIT editor via DoEditComp, draw compose window.
 *
 *  arguments:
 *      pFileName   name of file to invoke compose on.
 *      pStuffApnd   pointer to string to pass to DoAppend.
 *      fEdit       nonzero => invoke editor
 *
 *  return value:
 *      none.
 *
 */
VOID PASCAL INTERNAL EnterComposer ( PSTR pFileName, PSTR pStuffApnd, FLAG fEdit )
{

    *commandLine = '\0';
    hCompose = NULL;

    pCompFile = ZMMakeStr ( pFileName );
    /*  Make sure file name ends with . because some editors will tack on
     *  their own default extensions if file name doesn't contain a .
     */
    if ( !*strbscan ( pCompFile, strPERIOD ) )
        pCompFile = AppendStr ( pCompFile, strPERIOD, NULL, TRUE );
    DoAppend ( hCommand, (pStuffApnd ? pStuffApnd : strEMPTY), FALSE );
    if ( fEdit )
        DoEditComp ( hCommand, NULL, 0 );
    hFocus = hCompose = ZmReadFile ( pCompFile, "The Composer", TRUE, 0, 0, -xSize,
                         -HdrHeight, readProc, StdSKey );
    BringToTop ( hCommand, FALSE );
    SetScrnSt ( BIGCOMPOSE );
}
コード例 #9
0
ファイル: listbox.cpp プロジェクト: Bluehorn/wxPython
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
                        const wxPoint &pos, const wxSize &size,
                        int n, const wxString choices[],
                        long style, const wxValidator& validator,
                        const wxString &name )
{
    m_needParent = true;
    m_acceptsFocus = true;
    m_prevSelection = 0;  // or -1 ??
    m_blockEvent = false;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxListBox creation failed") );
        return false;
    }

    m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
    if (style & wxLB_ALWAYS_SB)
    {
      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
    }
    else
    {
      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
    }

    m_list = GTK_LIST( gtk_list_new() );

    GtkSelectionMode mode;
    if (style & wxLB_MULTIPLE)
    {
        mode = GTK_SELECTION_MULTIPLE;
    }
    else if (style & wxLB_EXTENDED)
    {
        mode = GTK_SELECTION_EXTENDED;
    }
    else
    {
        // if style was 0 set single mode
        m_windowStyle |= wxLB_SINGLE;
        mode = GTK_SELECTION_SINGLE;
    }

    gtk_list_set_selection_mode( GTK_LIST(m_list), mode );

    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), GTK_WIDGET(m_list) );

    /* make list scroll when moving the focus down using cursor keys */
    gtk_container_set_focus_vadjustment(
        GTK_CONTAINER(m_list),
        gtk_scrolled_window_get_vadjustment(
            GTK_SCROLLED_WINDOW(m_widget)));

    gtk_widget_show( GTK_WIDGET(m_list) );

    gtk_signal_connect( GTK_OBJECT(m_list), "realize",
                        GTK_SIGNAL_FUNC(gtk_listbox_realized_callback), (gpointer) this );

    if ( style & wxLB_SORT )
    {
        // this will change DoAppend() behaviour
        m_strings = new wxSortedArrayString;
    }
    else
    {
        m_strings = (wxSortedArrayString *)NULL;
    }

    for (int i = 0; i < n; i++)
    {
        // add one by one
        DoAppend(choices[i]);
    }

    m_parent->DoAddChild( this );

    PostCreation(size);
    SetInitialSize(size); // need this too because this is a wxControlWithItems

    return true;
}
コード例 #10
0
ファイル: STRING.CPP プロジェクト: mauriciogsc/Taliman
   void STR_String :: Append( const STR_String & StringParm )
   {

      DoAppend( StringParm.Length , StringParm.pCharString ) ;

   } // End of function: STR  !Append a string value