How to draw your own NSTabView tabs?

前端 未结 6 1790
迷失自我
迷失自我 2021-02-09 17:05

I want to draw my own tabs for NSTabViewItems. My Tabs should look different and start in the top left corner and not centered.

How can I do this?

6条回答
  •  梦谈多话
    2021-02-09 17:21

    I've recently done this for something I was working on.

    I ended using a tabless tab view and then drawing the tabs myself in another view. I wanted my tabs to be part of a status bar at the bottom of the window.

    You obviously need to support mouse clicks which is fairly easy, but you should make sure your keyboard support works too, and that's a little more tricky: you'll need to run timers to switch the tab after no keyboard access after half a second (have a look at the way OS X does it). Accessibility is another thing you should think about but you might find it just works—I haven't checked it in my code yet.

提交回复
热议问题