from qtpy import QtWidgets

from prettyqt import core
from prettyqt.utils import bidict


STANDARD_PIXMAPS = dict(
    titlebar_min_button=QtWidgets.QStyle.SP_TitleBarMinButton,
    titlebar_menu_button=QtWidgets.QStyle.SP_TitleBarMenuButton,
    titlebar_max_button=QtWidgets.QStyle.SP_TitleBarMaxButton,
    titlebar_close_button=QtWidgets.QStyle.SP_TitleBarCloseButton,
    titlebar_normal_button=QtWidgets.QStyle.SP_TitleBarNormalButton,
    titlebar_shade_button=QtWidgets.QStyle.SP_TitleBarShadeButton,
    titlebar_unshade_button=QtWidgets.QStyle.SP_TitleBarUnshadeButton,
    titlebar_context_help_button=QtWidgets.QStyle.SP_TitleBarContextHelpButton,
    information=QtWidgets.QStyle.SP_MessageBoxInformation,
    warning=QtWidgets.QStyle.SP_MessageBoxWarning,
    critical=QtWidgets.QStyle.SP_MessageBoxCritical,
    question=QtWidgets.QStyle.SP_MessageBoxQuestion,
    desktop=QtWidgets.QStyle.SP_DesktopIcon,
    trash=QtWidgets.QStyle.SP_TrashIcon,
    computer=QtWidgets.QStyle.SP_ComputerIcon,
    drive_fd=QtWidgets.QStyle.SP_DriveFDIcon,
    drive_hd=QtWidgets.QStyle.SP_DriveHDIcon,
    drive_cd=QtWidgets.QStyle.SP_DriveCDIcon,
    drive_dvd=QtWidgets.QStyle.SP_DriveDVDIcon,
    drive_net=QtWidgets.QStyle.SP_DriveNetIcon,
    dir_home=QtWidgets.QStyle.SP_DirHomeIcon,
    dir_open=QtWidgets.QStyle.SP_DirOpenIcon,
    dir_closed=QtWidgets.QStyle.SP_DirClosedIcon,
    dir=QtWidgets.QStyle.SP_DirIcon,
    dir_link=QtWidgets.QStyle.SP_DirLinkIcon,
    dir_link_open=QtWidgets.QStyle.SP_DirLinkOpenIcon,
    file=QtWidgets.QStyle.SP_FileIcon,
    file_link=QtWidgets.QStyle.SP_FileLinkIcon,
    file_dialog_start=QtWidgets.QStyle.SP_FileDialogStart,
    file_dialog_end=QtWidgets.QStyle.SP_FileDialogEnd,
    file_dialog_to_parent=QtWidgets.QStyle.SP_FileDialogToParent,
    file_dialog_new_folder=QtWidgets.QStyle.SP_FileDialogNewFolder,
    file_dialog_detailed_view=QtWidgets.QStyle.SP_FileDialogDetailedView,
    file_dialog_info_view=QtWidgets.QStyle.SP_FileDialogInfoView,
    file_dialog_contents_view=QtWidgets.QStyle.SP_FileDialogContentsView,
    file_dialog_list_view=QtWidgets.QStyle.SP_FileDialogListView,
    file_dialog_back=QtWidgets.QStyle.SP_FileDialogBack,
    dockwidget_close_button=QtWidgets.QStyle.SP_DockWidgetCloseButton,
    toolbar_horizontal_extension=QtWidgets.QStyle.SP_ToolBarHorizontalExtensionButton,
    toolbar_vertical_extension=QtWidgets.QStyle.SP_ToolBarVerticalExtensionButton,
    dialog_ok=QtWidgets.QStyle.SP_DialogOkButton,
    dialog_cancel=QtWidgets.QStyle.SP_DialogCancelButton,
    dialog_help=QtWidgets.QStyle.SP_DialogHelpButton,
    dialog_open=QtWidgets.QStyle.SP_DialogOpenButton,
    dialog_save=QtWidgets.QStyle.SP_DialogSaveButton,
    dialog_close=QtWidgets.QStyle.SP_DialogCloseButton,
    dialog_apply=QtWidgets.QStyle.SP_DialogApplyButton,
    dialor_reset=QtWidgets.QStyle.SP_DialogResetButton,
    dialog_discard=QtWidgets.QStyle.SP_DialogDiscardButton,
    dialog_yes=QtWidgets.QStyle.SP_DialogYesButton,
    dialog_no=QtWidgets.QStyle.SP_DialogNoButton,
    arrow_up=QtWidgets.QStyle.SP_ArrowUp,
    arrow_down=QtWidgets.QStyle.SP_ArrowDown,
    arrow_left=QtWidgets.QStyle.SP_ArrowLeft,
    arrow_right=QtWidgets.QStyle.SP_ArrowRight,
    arrow_back=QtWidgets.QStyle.SP_ArrowBack,
    arrow_forward=QtWidgets.QStyle.SP_ArrowForward,
    command_link=QtWidgets.QStyle.SP_CommandLink,
    vista_shield=QtWidgets.QStyle.SP_VistaShield,
    browser_reload=QtWidgets.QStyle.SP_BrowserReload,
    browser_stop=QtWidgets.QStyle.SP_BrowserStop,
    media_play=QtWidgets.QStyle.SP_MediaPlay,
    media_stop=QtWidgets.QStyle.SP_MediaStop,
    media_pause=QtWidgets.QStyle.SP_MediaPause,
    media_skip_forward=QtWidgets.QStyle.SP_MediaSkipForward,
    media_skip_backward=QtWidgets.QStyle.SP_MediaSkipBackward,
    media_seek_forward=QtWidgets.QStyle.SP_MediaSeekForward,
    media_seek_backward=QtWidgets.QStyle.SP_MediaSeekBackward,
    media_volume=QtWidgets.QStyle.SP_MediaVolume,
    media_volume_muted=QtWidgets.QStyle.SP_MediaVolumeMuted,
    lineedit_clear=QtWidgets.QStyle.SP_LineEditClearButton,
    custom_base=QtWidgets.QStyle.SP_CustomBase,
)

