class LboxListbox : public LboxWintool

  コンストラクタ



  
// *********************************************************
// デフォルトコンストラクタ
// *********************************************************
LboxListbox::LboxListbox()
{
	LboxListbox::hFont = NULL;
	LboxListbox::bCreate = false;
	LboxWintool::hWndtool = NULL;
}
// *********************************************************
// 拡張コンストラクタ1
// *********************************************************
LboxListbox::LboxListbox( HWND hList )
{
	LboxListbox::hWnd = hList;
	LboxListbox::hFont = NULL;
	LboxListbox::bCreate = false;
	LboxWintool::hWndtool = hList;
}
// *********************************************************
// 拡張コンストラクタ2
// *********************************************************
LboxListbox::LboxListbox( HWND hOwner, int nID )
{
	LboxListbox::hWnd = CreateWindow(
		"listbox",
		NULL,
		WS_CHILD,
		0,0,0,0,
		hOwner,
		(HMENU)nID,
		LboxGetInstance( hOwner ),
		NULL
	);

	LboxListbox::hFont = NULL;
	LboxListbox::bCreate = true;
	LboxWintool::hWndtool = LboxListbox::hWnd;
}
// *********************************************************
// デストラクタ
// *********************************************************
LboxListbox::~LboxListbox()
{
	if ( LboxListbox::hFont != NULL ) {
		DeleteObject( LboxListbox::hFont );
	}

	if ( LboxListbox::bCreate ) {
		if ( LboxListbox::hWnd != NULL ) {
			DestroyWindow( LboxListbox::hWnd );
		}
	}
}
  



  Add



  
// *********************************************************
// リストボックスに文字列を追加
// 戻り値 : 追加された位置
// *********************************************************
int LboxListbox::Add( LPCTSTR pszBuffer )
{
	return LboxListAdd( 
		LboxListbox::hWnd,
		pszBuffer
	);
}
  



  Insert

  
// *********************************************************
// リストボックスに文字列を挿入
// 戻り値 : 挿入された位置
// *********************************************************
int LboxListbox::Insert( int nIndex, LPCTSTR pszBuffer )
{
	return LboxListInsert(
		LboxListbox::hWnd,
		nIndex,
		pszBuffer
	);
}
  



  Delete

  
// *********************************************************
// リストボックスの指定行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : 存在しない行を指定すると -1
// *********************************************************
int LboxListbox::Delete( int nIndex )
{
	return LboxListDelete(
		LboxListbox::hWnd,
		nIndex
	);
}
  



  GetText

  
// *********************************************************
// リストボックスから文字列を取得
// 戻り値 : 取得した文字列の長さ
// *********************************************************
int LboxListbox::GetText( int nIndex, LPCTSTR pszBuffer, int nSize )
{
	return LboxListGetText(
		LboxListbox::hWnd,
		nIndex,
		pszBuffer,
		nSize
	);
}
  



  SetText

  
// *********************************************************
// リストボックスの指定行を更新
// 戻り値 : 挿入された位置
// 戻り値 : 失敗すると -1
// *********************************************************
int LboxListbox::SetText( int nIndex, LPCTSTR pszBuffer)
{
	return LboxListSetText(
		LboxListbox::hWnd,
		nIndex,
		pszBuffer
	);
}
  



  Count

  
// *********************************************************
// リストボックスの行数取得
// 戻り値 : 行数
// *********************************************************
int LboxListbox::Count( void )
{
	return LboxListCount(
		LboxListbox::hWnd
	);
}
  



  SelectedRow

  
// *********************************************************
// リストボックスの選択された行の取得
// 戻り値 : 選択された行(選択されていない場合は -1 )
// *********************************************************
int LboxListbox::SelectedRow( void )
{
	return LboxListSelectedRow(
		LboxListbox::hWnd
	);
}
  



  SelectedGetText

  
// *********************************************************
// 選択した行の文字列を取得
// 戻り値 : 取得した文字列の長さ
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxListbox::SelectedGetText( LPCTSTR pszBuffer, int nSize )
{
	return LboxListSelectedGetText(
		LboxListbox::hWnd,
		pszBuffer,
		nSize
	);
}
  



  SelectedSetText

  
// *********************************************************
// 選択した行に文字列を設定
// 戻り値 : 挿入された位置
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxListbox::SelectedSetText( LPCTSTR pszBuffer )
{
	return LboxListSelectedSetText(
		LboxListbox::hWnd,
		pszBuffer
	);
}
  



  SelectedDelete

  
