In other words, you cannot write an integrated "text editor engine" or something that could be implimented this way. You could write a limited set of functions that could be used, but many of the "conceptual connections" between such functions would have to be just that, because they would be implemented completely in the front-end; there will be no place for them beyond the programming of the actual interface, whether it is Qt or ncurses, etc. So you could create an independent library of features as applicable, and then an abstract which describes the functioning of the front-end, but I am sure you will quickly find that is impossible or pointless to try creating a functional process that will "interact" with an independently coded GUI. "Quickly", as in the day you start actually coding.
Not to ixnay the whole idea, just to provide some perpective.