Custom GtkTextBuffer objects - virtually impossible?
- From: Mike Birch <Mike ImmortalSoFar com>
- To: gtk-list gnome org
- Subject: Custom GtkTextBuffer objects - virtually impossible?
- Date: Sun, 22 Mar 2015 21:35:31 -0700
I'm not an expert (or a particular fan) of MVC architecture but I thought the idea was to disengage the storage from the display. Writing a custom GtkTextBuffer should be relatively straight forward (or as straight forward as deriving a new GObject ever is) but having examined the source, it would appear that because of the number of hard-coded "helper" functions that are not part of the object, it is virtually impossible to disentangle it from GtkTextView.
For example, GtkTextView, quite understandably, calls gtk_text_buffer_get_insert
(). This function is a hard-coded, non-overrideable reference to _gtk_text_btree_get_insert
(). Why? The architecture should not care *how* the information is stored, just that it is accessible.
This is assuming that the data is, by nature, textual which is not a valid assumption. My data is not, the text is generated but in such a way that in any given state I can say exactly how many character *would* be generated and what characters or text would be produced from any given offset.
Let's take a really simple (although, admittedly, not very useful) example - an infinite Pi view which holds every single digit of Pi. It is mathematically possible to calculate the value of any digit from its position so the "buffer" can calculate what to display at any given position of Pi at the view's request. Similarly, it can search for, for example, your phone number. Maybe the buffer calculates the text, maybe it goes off to the internet and fetches it when needed, maybe it just produces random garbage - that's the text buffer's job and all the view has to do is display it.
Am I missing something? Surely, the idea is to connect any model with a conformant interface to the view (perhaps via the controller). Isn't GtkTextBuffer supposed to be overrideable?
Mike.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]