if core.VersionNumber.get_qt_version() >= (5, 14, 0):
    STANDARD_PIXMAPS["dialog_yes_to_all"] = QtWidgets.QStyle.SP_DialogYesToAllButton
    STANDARD_PIXMAPS["dialog_no_to_all"] = QtWidgets.QStyle.SP_DialogNoToAllButton
    STANDARD_PIXMAPS["dialog_save_all"] = QtWidgets.QStyle.SP_DialogSaveAllButton
    STANDARD_PIXMAPS["dialog_abort"] = QtWidgets.QStyle.SP_DialogAbortButton
    STANDARD_PIXMAPS["dialog_retry"] = QtWidgets.QStyle.SP_DialogRetryButton
    STANDARD_PIXMAPS["dialog_ignore"] = QtWidgets.QStyle.SP_DialogIgnoreButton
    STANDARD_PIXMAPS["restore_defaults"] = QtWidgets.QStyle.SP_RestoreDefaultsButton

COMPLEX_CONTROLS = bidict(
    spinbox=QtWidgets.QStyle.CC_SpinBox,
    combobox=QtWidgets.QStyle.CC_ComboBox,
    scrollbar=QtWidgets.QStyle.CC_ScrollBar,
    slider=QtWidgets.QStyle.CC_Slider,
    toolbutton=QtWidgets.QStyle.CC_ToolButton,
    titlebar=QtWidgets.QStyle.CC_TitleBar,
    groupbox=QtWidgets.QStyle.CC_GroupBox,
    dial=QtWidgets.QStyle.CC_Dial,
    mdi_controls=QtWidgets.QStyle.CC_MdiControls,
    custom_base=QtWidgets.QStyle.CC_CustomBase,
)

