prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  ProgressBar doesn't appears in a Box [Core] [Cocoa]
  Example code: https://gist.github.com/Dayof/528f9dc38f4178dbc25db6bab553e19a
  
  When a progress bar is add inside of a box (bellow the label is the progress bar):
  
  ![captura de tela 2017-07-04 as 19 43 31](https://user-images.githubusercontent.com/8198348/27844002-b0c949e2-60f1-11e7-853c-ba0630bc481f.png)
  
  
  </issue>
  <code>
  [start of src/cocoa/toga_cocoa/widgets/progressbar.py]
  1 from toga.interface import ProgressBar as ProgressBarInterface
  2 
  3 from ..libs import *
  4 from .base import WidgetMixin
  5 
  6 
  7 class ProgressBar(ProgressBarInterface, WidgetMixin):
  8     def __init__(self, id=None, style=None, max=None, value=None):
  9         super().__init__(id=id, style=style, max=max, value=value)
  10         self._create()
  11 
  12     def create(self):
  13         self._impl = NSProgressIndicator.new()
  14         self._impl.setStyle_(NSProgressIndicatorBarStyle)
  15         self._impl.setDisplayedWhenStopped_(True)
  16 
  17         # Add the layout constraints
  18         self._add_constraints()
  19 
  20     def _set_value(self, value):
  21         if value is not None:
  22             self._impl.setDoubleValue_(value)
  23 
  24     def start(self):
  25         if self._impl and not self._running:
  26             self._impl.startAnimation_(self._impl)
  27             self._running = True
  28 
  29     def stop(self):
  30         if self._impl and self._running:
  31             self._impl.stopAnimation_(self._impl)
  32             self._running = False
  33 
  34     def _set_max(self, value):
  35         if value:
  36             self._impl.setIndeterminate_(False)
  37             self._impl.setMaxValue_(value)
  38         else:
  39             self._impl.setIndeterminate_(True)
  40
  [end of src/cocoa/toga_cocoa/widgets/progressbar.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cocoa/toga_cocoa/widgets/progressbar.py b/src/cocoa/toga_cocoa/widgets/progressbar.py
  --- a/src/cocoa/toga_cocoa/widgets/progressbar.py
  +++ b/src/cocoa/toga_cocoa/widgets/progressbar.py
  @@ -16,6 +16,7 @@
   
           # Add the layout constraints
           self._add_constraints()
  +        self.rehint()
   
       def _set_value(self, value):
           if value is not None:
  @@ -37,3 +38,9 @@
               self._impl.setMaxValue_(value)
           else:
               self._impl.setIndeterminate_(True)
  +
  +    def rehint(self):
  +        self.style.hint(
  +            height=self._impl.fittingSize().height,
  +            width=self._impl.fittingSize().width
  +        )
  
verification_info: {"golden_diff": "diff --git a/src/cocoa/toga_cocoa/widgets/progressbar.py b/src/cocoa/toga_cocoa/widgets/progressbar.py\n--- a/src/cocoa/toga_cocoa/widgets/progressbar.py\n+++ b/src/cocoa/toga_cocoa/widgets/progressbar.py\n@@ -16,6 +16,7 @@\n \n         # Add the layout constraints\n         self._add_constraints()\n+        self.rehint()\n \n     def _set_value(self, value):\n         if value is not None:\n@@ -37,3 +38,9 @@\n             self._impl.setMaxValue_(value)\n         else:\n             self._impl.setIndeterminate_(True)\n+\n+    def rehint(self):\n+        self.style.hint(\n+            height=self._impl.fittingSize().height,\n+            width=self._impl.fittingSize().width\n+        )\n", "issue": "ProgressBar doesn't appears in a Box [Core] [Cocoa]\nExample code: https://gist.github.com/Dayof/528f9dc38f4178dbc25db6bab553e19a\r\n\r\nWhen a progress bar is add inside of a box (bellow the label is the progress bar):\r\n\r\n![captura de tela 2017-07-04 as 19 43 31](https://user-images.githubusercontent.com/8198348/27844002-b0c949e2-60f1-11e7-853c-ba0630bc481f.png)\r\n\n", "before_files": [{"content": "from toga.interface import ProgressBar as ProgressBarInterface\n\nfrom ..libs import *\nfrom .base import WidgetMixin\n\n\nclass ProgressBar(ProgressBarInterface, WidgetMixin):\n    def __init__(self, id=None, style=None, max=None, value=None):\n        super().__init__(id=id, style=style, max=max, value=value)\n        self._create()\n\n    def create(self):\n        self._impl = NSProgressIndicator.new()\n        self._impl.setStyle_(NSProgressIndicatorBarStyle)\n        self._impl.setDisplayedWhenStopped_(True)\n\n        # Add the layout constraints\n        self._add_constraints()\n\n    def _set_value(self, value):\n        if value is not None:\n            self._impl.setDoubleValue_(value)\n\n    def start(self):\n        if self._impl and not self._running:\n            self._impl.startAnimation_(self._impl)\n            self._running = True\n\n    def stop(self):\n        if self._impl and self._running:\n            self._impl.stopAnimation_(self._impl)\n            self._running = False\n\n    def _set_max(self, value):\n        if value:\n            self._impl.setIndeterminate_(False)\n            self._impl.setMaxValue_(value)\n        else:\n            self._impl.setIndeterminate_(True)\n", "path": "src/cocoa/toga_cocoa/widgets/progressbar.py"}]}