Listbox selection color

I need to do some custom drawing on Listbox.CellBackgroundPaint event therefore I need to return True on this event to let the drawing.
Problem is I have to build myself the selection color for the cell.
How to get the system standard color for selection, so that I can use it together with my custom drawing?

I use a carbon declare for that: Hope it continue working!

[code]#If TargetMacOS
Declare function GetThemeBrushAsColor lib "Carbon" (inBrush as Integer, _
inDepth as Integer, _
inColorDev as Integer, _
outColor as ptr) as Integer

dim oc as MemoryBlock = new MemoryBlock(6)
dim res as Integer

If GetThemeBrushAsColor(-5, 32, 1, oc) <> 0 Then ' error
 SelectedColor =  REALBASIC HighlightColor
else
 SelectedColor = RGB(oc.byte(0), oc.byte(2), oc.byte(4))
end if

#End if
[/code]

If row = ListIndex Or Selected(row) = True Then Return False Else // do custom background drawing Return True End

Thanks.
Do you have a solution for Windows too?

NSColor class has tons of colors for colors predefined for Cocoa:
http://www.monkeybreadsoftware.net/class-nscolormbs.shtml

GetSysColor
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx

[quote=105003:@Eli Ott]If row = ListIndex Or Selected(row) = True Then Return False Else // do custom background drawing Return True End[/quote]

Sorry but I don’t understand how to get the selection color here… Am I overlooking something?

[quote=105004:@Massimo Valle]Thanks.
Do you have a solution for Windows too?[/quote]

REALBASIC.Highlight gives the right color for that on Windows

[quote=105008:@Massimo Valle]Sorry but I don’t understand how to get the selection color here… Am I overlooking something?[/quote]By returning False for selected rows Xojo will draw the background.

Why not use HighlightColor for OSX too instead of using declares? Isn’t it cross-platform?

OS X has two system highlight colors. The Listbox uses the other one.

Ugh.

True, but for selected row will not draw my custom drawing.

From you initial question I understood you wanted the standard background color for selected rows and custom drawing for non-selected rows, hence my example.

Thanks to all for the answers.