Your wish is my command

whitekid's blog

Archive for the ‘themes’ tag

ListView의 SubItem에 ProgressBar 그리기

without comments

TListView에 ProgressBar를 표현하는 것을 간단하게 생각하면 TProgressBar를 생성하고 SubItem위치에 표시하면 됩니다. 그리고 컬럼이 사이즈가 조절될 때 (HeaderTracking) 적당하게 위치 조절해주면 됩니다. 간단하게 심플하게 생각하면 그렇지요.

근데 그냥 OnDrawSubItem 이벤트에서 Themes을 이용해서 그려주면 어떨까? 하고 해 봤는데, 생각보다 간단합니다.

procedure TThemeForm.ListView1CustomDrawSubItem(Sender: TCustomListView;
  Item: TListItem; SubItem: Integer; State: TCustomDrawState;
  var DefaultDraw: Boolean);
var
  Element: TThemedElementDetails;
  R: TRect;
  Progress: 1..100;
begin
  if ((Sender as TListView).ViewStyle = vsReport) and (SubItem = 3) then
  begin
    R := Item.SubItemRect(SubItem, drBounds);
    Inc(R.Left);
    if Sender.GridLines then Dec(R.Bottom);

    Element := ThemeServices.GetElementDetails(tpBar);
    ThemeServices.DrawElement(Sender.Canvas.Handle, Element, R);

    Element := ThemeServices.GetElementDetails(tpChunk);
    InflateRect(R, -4, -3);
    Progress := 30;
    R.Right := R.Left + MulDiv(Progress, R.Right - R.Left, 100);
    ThemeServices.DrawElement(Sender.Canvas.Handle, Element, R);

    DefaultDraw := False;
  end;
end;

SubItemRect 함수는 다음과 같습니다.

function TListItemHelper.SubItemRect(SubItemIndex: Integer; Code: TDisplayCode): TRect;
const
  Codes: array[TDisplayCode] of Longint = (LVIR_BOUNDS, LVIR_ICON, LVIR_LABEL,
    LVIR_SELECTBOUNDS);
begin
  ListView_GetSubItemRect(ListView.Handle, Index, SubItemIndex, Codes[Code], @Result);
end;

자 잘나옵니까?

Written by whitekid

June 22nd, 2010 at 2:28 am

Posted in Uncategorized

Tagged with , ,

drupal themesettingsapi module

without comments

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	www/drupal6-themesettingsapi
#	www/drupal6-themesettingsapi/Makefile
#	www/drupal6-themesettingsapi/distinfo
#	www/drupal6-themesettingsapi/pkg-descr
#
echo c - www/drupal6-themesettingsapi
mkdir -p www/drupal6-themesettingsapi > /dev/null 2>&1
echo x - www/drupal6-themesettingsapi/Makefile
sed 's/^X//' >www/drupal6-themesettingsapi/Makefile << 'bcb04d505305fd2621e9906bb6352875'
X# New ports collection makefile for:	drupal6-themesettingsapi
X# Date created:				3 Mar 2010
X# Whom:					whitekid@gmail.com
X#
X# $FreeBSD$
X#
X
XPORTNAME=	themesettingsapi
XDISTVERSION=	6.x-1.4
XCATEGORIES=	www
X
XMAINTAINER=	ports@FreeBSD.org
XCOMMENT=	Add custom settings to you theme for drupal.
X
XDRUPAL6_MODULE=	yes
XMODULE_DIRS=	translations
XMODULE_FILES=	themesettingsapi.admin.inc themesettingsapi.info \
X		themesettingsapi.module translations/de.po translations/ja.po \
X		translations/themesettingsapi.pot
XDOC_FILES=	CHANGELOG.txt README.txt LICENSE.txt
X
X.include <bsd.port.pre.mk>
X.include "${.CURDIR}/../../www/drupal5/bsd.drupal.mk"
X.include <bsd.port.post.mk>
bcb04d505305fd2621e9906bb6352875
echo x - www/drupal6-themesettingsapi/distinfo
sed 's/^X//' >www/drupal6-themesettingsapi/distinfo << '935c639b4a6c51408e999d94bc5cd788'
XMD5 (drupal/themesettingsapi-6.x-1.4.tar.gz) = a2b5b5f156ea5b571be9f87638b9f471
XSHA256 (drupal/themesettingsapi-6.x-1.4.tar.gz) = 62be4dcc9ddae6930c3e985b0b0ffbb62584c9b6652a03202ae62053218315fa
XSIZE (drupal/themesettingsapi-6.x-1.4.tar.gz) = 9855
935c639b4a6c51408e999d94bc5cd788
echo x - www/drupal6-themesettingsapi/pkg-descr
sed 's/^X//' >www/drupal6-themesettingsapi/pkg-descr << 'afe1ea8baa59a0619c70f98199a10a5f'
XPathauto is a Drupal module which automatically generates path aliases for
Xvarious kinds of content (nodes, categories, users) without requiring the
Xuser to manually specify the path alias.
X
XWWW: http://drupal.org/project/pathauto
afe1ea8baa59a0619c70f98199a10a5f
exit

Written by whitekid

March 8th, 2010 at 6:11 am

Posted in Uncategorized

Tagged with , , ,