import pygame
import sys
import math
import os
from typing import Tuple


WINDOW_WIDTH: int
WINDOW_HEIGHT: int
screen: pygame.Surface
clock: pygame.time.Clock


WHITE: Tuple[int, int, int]
BLACK: Tuple[int, int, int]
GRAY: Tuple[int, int, int]
DARK_GRAY: Tuple[int, int, int]
BLUE: Tuple[int, int, int]
RED: Tuple[int, int, int]
LIGHT_BLUE: Tuple[int, int, int]

class ScrollBar:
    """
    Vertical scroll bar


    垂直滚动条
    """
    def __init__(self, x, y, height, content_height, view_height) -> None:
        ...

    def update_slider(self) -> None:
        """
        Update slider size and position


        更新滑块大小和位置
        """

    def set_content_size(self, content_height, view_height) -> None:
        ...

    def handle_event(self, event) -> None:
        ...

    def get_scroll_offset(self) -> int:
        ...

    def draw(self, screen) -> None:
        ...


class InfiniteImageGrid:
    """
    Infinite scrolling image grid (multi-column layout)


    无限滚动的图片网格（多列布局）
    """
    def __init__(self, x, y, width, height, columns=2, thumbnail_size=120, spacing=15, name_height=20, bg_color=(30, 30, 30)) -> None:
        ...

    def add_image_name(self, image_path) -> None:
        """
        Set the name of the specified image


        设置指定图片的名字
        """

    def add_image(self, image_path) -> None:
        """
        Add a single image


        添加单张图片
        """

    def add_images(self, image_paths) -> None:
        """
        Add multiple images in batch


        批量添加图片
        """

    def set_image_to_original_size(self, index) -> None:
        """
        Scale the specified image to its original size


        缩放指定索引的图片为原来大小
        """

    def add_test_images(self, count) -> None:
        """
        Add test images (for demonstration)


        添加测试图片（演示用）
        """

    def handle_event(self, event) -> None:
        """
        Handle events (scroll wheel, scroll bar, mouse drag)


        处理事件（滚轮、滚动条、鼠标拖动）
        """

    def draw(self, screen, font_path) -> None:
        """
        Draw the grid


        绘制网格
        """

    def get_clicked_image_index(self, mouse_x, mouse_y) -> int:
        """
        Return the index of the clicked image based on mouse coordinates, return -1 if none clicked


        根据鼠标坐标返回点击的图片索引，如果没有点击到返回-1
        """

    def get_image_rect(self, index) -> pygame.Rect:
        """
        Get the rectangular area of the image on the screen


        获取图片在屏幕上的矩形区域
        """

    def get_drag_image_rect(self, index) -> pygame.Rect:
        """
        Get the rectangular area of the image on the screen (automatically handles drag offset)


        获取图片在屏幕上的矩形区域（自动处理拖动时的偏移）
        """

    def get_image_path(self, index) -> str:
        """
        Get the path of the specified image


        获取指定索引的图片路径
        """

    def set_image_name(self, index, new_name) -> bool:
        """
        Modify the name of the specified image


        修改指定索引的图片名字
        """

    def get_image_name(self, index) -> str:
        """
        Get the name of the specified image


        获取指定索引的图片名字
        """

    def get_hover_image_index(self, mouse_x, mouse_y) -> int:
        """
        Get the index of the image the mouse is hovering over, return -1 if none


        获取鼠标悬停的图片索引，如果没有返回-1
        """

    def quit() -> None:
        """
        Quit


        退出
        """
        pygame.quit()
        sys.exit()