Re: What's the fastest way to get icons for file/folders?
Re: What's the fastest way to get icons for file/folders?
- Subject: Re: What's the fastest way to get icons for file/folders?
- From: Chas Spillar <email@hidden>
- Date: Fri, 18 Aug 2006 11:45:10 -0700
- Thread-topic: What's the fastest way to get icons for file/folders?
Two points:
Point 1, to answer the original question:
1) CGRectMake() is a macro that makes a scalar value on the stack as a
temporary. You can't take a pointer or reference to such an object.
2) You need to create an instance of the struct on the stack such that you
can reference it. So, not to reference your entire code:
CGRect myRect = CGMakeRect(...);
Then in the call,
&myRect
3) This while complex basic C, is basic C. I agree that when we have all
these opaque methods floating around these "Make" macros are confusing. You
really should get your hands on a C book. I, personally, don't care for
K&R, there are other books out there that would cover these pointer issues
in excruciating details.
Point 2, to discuss the response to the question:
Can't we all just get along? I find the frequent condescension on this list
to be personally annoying and professionally distasteful.
Cocoa is a framework built on Objective-C. Objective-C has some
idiosyncrasies that make understanding it less than obvious. Objective-C is
a superset of C. Thus, it seems reasonable to see new programmers not
familiar with particular idioms of C hidden in Cocoa to be confused. Asking
a question like this, unless it creates lots of bandwidth, ought to be ok.
Yes, I agree the poster needs more C experience. But, it would have taken
another line or two (e.g. VERY little time to answer his question and point
him to other materials to more completely understand the topic). Thus, the
response was not helpful.
We need to remember that many folks are coming out of Java experience where
the complexities of C style languages are mostly removed (certainly the
points complexities we are discussing). If we want them to program for the
Macintosh, and I think we do, then giving polite helpful answers is the way
towards that end.
We were all learning at one point. Having RTFM answers is not helpful to
the questioner/poster, nor is it conducive to an inviting helpful list
environment.
As the saying goes, no question is a bad question. While taken to its
extreme this is not entirely true, in this context a question about C ought
to be reasonably within the scope of this list.
Just my 2 cents...
Chas.
> From: John Stiles <email@hidden>
> Date: Fri, 18 Aug 2006 11:14:00 -0700
> To: Alan Smith <email@hidden>
> Cc: Matt Neuburg <email@hidden>, <email@hidden>
> Subject: Re: What's the fastest way to get icons for file/folders?
>
> Err, a Cocoa dev list really shouldn't need to explain how pointers
> and structs work.
> Try doing some web research; this is basic C.
>
>
> On Aug 18, 2006, at 11:09 AM, Alan Smith wrote:
>
>> I don't have that book. And I'd rather not wait a week for it to
>> arrive via Amazon or something. So if you could just tell me the
>> important part I would appreciate it.
>>
>> Thanks again, Alan
>>
>> On 8/18/06, Matt Neuburg <email@hidden> wrote:
>>> On or about 8/18/06 10:27 AM, thus spake "Alan Smith"
>>> <email@hidden>:
>>>
>>>> Thanks Matt! But, I tried the stuff at the link but when I compile:
>>>>
>>>> NSImage* image = [[NSImage alloc] initWithSize:NSMakeSize
>>> (width,height)];
>>>> [image lockFocus];
>>>> PlotIconRefInContext((CGContextRef)[[NSGraphicsContext
>>> currentContext]
>>>> graphicsPort],
>>>> CGRectMake(0,0,width,height),
>>>> kAlignNone,
>>>> kTransformNone,
>>>> NULL /*inLabelColor*/,
>>>> kPlotIconRefNormalFlags,
>>>> iconRef);
>>>> [image unlockFocus];
>>>>
>>>> it complains and says that the second arugment to
>>> PlotIconRefInContext
>>>> is an incompatble type, (or something like that). So I tried all
>>> kinds
>>>> of putting '&' and '*' in front of the CGRectMake() and after andÅ
>>>> Suffice to say I couldn't get it to work. I can't figure out
>>> how to
>>>> make a rect pointer.
>>>
>>> See p. 94 of Kernighan and Ritchie (2nd edition). m.
>>>
>>> --
>>> matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
>>> pantes anthropoi tou eidenai oregontai phusei
>>> AppleScript: the Definitive Guide - Second Edition!
>>> http://www.amazon.com/gp/product/0596102119
>>> Take Control of Word 2004, Tiger, and more -
>>> http://www.takecontrolbooks.com/tiger-customizing.html
>>> Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
>>>
>>>
>>>
>>>
>>
>>
>> --
>> // Quotes from yours truly -------------------------
>> "You don't forget, you just don't remember."
>> "Maturity resides in the mind."
>> "Silence is the Universe's greatest gift."
>> "Don't waste your life doing things others have already done."
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40blizzard.com
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden