|
LboxCombo::LboxCombo( HWND hTarget )
{
this->hWnd = hTarget;
List = new LboxListbox( GetParent( hTarget ), 0 );
}
LboxCombo::LboxCombo()
{
List = NULL;
}
LboxCombo::~LboxCombo()
{
delete this->List;
}
// *********************************************************
// コンボボックスにコードと文字列を追加
// 戻り値 : 追加された位置
// *********************************************************
int LboxCombo::Add( LboxString *LScode, LboxString *LString )
{
return LboxCombo::Add(
LScode->szLboxString,
LString->szLboxString
);
}
int LboxCombo::Add( LPTSTR pszCode, LPTSTR pszBuffer )
{
List->Add( pszCode );
return LboxComboAdd(
LboxCombo::hWnd,
pszBuffer
);
}
// *********************************************************
// コンボボックスに文字列を挿入
// 戻り値 : 挿入された位置
// *********************************************************
int LboxCombo::Insert( int nIdx, LPTSTR pszCode, LPTSTR pszBuffer )
{
List->Insert( nIdx, pszCode );
return LboxComboInsert(
LboxCombo::hWnd,
nIdx,
pszBuffer
);
}
// *********************************************************
// コンボボックスの指定行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : 存在しない行を指定すると -1
// *********************************************************
int LboxCombo::Delete( int nIdx )
{
List->Delete( nIdx );
return LboxComboDelete(
LboxCombo::hWnd,
nIdx
);
}
// *********************************************************
// コンボボックスのリセット
// 戻り値 : 無し
// *********************************************************
void LboxCombo::Reset( void )
{
List->Reset();
LboxComboReset( LboxCombo::hWnd );
}
// *********************************************************
// コンボボックスのリストボックス部分の幅の設定
// 戻り値 : 無し
// *********************************************************
void LboxCombo::SetWidth( int nWidth )
{
LboxComboSetWidth(
LboxCombo::hWnd,
nWidth
);
}
// *********************************************************
// コンボボックスの行数取得
// 戻り値 : 行数
// *********************************************************
int LboxCombo::Count( void )
{
return LboxComboCount(
LboxCombo::hWnd
);
}
// *********************************************************
// コンボボックスの指定行を選択
// 戻り値 : 無し
// *********************************************************
void LboxCombo::Select( int nIndex )
{
LboxComboSelect(
LboxCombo::hWnd,
nIndex
);
}
// *********************************************************
// コンボボックス内の文字列の検索
// 戻り値 : 一致する行のインデックス(失敗時は-1)
// *********************************************************
int LboxCombo::FindString( LPTSTR lpFind )
{
return LboxComboFindString(
LboxCombo::hWnd,
lpFind
);
}
// *********************************************************
// コンボボックス内の内部文字列の検索
// 戻り値 : 一致する行のインデックス(失敗時は-1)
// *********************************************************
int LboxCombo::FindStringData( LPTSTR lpFind )
{
List->FindString(
lpFind
);
return 0;
}
// *********************************************************
// コンボボックスの選択された行の取得
// 戻り値 : 選択された行(選択されていない場合は -1 )
// *********************************************************
int LboxCombo::SelectedRow( void )
{
return LboxComboSelectedRow(
LboxCombo::hWnd
);
}
// *********************************************************
// コンボボックスの選択部分の高さの設定
// 戻り値 : 無し
// *********************************************************
void LboxCombo::SetHeight( int nHeight )
{
LboxComboSetHeight(
LboxCombo::hWnd,
nHeight
);
}
// *********************************************************
// コンボボックスから文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombo::GetText( int nIndex, LboxString *LString )
{
int ret;
ret = (int)SendMessage(
LboxCombo::hWnd,
CB_GETLBTEXTLEN,
(WPARAM)nIndex,
0L
);
if ( ret == CB_ERR ) {
return -1;
}
if ( (DWORD)(ret + 1) > LString->nLboxString ) {
LString->Resize( ret + 1 );
}
ret = (int)SendMessage(
hWnd,
CB_GETLBTEXT,
(WPARAM)nIndex,
(LPARAM)(LPCTSTR)LString->szLboxString
);
if ( ret == CB_ERR ) {
return -1;
}
return ret;
}
// *********************************************************
// コンボボックスから内部文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombo::GetData( int nIndex, LboxString *LString )
{
return List->GetText(
nIndex,
LString->szLboxString,
LString->nLboxString
);
}
| |