SIMPLE_CONTROLS = dict(
    none=QtWidgets.QStyle.SC_None,
    scrollbar_add_line=QtWidgets.QStyle.SC_ScrollBarAddLine,
    scrollbar_sub_line=QtWidgets.QStyle.SC_ScrollBarSubLine,
    scrollbar_add_page=QtWidgets.QStyle.SC_ScrollBarAddPage,
    scrollbar_sub_page=QtWidgets.QStyle.SC_ScrollBarSubPage,
    scrollbar_first=QtWidgets.QStyle.SC_ScrollBarFirst,
    scrollbar_last=QtWidgets.QStyle.SC_ScrollBarLast,
    scrollbar_slider=QtWidgets.QStyle.SC_ScrollBarSlider,
    scrollbar_groove=QtWidgets.QStyle.SC_ScrollBarGroove,
    spinbox_up=QtWidgets.QStyle.SC_SpinBoxUp,
    spinbox_down=QtWidgets.QStyle.SC_SpinBoxDown,
    spinbox_frame=QtWidgets.QStyle.SC_SpinBoxFrame,
    spinbox_edit_field=QtWidgets.QStyle.SC_SpinBoxEditField,
    combobox_edit_field=QtWidgets.QStyle.SC_ComboBoxEditField,
    combobox_arrow=QtWidgets.QStyle.SC_ComboBoxArrow,
    combobox_frame=QtWidgets.QStyle.SC_ComboBoxFrame,
    combobox_list_box_popup=QtWidgets.QStyle.SC_ComboBoxListBoxPopup,
    slider_groove=QtWidgets.QStyle.SC_SliderGroove,
    slider_handle=QtWidgets.QStyle.SC_SliderHandle,
    slider_tickmarks=QtWidgets.QStyle.SC_SliderTickmarks,
    toolbutton=QtWidgets.QStyle.SC_ToolButton,
    toolbutton_menu=QtWidgets.QStyle.SC_ToolButtonMenu,
    titlebar_sys_menu=QtWidgets.QStyle.SC_TitleBarSysMenu,
    titlebar_min_button=QtWidgets.QStyle.SC_TitleBarMinButton,
    titlebar_max_button=QtWidgets.QStyle.SC_TitleBarMaxButton,
    titlebar_close_button=QtWidgets.QStyle.SC_TitleBarCloseButton,
    titlebar_label=QtWidgets.QStyle.SC_TitleBarLabel,
    titlebar_normal_button=QtWidgets.QStyle.SC_TitleBarNormalButton,
    titlebar_shade_button=QtWidgets.QStyle.SC_TitleBarShadeButton,
    titlebar_unshade_button=QtWidgets.QStyle.SC_TitleBarUnshadeButton,
    titlebar_context_help_button=QtWidgets.QStyle.SC_TitleBarContextHelpButton,
    dial_handle=QtWidgets.QStyle.SC_DialHandle,
    dial_groove=QtWidgets.QStyle.SC_DialGroove,
    dial_tickmarks=QtWidgets.QStyle.SC_DialTickmarks,
    groupbox_frame=QtWidgets.QStyle.SC_GroupBoxFrame,
    groupbox_label=QtWidgets.QStyle.SC_GroupBoxLabel,
    groupbox_checkbox=QtWidgets.QStyle.SC_GroupBoxCheckBox,
    groupbox_contents=QtWidgets.QStyle.SC_GroupBoxContents,
    mdi_normal_button=QtWidgets.QStyle.SC_MdiNormalButton,
    mdi_min_button=QtWidgets.QStyle.SC_MdiMinButton,
    mdi_close_button=QtWidgets.QStyle.SC_MdiCloseButton,
    all=QtWidgets.QStyle.SC_All,
)


class Style(QtWidgets.QStyle):
    pass
