コード例 #1
0
void Window_Selectable::DrawContent() const{
	TCHAR buf[WND_SELECTABLE_TITLELENGTH];
	BYTE color;
	int contentSize = 0;
	BYTE _state = state;
	if(GetActive()){
		if(drawFocus){
			DrawFocus();
		}
		int cntX = frameArea.x + contentArea.x;
		int cntY = frameArea.y + contentArea.y;
		// タイトルを描画する場合
		if(useTitle){
			GetTitle(buf);
			DrawStringToHandle(
				cntX + GetDrawDeltaX(buf, -1, titleFontSize.hFont), 
				cntY, buf,
				GetPresetColor(presetColorIndex, COLORSET_COLOR_NORMAL),
				titleFontSize.hFont);
			cntY += titleFontSize.lineHeight;
		}

		// 各選択肢の描画
		contentSize = num;
		for(int n=0; n<contentSize; n++){
			color = select.isActive[n] ? ((select.index == n) 
			? WND_SELECTABLE_COLOR_SELECTED : WND_SELECTABLE_COLOR_ACTIVE) 
			: WND_SELECTABLE_COLOR_INACTIVE,
			DrawContentItem(n, color);
		}
	}
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
}
コード例 #2
0
void Window_Selectable::DrawContent() const{
	TCHAR buf[WND_SELECTABLE_TITLELENGTH];
	WINDOWAREA tmpArea;
	BYTE color;
	int contentSize = 0;
	if(GetActive()){
		int cntX = frameArea.x + contentArea.x;
		int cntY = frameArea.y + contentArea.y;
		// タイトルを描画する場合
		if(content.useTitle){
			GetTitle(buf);
			DrawStringToHandle(
				cntX + GetDrawDeltaX(buf, -1, content.hTitleFont), 
				cntY, 
				buf,
				windowFont.color, content.hTitleFont);
			cntY += content.titleHeight;
		}

		// 各選択肢の描画
		contentSize = GetContentSize();
		for(int n=0; n<contentSize; n++){
			tmpArea = GetDrawArea(n);
			color = select.isActive[n] ? ((select.index == n) 
			? WND_SELECTABLE_COLOR_SELECTED : WND_SELECTABLE_COLOR_ACTIVE) 
			: WND_SELECTABLE_COLOR_INACTIVE,
			DrawContentItem(n, color);
			if(n == select.index){
				// フォーカスの描画
				pSkin->DrawFocus(
					tmpArea.x, tmpArea.y,
					tmpArea.w, tmpArea.h, count);
			}
		}
		/*
		for(int h=0; h<row; h++){
			for(int w=0; w<column; w++){
				cell = w+h*column;
				GetContent(buf, cell);
				cntX = frameArea.x + contentArea.x 
					 + (item_width+item_margin_x)*w;
				switch(windowFont.align){
				case 0:
					ddx = 0;
					break;
				case 1:
					ddx = (item_width - 
						GetDrawStringWidthToHandle(buf, strlen(buf), windowFont.hFont))/2;
					break;
				case 2:
					ddx = item_width - 
						GetDrawStringWidthToHandle(buf, strlen(buf), windowFont.hFont);
					break;
				}
				DrawStringToHandle(
					cntX+ddx, cntY, 
					buf,
					select.isActive[cell] ? ((select.index == cell) 
					? windowFont.color : windowFont.iColor) : windowFont.nColor,
					windowFont.hFont);
				if(cell == select.index){
					// フォーカスの描画
					pSkin->DrawFocus(
						cntX, cntY,
						item_width,
						windowFont.fontSize, count);
				}
			}
			cntY += windowFont.lineHeight;
		}
		*/
	}
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
}