Named the margins and padding. Made them functions that can take parameters in the future to allow more complex spacing options in the future.

This commit is contained in:
Pietro Gagliardi 2016-05-26 21:25:32 -04:00
parent baf46c5434
commit 834cc12299
4 changed files with 19 additions and 2 deletions

View File

@ -22,6 +22,9 @@ This README is being written.<br>
*Note that today's entry may be updated later today.* *Note that today's entry may be updated later today.*
* **26 May 2016**
* Two OS X-specific functions have been added: `uiDarwinMarginAmount()` and `uiDarwinPaddingAmount()`. These return the amount of margins and padding, respectively, to give to a control, and are intended for container implementations. These are suitable for the constant of a NSLayoutConstraint. They both take a pointer parameter that is reserved for future use and should be `NULL`.
* **25 May 2016** * **25 May 2016**
* uiDrawTextLayout attributes are now specified in units of *graphemes* on all platforms. This means characters as seen from a user's perspective, not Unicode codepoints or UTF-8 bytes. So a long string of combining marker codepoints after one codepoint would still count as one grapheme. * uiDrawTextLayout attributes are now specified in units of *graphemes* on all platforms. This means characters as seen from a user's perspective, not Unicode codepoints or UTF-8 bytes. So a long string of combining marker codepoints after one codepoint would still count as one grapheme.

View File

@ -18,6 +18,16 @@ NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRela
return constraint; return constraint;
} }
CGFloat uiDarwinMarginAmount(void *reserved)
{
return 20.0;
}
CGFloat uiDarwinPaddingAmount(void *reserved)
{
return 8.0;
}
// this is needed for NSSplitView to work properly; see http://stackoverflow.com/questions/34574478/how-can-i-set-the-position-of-a-nssplitview-nowadays-setpositionofdivideratind (stal in irc.freenode.net/#macdev came up with the exact combination) // this is needed for NSSplitView to work properly; see http://stackoverflow.com/questions/34574478/how-can-i-set-the-position-of-a-nssplitview-nowadays-setpositionofdivideratind (stal in irc.freenode.net/#macdev came up with the exact combination)
// turns out it also works on NSTabView and NSBox too, possibly others! // turns out it also works on NSTabView and NSBox too, possibly others!
// and for bonus points, it even seems to fix unsatisfiable-constraint-autoresizing-mask issues with NSTabView and NSBox too!!! this is nuts // and for bonus points, it even seems to fix unsatisfiable-constraint-autoresizing-mask issues with NSTabView and NSBox too!!! this is nuts
@ -31,7 +41,7 @@ static CGFloat margins(int margined)
{ {
if (!margined) if (!margined)
return 0.0; return 0.0;
return 20.0; // TODO named constant return uiDarwinMarginAmount(NULL);
} }
void singleChildConstraintsEstablish(struct singleChildConstraints *c, NSView *contentView, NSView *childView, BOOL hugsTrailing, BOOL hugsBottom, int margined, NSString *desc) void singleChildConstraintsEstablish(struct singleChildConstraints *c, NSView *contentView, NSView *childView, BOOL hugsTrailing, BOOL hugsBottom, int margined, NSString *desc)

View File

@ -147,7 +147,7 @@ struct uiBox {
{ {
if (!self->padded) if (!self->padded)
return 0.0; return 0.0;
return 8.0; // TODO named constant return uiDarwinPaddingAmount(NULL);
} }
// TODO something about spinbox hugging // TODO something about spinbox hugging

View File

@ -200,6 +200,10 @@ _UI_EXTERN BOOL uiDarwinShouldStopSyncEnableState(uiDarwinControl *, BOOL);
// TODO document // TODO document
_UI_EXTERN void uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl *); _UI_EXTERN void uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl *);
// TODO document
_UI_EXTERN CGFloat uiDarwinMarginAmount(void *reserved);
_UI_EXTERN CGFloat uiDarwinPaddingAmount(void *reserved);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif