#
#   Python GUI - Alert base class - Macintosh
#

from Carbon.Controls import kControlContentCIconRes, kControlContentCIconHandle, kControlContentIconSuiteHandle
from Carbon.Res import GetResource
from Carbon.Icn import GetCIcon
from MacIconControls import MacIconControl
from GBaseAlerts import BaseAlert as GBaseAlert

_kind_to_mac_icon_id = {
    'stop':    0,
    'caution': 2,
    'note':    1,
    'query':   1,
}

class BaseAlert(GBaseAlert):

    _default_width = 380
    _default_lines = 3

    def layout(self, kind):
        mac_icon_id = _kind_to_mac_icon_id[kind]
        self._mac_cicn_rsrc = GetCIcon(mac_icon_id)
        self.icon = MacIconControl((kControlContentCIconHandle, self._mac_cicn_rsrc))
        self.place(self.icon, left = 24, top = 14)
        self.place(self.label, left = self.icon + 16, top = 14, right = -24)
        self.layout_buttons()
