|
|
// *********************************************************
// 拡張コンストラクタ
// *********************************************************
LboxCombobox::LboxCombobox( HWND hTarget )
{
this->hWnd = hTarget;
List = new LboxListbox( GetParent( hTarget ), 0 );
LboxCombobox::bCreate = false;
}
LboxCombobox::LboxCombobox( HWND hOwner, int nID )
{
this->hWnd = CreateWindow(
"combobox",
NULL,
WS_CHILD | CBS_DROPDOWNLIST,
0,0,0,0,
hOwner,
(HMENU)nID,
LboxGetInstance( hOwner ),
NULL
);
List = new LboxListbox( hOwner, 0 );
LboxCombobox::bCreate = true;
}
// *********************************************************
// デフォルトコンストラクタ
// *********************************************************
LboxCombobox::LboxCombobox()
{
LboxCombobox::bCreate = false;
List = NULL;
}
// *********************************************************
// デストラクタ
// *********************************************************
LboxCombobox::~LboxCombobox()
{
delete this->List;
if ( LboxCombobox::bCreate ) {
if ( this->hWnd != NULL ) {
DestroyWindow( this->hWnd );
this->hWnd = NULL;
}
}
}
| |
|
|
|
|
// *********************************************************
// コンボボックスにコードと文字列を追加
// 戻り値 : 追加された位置
// *********************************************************
int LboxCombobox::Add( LboxString *LScode, LboxString *LString )
{
return LboxCombobox::Add(
LScode->szLboxString,
LString->szLboxString
);
}
int LboxCombobox::Add( LPTSTR pszCode, LPTSTR pszBuffer )
{
List->Add( pszCode );
return LboxComboAdd(
LboxCombobox::hWnd,
pszBuffer
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスに文字列を挿入
// 戻り値 : 挿入された位置
// *********************************************************
int LboxCombobox::Insert( int nIdx, LboxString *LScode, LboxString *LString )
{
return LboxCombobox::Insert(
nIdx,
LScode->szLboxString,
LString->szLboxString
);
}
int LboxCombobox::Insert( int nIdx, LPTSTR pszCode, LPTSTR pszBuffer )
{
List->Insert( nIdx, pszCode );
return LboxComboInsert(
LboxCombobox::hWnd,
nIdx,
pszBuffer
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスの指定行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : 存在しない行を指定すると -1
// *********************************************************
int LboxCombobox::Delete( int nIdx )
{
List->Delete( nIdx );
return LboxComboDelete(
LboxCombobox::hWnd,
nIdx
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスのリセット
// 戻り値 : 無し
// *********************************************************
void LboxCombobox::Reset( void )
{
List->Reset();
LboxComboReset( LboxCombobox::hWnd );
}
| |
|
|
|
|
// *********************************************************
// コンボボックスのリストボックス部分の幅の設定
// 戻り値 : 無し
// *********************************************************
void LboxCombobox::SetWidth( int nWidth )
{
LboxComboSetWidth(
LboxCombobox::hWnd,
nWidth
);
}
| |
|
|
// *********************************************************
// コンボボックスの選択部分の高さの設定
// 戻り値 : 無し
// *********************************************************
void LboxCombobox::SetHeight( int nHeight )
{
LboxComboSetHeight(
LboxCombobox::hWnd,
nHeight
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスの行数取得
// 戻り値 : 行数
// *********************************************************
int LboxCombobox::Count( void )
{
return LboxComboCount(
LboxCombobox::hWnd
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスの指定行を選択
// 戻り値 : 無し
// *********************************************************
void LboxCombobox::Select( int nIndex )
{
LboxComboSelect(
LboxCombobox::hWnd,
nIndex
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックス内の文字列の検索
// 戻り値 : 一致する行のインデックス(失敗時は-1)
// *********************************************************
int LboxCombobox::FindString( LboxString *LString )
{
return LboxCombobox::FindString( LString->szLboxString );
}
int LboxCombobox::FindString( LPTSTR lpFind )
{
return LboxComboFindString(
LboxCombobox::hWnd,
lpFind
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックス内の内部文字列の検索
// 戻り値 : 一致する行のインデックス(失敗時は-1)
// *********************************************************
int LboxCombobox::FindData( LboxString *LString )
{
return LboxCombobox::FindData( LString->szLboxString );
}
int LboxCombobox::FindData( LPTSTR lpFind )
{
return List->FindString(
lpFind
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスの選択された行の取得
// 戻り値 : 選択された行(選択されていない場合は -1 )
// *********************************************************
int LboxCombobox::SelectedRow( void )
{
return LboxComboSelectedRow(
LboxCombobox::hWnd
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスから文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombobox::GetText( int nIndex, LboxString *LString )
{
int ret;
ret = (int)SendMessage(
LboxCombobox::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 LboxCombobox::GetData( int nIndex, LboxString *LString )
{
return List->GetText(
nIndex,
LString
);
}
| |
|
|
|
|
// *********************************************************
// コンボボックスの指定行を更新
// 戻り値 : 挿入された位置
// 戻り値 : 失敗すると -1
// *********************************************************
int LboxCombobox::SetText( int nIndex, LboxString *LString )
{
return LboxCombobox::SetText(
nIndex,
LString->szLboxString
);
}
int LboxCombobox::SetText( int nIndex, LPTSTR lpString )
{
return LboxComboSetText(
LboxCombobox::hWnd,
nIndex,
lpString
);
}
| |
|
|
|
|
// *********************************************************
// 選択した行の文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombobox::SelectedGetText( LboxString *LString )
{
int ret,nIndex;
nIndex = LboxCombobox::SelectedRow();
if ( nIndex == -1 ) {
return -1;
}
ret = LboxCombobox::GetText( nIndex, LString );
if ( ret == -1 ) {
return -1;
}
return ret;
}
| |
|
|
|
|
// *********************************************************
// 選択した行に文字列を設定
// 戻り値 : 挿入された位置
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombobox::SelectedSetText( LboxString *LString )
{
return LboxCombobox::SelectedSetText( LString->szLboxString );
}
int LboxCombobox::SelectedSetText( LPCTSTR pszBuffer )
{
return LboxComboSelectedSetText(
LboxCombobox::hWnd,
pszBuffer
);
}
| |
|
|
|
|
// *********************************************************
// 選択した行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombobox::SelectedDelete( HWND hWnd )
{
int nIdx;
nIdx = LboxCombobox::SelectedRow();
List->Delete( nIdx );
return LboxComboSelectedDelete( LboxCombobox::hWnd );
}
| |
|
|
|
|
// *********************************************************
// 選択した行の内部文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxCombobox::SelectedGetData( LboxString *LString )
{
int ret,nIndex;
nIndex = LboxCombobox::SelectedRow();
if ( nIndex == -1 ) {
return -1;
}
ret = LboxCombobox::GetData( nIndex, LString );
if ( ret == -1 ) {
return -1;
}
return ret;
}
| |
|
|
|