Re: Design question: Picking event source



Matthias Kaeppler wrote:

> Matthias Kaeppler wrote:
>> Hi,
>>
>> a question is bugging me, nearly since I started programming on my Gtk2
>> filemanager. I hope you can help me resolving this issue, because it's
>> also an important design question (I intend to publish the widget which
>> is responsible for displaying/browsing directory contents, so I need its
>> interface to be clean and easy).
>>
>> The problem is this:
>> In the main window, I have two embedded components, which were
>> programmed by myself. They are Gtk::ScrolledWindowS, which itself both
>> embed a TreeView. Besides the scrollbars, those ScrolledWindow widgets
>> are covered 100% by the TreeViewS. They merely act as a container.
>>
>> The ScrolledWindowS are the components which ought to be used by the
>> client, however, all user interaction besides scrolling takes place in
>> the embedded TreeViewS.
>> This is a problem, because most events are fired by the TreeViewS, and
>> not by the ScrolledWindowS, so the clients would have to connect their
>> signal handlers to the underlying TreeView object, but I don't even want
>> the client to know what exactly is working under the hood.
>>
>> What I want is people connecting their signal handlers to the
>> ScrolledWindow signals instead. However, this would mean (since those
>> events are NOT fired by the ScrolledWindowS but by the TreeViewS), that
>> I would have to catch the events fired by the TreeViewS first
>> internally, and then delegate them to the composing ScrolledWindowS,
>> which would fire them again, so the client gets notice of them.
>>
>> However, this looks like an expensive abstraction, because I have at
>> least one more function call for each event fired.
>>
>> Is there a more elgant solution to achieve what I want?
>>
>> Best regards,
>> Matthias
>>
>
What kind of signals do you want your clients to catch ? What about
providing your own signals ?
Antonio



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]