Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Need help getting icons to display in outline table

 
   Macintosh computer (Home) -> Programmer Code RSS
Next:  MallocDebug and powerplant  
Author Message
Chris35

External


Since: Aug 06, 2003
Posts: 6



(Msg. 1) Posted: Wed Aug 06, 2003 12:20 pm
Post subject: Need help getting icons to display in outline table
Archived from groups: comp>sys>mac>programmer>codewarrior, others (more info?)

I am using Joe Chan's CSuperOutlineTable to create an outline table in
my app. I am trying to get the icons to appear for each item in the
table, but it isn't working.

I derived a class from CSuperOutlineTable called CPatternTable and I
derived a class from CEditableSuperOutlineItem called
CPatternCategoryItem. I am inserting CPatternCategoryItem objects
into the CPatternTable.

The ctor for CPatternCategoryItem looks like this (copied from Joe
Chan's sample code with the allegro stuff taken out and I hardcoded
the resID for the icon suite to be 1000 which is the value used in the
sample code):

CPatternCategoryItem::CPatternCategoryItem( LStr255 categoryName )
: mCategoryName(categoryName) {
::GetIconSuite( &mIcon, 1000, kSelectorAllAvailableData );

Size theSize = ::GetHandleSize( mIcon );
SInt16 resAttrs = ::GetResAttrs( mIcon );
OSErr err = ::ResError();
if ( err != noErr && theSize != 0 && resAttrs != 0 )
{
int i = 0;
}
}

I override the GetDrawContentsSelf function:

void
CPatternCategoryItem::GetDrawContentsSelf(
const STableCell& inCell,
SOutlineDrawContents& ioDrawContents)
{
if ( inCell.col == 1 )
{
ioDrawContents.outShowSelection = true;
ioDrawContents.outHasIcon = true;
ioDrawContents.outIconSuite = mIcon;
ioDrawContents.outIconTransform = kTransformNone;
ioDrawContents.outIconAlign = kAlignNone;
}
else if ( inCell.col == 2 )
{
ioDrawContents.outShowSelection = true;
ioDrawContents.outCanDoInPlaceEdit = true;
}

ioDrawContents.outTextTraits.style |= bold;
LString::CopyPStr(mCategoryName, ioDrawContents.outTextString);
}

In LOutlineItem::DrawCell, I added an OSErr variable to retrieve the
error from the call to PlotIconSuite for debugging purposes:

// If there's an icon, draw it.

if (drawInfo.outHasIcon && (drawInfo.outIconSuite != nil)) {
if (drawInfo.outShowSelection &&
mOutlineTable->CellIsSelected(inCell)) {
drawInfo.outIconTransform |= ttSelected;
}

if (drawInfo.prIconFrame.right < inLocalCellRect.right) { // don't
draw if rect is outside cell.
OSErr err = ::PlotIconSuite(&drawInfo.prIconFrame, (SInt16)
drawInfo.outIconAlign,
(SInt16) drawInfo.outIconTransform, drawInfo.outIconSuite);
}
}

This call results in err == -1000 (noMaskFoundErr). I can't seem to
find any documentation or info on why this would be returned. When I
run the sample code it works fine and the err here is 0.

BTW, I am using CW 8.3 on OS X 10.2.6 and the target is Carbon Debug

Any ideas?

TIA

 >> Stay informed about: Need help getting icons to display in outline table 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Programmer Code All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]