// *********************************************************
// 選択した行を削除
// 戻り値 : リスト内に残っている文字列の総数
// 戻り値 : エラーの場合は -1
// *********************************************************
int LboxListbox::SelectedDelete( void )
{
	return LboxListSelectedDelete(
		LboxListbox::hWnd
	);
}
  



  Select

  
// *********************************************************
// リストボックスの指定行を選択
// 戻り値 : 無し
// *********************************************************
void LboxListbox::Select( int nIndex )
{
	LboxListSelect(
		LboxListbox::hWnd,
		nIndex
	);
}
  



  Reset

  
// *********************************************************
// リストボックスのリセット
// 戻り値 : 無し
// *********************************************************
void LboxListbox::Reset( void )
{
	LboxListReset(
		LboxListbox::hWnd
	);
}
  



  Dump

  
// *********************************************************
// リストボックスにダンプ結果を表示
// *********************************************************
void LboxListbox::Dump( LPCTSTR pszBuffer, int nSize )
{
	LboxListDump(
		LboxListbox::hWnd,
		pszBuffer,
		nSize
	);
}
  



  Token

  
// *********************************************************
// トークンを追加
// 戻り値 : トークンの数
// *********************************************************
int LboxListbox::Token( LPTSTR pszBuffer, LPTSTR pszDelimiter )
{
	return LboxListToken(
		LboxListbox::hWnd,
		pszBuffer,
		pszDelimiter
	);
}
  



  Printf

  
// *********************************************************
// リストボックスにフォーマットした文字列を表示
// *********************************************************
void LboxListbox::Printf( LPSTR FormatString, ...)
{
	va_list marker;
	char szBuffer[1024];

	char *szNewBuff = new char[lstrlen(FormatString)+10];
	lstrcpy( szNewBuff, FormatString );

	va_start(marker, FormatString);
	vsprintf(szBuffer, szNewBuff, marker);
	va_end(marker);              

	unsigned char *pszToken;
	int nRow = 0;

	pszToken = _mbstok(
		(unsigned char *)szBuffer,
		(const unsigned char *)"\n"
	);
	while( pszToken != NULL ) {
		LboxListInsert(
			LboxListbox::hWnd,
			nRow,
			(LPCTSTR)pszToken
		);
		nRow++;
		pszToken = _mbstok( NULL, (const unsigned char *)"\n" );
	}

	delete [] szNewBuff;
}
  



  SetFont

  
// *********************************************************
// フォントのセット
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxListbox::SetFont( int nType, int nSize, BOOL bBold )
{
	if ( LboxListbox::hFont != NULL ) {
		DeleteObject( LboxListbox::hFont );
	}
	LboxListbox::hFont = LboxCreateFont(
		nType,
		nSize,
		bBold
	);
	if ( LboxListbox::hFont == NULL ) {
		return false;
	}

	SendMessage(
		LboxListbox::hWnd,
		WM_SETFONT,
		(WPARAM)(LboxListbox::hFont),
		MAKELPARAM(true, 0)
	);

	return true;
}
  



  CopyClipboard

  
// *********************************************************
// クリップボードにコピー
// 行の終わりには、改行コードを付加
// bSelect が true の場合は 選択した行のみコピーする
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxListbox::CopyClipboard( BOOL bSelect )
{
	return LboxListCopyClipboard(
		LboxListbox::hWnd,
		bSelect
	);
}
  



  CreateToken

  
// *********************************************************
// リストボックスからトークンを作成
// 戻り値 : 無し
// *********************************************************
void LboxListbox::CreateToken( LboxToken *obj )
{
	LboxListCreateToken( LboxListbox::hWnd, obj );
}
  



  TextSize

  
// *********************************************************
// リストボックス全体のテキストサイズを NULL を含めて計算する
// 戻り値 : テキストサイズ
// *********************************************************
int LboxListbox::TextSize( void )
{
	return LboxListTextSize( LboxListbox::hWnd );
}
  



  EnumFile

  
// *********************************************************
// リストボックスにワイルドカードで指定したファイルの一覧
// を取得。但し、ディレクトリは必ず取得する
// 戻り値 : 無し
// *********************************************************
void LboxListbox::EnumFile( LPTSTR lpOption, int nIndex )
{
	LboxEnumFile( LboxListbox::hWnd, lpOption, nIndex );
}
  

LboxEnumFile










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