Professional Web Applications Themes

Custom WDEF in Carbon - Mac Programming

Can anyone provide me any guidance as to how to write a non-rectangular custom window definition which Carbon would support in OS 8.6 thru 9.x? Once written, I know that it would be accessed via the Carbon API CreateCustomWindow when the code is written as a function within the application, or, if it is written as a code resource, that it would be accessed via CreatNewCWindow by registering the resouce ID with a call to RegisterWindowDefinition. So my problem is not with accessing a window definition function, but with the actual coding of the custom window definition itself. In particular ...

  1. #1

    Default Custom WDEF in Carbon

    Can anyone provide me any guidance as to how to write a non-rectangular
    custom window definition which Carbon would support in OS 8.6 thru 9.x? Once
    written, I know that it would be accessed via the Carbon API
    CreateCustomWindow when the code is written as a function within the
    application, or, if it is written as a code resource, that it would be
    accessed via CreatNewCWindow by registering the resouce ID with a call to
    RegisterWindowDefinition. So my problem is not with accessing a window
    definition function, but with the actual coding of the custom window
    definition itself.

    In particular I want to write a window definition that is essentially a
    rounded rectangle without a title bar, but I would like to refine it even
    more by bringing the left and right sides in a bit, resulting in what would
    essentiallly be an eight-sided polygon with slightly rounded corners at four
    points. But as a first step, I could not even get a rounded rectangle to
    draw its frame properly. Before I carbonized my application, I was able to
    acheive this, more or less (The only problem I had was that on my first call
    to a routine that filled the window with a PICT, the window would not clip
    to the rounded window, but clipped instead to the port rectangle at the
    corners, thus drawing into the desktop.) But in Carbon, I can't even get
    this far: the resulting frame is the port's *rectangle*.

    Can anyone help? I know that once I advance in my carbonization to the point
    where I can concentrate on the portions of the code that will run in OS X, I
    can perhaps utilize the transparent window class which utilizes the
    CoreGraphics features of Quartz, so I may not need a custom window
    definition while running under OS X, but for now I need help with my OS 8 &
    9 implementations.

    Please HELP, and please feel free to email me also: com

    Thanks

    ECDixon

    ECDixon Guest

  2. #2

    Default Re: Custom WDEF in Carbon

    In article <BBF85099.A21%com>, ECDixon <com>
    wrote:
     

    This is a fairly well-doented process and hasn't changed a whole lot
    since 1984. You could start here:

    <http://developer.apple.com/samplecode/Sample_Code/Archive/Human_Interfac
    e_Toolbox/DefProcs.htm>


    G
    Gregory Guest

  3. #3

    Default Re: Custom WDEF in Carbon

    in article attbi.com, Gregory
    Weston at com wrote on 12/8/03 6:12 AM:
     
    >
    > This is a fairly well-doented process and hasn't changed a whole lot
    > since 1984. You could start here:
    >
    > <http://developer.apple.com/samplecode/Sample_Code/Archive/Human_Interfac
    > e_Toolbox/DefProcs.htm>
    >
    >
    > G[/ref]


    Thanks very much Gregory for your response. I wrote a more lengthy response
    a little while ago, but I got an error message when I attempted to post.
    Hopefully I've fixed the problem and will much more briefly say that I was
    amazed that Apple released the source code for their deprecated WDEFs.
    Unfortunately for me however they were written in assembly for the old 68K
    machine. Since I never learned assembly I could not understand most of the
    code except for the calls to the toolbox, which had recognizable names. One
    of the source files they released was the code for the deprecated rounded
    rectangle windows (rDocProc?). I was hoping to be able to learn how Apple's
    programmers clipped the content and structure regions to stay within the
    rounded corners, but all I could see was the expected call to
    FrameRoundRect, which I had already been using unsuccessfully. But that in
    itself is instructive, for maybe there's something very basic in defining
    these regions that I simply don't understand yet. So I will continue to
    explore. If you or anyone else reading this have any other advice or
    suggestions please post or email!!

    Many thanks again,
    ECDixon
    com

    ECDixon Guest

  4. #4

    Default Re: Custom WDEF in Carbon

    In article <BBFFF7A0.C17%com>, ECDixon <com>
    wrote:
     
    > >
    > > This is a fairly well-doented process and hasn't changed a whole lot
    > > since 1984. You could start here:
    > >
    > > <http://developer.apple.com/samplecode/Sample_Code/Archive/Human_Interfac
    > > e_Toolbox/DefProcs.htm>
    > >
    > >
    > > G[/ref]
    >
    >
    > Thanks very much Gregory for your response. I wrote a more lengthy response
    > a little while ago, but I got an error message when I attempted to post.
    > Hopefully I've fixed the problem and will much more briefly say that I was
    > amazed that Apple released the source code for their deprecated WDEFs.
    > Unfortunately for me however they were written in assembly for the old 68K
    > machine.[/ref]

    Okay, again I'll say that the process itself is fairly well doented.
    The link I posted was a starting point, but there were also other things
    in the vicinity of that one which could have been worth your while.

    And you should learn an assembly language. It doesn't have to be for
    practical use - most people have a hard time out-optimizing their
    compiler on modern CPUs - but knowing even something like 6502 is an
    excellent tool for really understanding how your machine is working.
     

    I'd say yes.

    Try these:

    <http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/dev/src/infinity-wi
    ndoid-wdef-30-c.hqx>

    <http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/dev/lib/ingis-wdef-
    11-p.hqx>

    <http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/dev/lib/round-windo
    w-21.hqx>
    Gregory Guest

  5. #5

    Default Re: Custom WDEF in Carbon

    In article <BBFFF7A0.C17%com>, ECDixon <com>
    wrote:
     

    EC,

    there's no black magic involved in that part. What you do is simply
    specify a content region that has rounded corners, and window contents
    will be clipped to that. Same goes for the structure region.

    BTW -- if you want an example of a WDEF written to work with the newer
    MacOS 8 window manager, I think my "Uli's WDEF" package is still
    available on my web site. The code is pretty well structured, and you
    could probably easily rip out all the code dealing with close boxes and
    stuff like that.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
    Uli Guest

  6. #6

    Default Re: Custom WDEF in Carbon

    In article <BBFFF7A0.C17%com>, ECDixon <com>
    wrote:
     

    EC,

    one more thing: If you think there's something about regions you don't
    understand, you might want to have a read of the chapter on regions in
    the old Quickdraw docs. They're doented in "Inside Macintosh: Imaging
    with Quickdraw", available as legacy doentation on Apple's web site.
    It's a well-written book, so don't be afraid to refer to the
    doentation. Besides, regions haven't really changed a lot since then.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
    Uli Guest

  7. #7

    Default Re: Custom WDEF in Carbon



    My utmost thanks to you both, Gregory and Uli. Per you advice and the links
    you provided I was able finally to create the non-rectangular window I've
    been sweating over. Finally, I was able to clip my draws within the content
    region, and have the window retain its non-rectangular shape when dragging
    etc. The links you provided contain a wealth of other info for future
    projects as well, as my current project was fairly simple since, at least
    for now, I do not have a close box, zoom box, collapse box, nor even a
    title bar.

    Many, many thanks,
    ECDixon

    ECDixon Guest

  8. #8

    Default Re: Custom WDEF in Carbon



    My utmost thanks to you both, Gregory and Uli. Per your advice and the links
    you provided I was able finally to create the non-rectangular window I've
    been sweating over. Finally, I was able to clip my draws within the content
    region, and have the window retain its non-rectangular shape when dragging,
    etc. The links you provided contain a wealth of other info for future
    projects as well, as my current project was fairly simple, since, for now
    anyway, I do not have a close box, zoom box, collapse box, nor even a title
    bar.

    Many, many thanks,
    ECDixon

    ECDixon Guest

Similar Threads

  1. Replies: 19
    Last Post: December 3rd, 10:32 AM
  2. Carbon and Mach-O?
    By Charles in forum Mac Programming
    Replies: 3
    Last Post: November 19th, 06:35 PM
  3. OSX Carbon Console???
    By Dr. Michael M. Cohen in forum Mac Programming
    Replies: 3
    Last Post: September 16th, 02:32 AM
  4. KeyFilters (Carbon)
    By Andrew Clay in forum Mac Programming
    Replies: 0
    Last Post: September 12th, 06:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139